I'm using Java, JPA, Primefaces, Wildfly, I have a datatable that I need to export to PDF, in excel it just adds the poi.jar that works but in PDF I do not know which poi I should add, / p>
I'm using Java, JPA, Primefaces, Wildfly, I have a datatable that I need to export to PDF, in excel it just adds the poi.jar that works but in PDF I do not know which poi I should add, / p>
You can use <p:dataExporter>
:
<h:form>
<p:dataTable id="tbl" var="car" value="#{dataExporterView.cars}">
<f:facet name="{Exporters}">
<h:commandLink>
<p:graphicImage name="/demo/images/pdf.png" width="24"/>
<p:dataExporter type="pdf" target="tbl" fileName="cars"/>
</h:commandLink>
</f:facet>
<!-- colunas -->
</p:dataTable>
<h:form>
You can export to several other formats, including XLS. Just change the property type
to type=xls
.
EDIT:
For export to PDF you should include the iText
library in your project.
For export to XLS you should include the apache poi
library in your project.
More information on the PrimeFaces site .