<p:dataExporter type="pdf" target="callRpt"preProcessor="#{pc_CallReportBean.preProcessPDF}"
fileName="#{reportLbl['callReport.callsReportFileName']}" />
public void preProcessPDF(Object document) throws IOException, BadElementException, DocumentException
{
Document pdf = (Document) document;
pdf.open();
pdf.setPageSize(PageSize.A4);
ServletContext servletContext = (ServletContext)FacesContext.
getCurrentInstance().getExternalContext().getContext();
String logo = servletContext.getRealPath("") + File.separator + "images" + File.separator + "prime_logo.png";
pdf.add(Image.getInstance(logo));
}
上記のコードでは、primefaces のタグを使用してテーブルを pdf 形式でエクスポートし、フロント ページにロゴを設定します。
p:dataExporter を使用してページ番号、ヘッダー、およびフッターを設定するにはどうすればよいですか?
また、複数のページが生成される場合、すべてのページにテーブルの見出しを設定したいですか?