Combination View Flat View Tree View
Threads [ Previous | Next ]
Muhammad Taha
How to print only portlet content
January 15, 2013 9:38 AM
Answer

Muhammad Taha

Rank: Junior Member

Posts: 73

Join Date: May 1, 2012

Recent Posts

Hi All,

How to print portlet content in JSF 2.0 portlet..
javascript window.print() is priting whole webpage. How to print only portlet content.

Thanks.
Muhammad Taha
RE: How to print only portlet content
January 24, 2013 5:26 AM
Answer

Muhammad Taha

Rank: Junior Member

Posts: 73

Join Date: May 1, 2012

Recent Posts

Im able to print content based on class but I want to print based on its.. unable apply css based on Id

below is my code

<h:head>
<style type="text/css">
@media print
{
body * { visibility: hidden; }
.section_to_print * { visibility: visible; }
}
</style>
</h:head>

<h:body>
<h:panelGrid id="section_to_print">
<h:outputText value="#{backingBean.webContent}" escape="false" />
</h:panelGrid>
<h:commandButton value="Print" onclick="print()" />
</h:body>

Thanks
Muhammad Taha
RE: How to print only portlet content
January 24, 2013 5:42 AM
Answer

Muhammad Taha

Rank: Junior Member

Posts: 73

Join Date: May 1, 2012

Recent Posts

correction:; its not <h:panelGrid id="section_to_print"> its <h:panelGrid class="section_to_print">
Neil Griffin
RE: How to print only portlet content
January 24, 2013 10:57 AM
Answer

Neil Griffin

LIFERAY STAFF

Rank: Liferay Legend

Posts: 2179

Join Date: July 26, 2005

Recent Posts

This might be *close* to what you're asking for, but might not exactly meet your requirements.

We just added the ability to support Liferay "Print" mode, which is vendor-specific to Liferay Portal. For more info on how to use it, see FACES-1471.

The only file we had to fix in order to support this was GenericLiferayFacesPortlet.java but since it hasn't been released yet you would have to copy it into your portlet project.

When a portlet supports the Print mode, there will be a decoration for it that you can click on in the portlet titlebar.
Muhammad Taha
RE: How to print only portlet content
January 25, 2013 3:37 AM
Answer

Muhammad Taha

Rank: Junior Member

Posts: 73

Join Date: May 1, 2012

Recent Posts

Thanks Niel.