我正在尝试使用JSP页面和我的编码大纲生成PDF,如下所示,
Document document = new Document(PageSize.A4,70/*Left*/,70/*Right*/,140/*Top*/,30/*Bottom*/);
response.setContentType("application/pdf" );
response.setHeader("Content-Disposition","inline; filename=vishwa-mandate.pdf");
PdfWriter.getInstance(document, response.getOutputStream());
document.open();
HeaderFooter footer = new HeaderFooter(new Phrase("This is page "), true);
document.setFooter(footer);
/* PAGE 01 */
document.newPage();
/* PAGE 02 + */
document.close();
我明确致电document.newPage();
后,页脚不适用于第01页
如何在整个文档中获取页脚?
答案 0 :(得分:6)
setFooter(页脚)
更正后的代码如下
HeaderFooter footer = new HeaderFooter(new Phrase("This is page "), true);
document.setFooter(footer);
// Document should open after setting the footer
document.open();