Reputation: 2423
I develop a JSF application and need to convert a div or some other container like h:panalGroup or p:panel to PDF. How can I print a container of the page to a PDF document.
Important: I can not print the whole page. I can not use primefaces data exported as it renders only a databtable
Upvotes: 1
Views: 1767
Reputation: 9935
For my experience, there are two process.
Example Code
<p:commandButton value="Print">
<p:printer target="printPanel" />
</p:commandButton>
<h:panelGroup id="printPanel">
here you print content
</h:panelGroup>
Make sure the printer Setting in Browser(Firefox) as below.
When you click Print
buttom, Print
dialog will be appere. Choose PDF
printer and print it.
Your content will be print as PDF File.
Upvotes: 2