Foren

RE: How to print only portlet content

Muhammad Taha, geändert vor 11 Jahren.

How to print only portlet content

Junior Member Beiträge: 63 Beitrittsdatum: 01.05.12 Neueste Beiträge
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, geändert vor 11 Jahren.

RE: How to print only portlet content

Junior Member Beiträge: 63 Beitrittsdatum: 01.05.12 Neueste Beiträge
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 class="section_to_print">
<h:outputText value="#{backingBean.webContent}" escape="false" />
</h:panelGrid>
<h:commandButton value="Print" onclick="print()" />
</h:body>

Thanks
thumbnail
Neil Griffin, geändert vor 11 Jahren.

RE: How to print only portlet content (Antwort)

Liferay Legend Beiträge: 2655 Beitrittsdatum: 27.07.05 Neueste Beiträge
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, geändert vor 11 Jahren.

RE: How to print only portlet content

Junior Member Beiträge: 63 Beitrittsdatum: 01.05.12 Neueste Beiträge
Thanks Niel.