Generate pdf in java

4

Good afternoon, I would like some help regarding generating a pdf report in java. I'm using Primefaces to export this report. I created the first line with the fields as you can see in the image below, but when exporting automatically it also generates this second line, picking up from my datatable, how do I leave just the line I created? because I do not want it to appear in the datatable. Thankful

This is my bean that I'm doing to generate my pdf.

 public void preProcessPDF(Object document) throws DocumentException, BadElementException, IOException {
Document pdf = (Document) document;
pdf.setPageSize(PageSize.A4.rotate());



    pdf.open();

       PdfPTable table = new PdfPTable(8);
        table.addCell(new PdfPCell(new Phrase("Rodovia")));
        table.addCell(new PdfPCell(new Phrase("Callbox")));
        table.addCell(new PdfPCell(new Phrase("Tipo")));
        table.addCell(new PdfPCell(new Phrase("Versão Firmware")));
        table.addCell(new PdfPCell(new Phrase("Endereço IP")));
        table.addCell(new PdfPCell(new Phrase("Ramal/Numero")));
        table.addCell(new PdfPCell(new Phrase("Ativo")));
        table.addCell(new PdfPCell(new Phrase("Status")));




    Font catFont = new Font(Font.TIMES_ROMAN, 18, Font.BOLD);

    Paragraph p = new Paragraph("Relatório", catFont);
    p.setAlignment(Element.ALIGN_CENTER);

    p.setSpacingAfter(20);

    pdf.add(p);
    pdf.add(table);


}

<h:commandLink><iclass="fa fa-file-pdf-o fa-fw"/> #{bundle['system.ui.label.export.pdf']}
<p:dataExporter type="pdf" 
encoding="iso-8859-1"
target="callbox_datatable"
preProcessor="#{callboxBean.preProcessPDF}"
/>
</h:commandLink>
    
asked by anonymous 19.02.2016 / 18:26

1 answer

1

In the PrimeFaces documentation:

  

In case you need one or more columns to be ignored exportable option of column to false.
  

19.02.2016 / 18:33