Reputation: 277
I would like to change PDF page size to A4 landscape when exporting tables. But I cannot get it done whatever I do..
here is my code:
<h:commandLink title="Export">
<p:graphicImage value="/resources/theme-main/images/export/pdf.png"
style="border:0"/>
<p:dataExporter target="myTable" type="pdf" fileName="name"
encoding="windows-1250" preProcessor="#{fileExportProcessor.preProcessPDF}"/>
</h:commandLink>
where managed bean's method is very simple:
public void preProcessPDF(Object document) {
Document pdf = (Document) document;
pdf.open();
pdf.setPageSize(PageSize.A4.rotate());
}
I also tried to set size to A0 or some my custom size, just to see it working, but nothing changed... PDF export exports only in A4 portrait mode.
Could you help me, how to make this work (A4 landscape mode)?
Upvotes: 5
Views: 6492
Reputation: 126
Try this way :
public void preProcessPDF(Object document) {
Document pdf = (Document) document;
pdf.setPageSize(PageSize.A4.rotate());
pdf.open();
}
Worked for me !
Upvotes: 11