Forums de discussion

How to add print button within popup and print that popup content?

thumbnail
Gaurang Sheladia, modifié il y a 13 années.

How to add print button within popup and print that popup content?

Regular Member Publications: 159 Date d'inscription: 15/02/09 Publications récentes
Hi All,

Here i have one query, currently i am trying to add print button in Liferay Popup. While clicking on print button it should print only the content which popup has.

Has anyone tried or any approach would be really appreciated.

Thanks in advance.

Thanks,
Gaurang
thumbnail
jelmer kuperus, modifié il y a 13 années.

RE: How to add print button within popup and print that popup content?

Liferay Legend Publications: 1191 Date d'inscription: 10/03/10 Publications récentes
I guess the easiest way would be to open the portlet in popup mode in a new window, then pass in a parameter that triggers a window.print(); on load of the page

eg.


<a href="<portlet:renderURL windowState=" pop_up">
                          <portlet:param name="print" value="true" />
                   "  target="_blank"
  link
</a>




&lt;% if (ParamUtil.getBoolean(request, "print", false) { %&gt;

<script type="text/javascript">
  window.onload = function() {
    window.print();
  }
</script>

&lt;% } %&gt;
thumbnail
Gaurang Sheladia, modifié il y a 13 années.

RE: How to add print button within popup and print that popup content?

Regular Member Publications: 159 Date d'inscription: 15/02/09 Publications récentes
Hi Jelmer,

Thanks for your quick prompt.

I have resolved my issue with using action url in liferay to call same Action class and new window for the print the popup.

Thanks,
Gaurang
thumbnail
mohammed ansari, modifié il y a 12 années.

RE: How to add print button within popup and print that popup content?

New Member Publications: 11 Date d'inscription: 08/02/11 Publications récentes
Gaurang Sheladia:
Hi Jelmer,

Thanks for your quick prompt.

I have resolved my issue with using action url in liferay to call same Action class and new window for the print the popup.

Thanks,
Gaurang


Hey Gaurang can you share what you did..Thanks
thumbnail
Gaurang Sheladia, modifié il y a 12 années.

RE: How to add print button within popup and print that popup content?

Regular Member Publications: 159 Date d'inscription: 15/02/09 Publications récentes
Hi Ansari,

I have call the same url while call any popup.

Let me know for any query.
thumbnail
janakiram n, modifié il y a 10 années.

RE: How to add print button within popup and print that popup content?

New Member Publications: 2 Date d'inscription: 11/03/13 Publications récentes
i too have similar problem, but not this,i need to print filled form data when clicked on print button after submitting
thumbnail
alex wom, modifié il y a 12 années.

RE: How to add print button within popup and print that popup content?

Regular Member Publications: 218 Date d'inscription: 04/05/09 Publications récentes
Hi Jelmer I tried to do this, and I print popup by using
<aui:script>
print();
</aui:script>
And it prints, but prints an empty page ... To be more precise my print code is:

boolean print = false;
if (Validator.isNotNull(viewMode)) {
print=true;
articleDisplay = JournalContentUtil.getDisplay(
themeDisplay.getScopeGroupId(), journalArticle.getArticleId(), journalArticle.getTemplateId(), viewMode, themeDisplay.getLanguageId(),
themeDisplay);
%>
<%= articleDisplay.getContent() %>

<aui:script>
print();
</aui:script>

<%
}
thumbnail
jelmer kuperus, modifié il y a 12 années.

RE: How to add print button within popup and print that popup content?

Liferay Legend Publications: 1191 Date d'inscription: 10/03/10 Publications récentes
But does the journal content article display ?
thumbnail
alex wom, modifié il y a 12 années.

RE: How to add print button within popup and print that popup content?

Regular Member Publications: 218 Date d'inscription: 04/05/09 Publications récentes
Yes, if I drop print() I see a popup with the article, but the popup contains all the page framework. The difference with journal content print is that when I print the popup contains only the article display without the page framework: but I don't know how to eliminate it.
thumbnail
jelmer kuperus, modifié il y a 12 années.

RE: How to add print button within popup and print that popup content?

Liferay Legend Publications: 1191 Date d'inscription: 10/03/10 Publications récentes
Notice that in my example i use windowState="pop_up"

what that does is that it usually eliminates the header / footer etc.

Or on a technical level it will use portal_pop_up.vm instead of portal_normal.vm from your theme
thumbnail
alex wom, modifié il y a 12 années.

RE: How to add print button within popup and print that popup content?

Regular Member Publications: 218 Date d'inscription: 04/05/09 Publications récentes
Yesss! It's ok