我想将 PDF 页面尺寸更改为 A4景观导出表时。但无论我做什么都无法完成它..
这是我的代码:
<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>
其中托管bean的方法非常简单:
public void preProcessPDF(Object document) {
Document pdf = (Document) document;
pdf.open();
pdf.setPageSize(PageSize.A4.rotate());
}
我还尝试将尺寸设置为 A0 或一些我的自定义尺寸,只是为了看看它是否有效,但没有任何改变... PDF 导出仅在 A4 纵向模式下导出。
你能帮我,如何使这个工作(A4横向模式)?
试试这个方法:
public void preProcessPDF(Object document) {
Document pdf = (Document) document;
pdf.setPageSize(PageSize.A4.rotate());
pdf.open();
}
为我工作!
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)