Hi,
I am trying to generate a PDF using iText XML.
I want the footer to show up in the report starting from first page.
So I add it to document object as shown in the code below.
I see no footer in the PDF.
Is this a bug or am I doing something wrong?
Thanks,
Raju
public OutputStream generatePdf(String iTextXml) throws RsException {
ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
OutputStream stream = new BufferedOutputStream(byteStream);
Document document = new Document();
document.setPageSize(PageSize.LETTER.rotate());
document.setMargins(50, 50, 50, 50);
HeaderFooter footer = new HeaderFooter(new Phrase("This is a footer with a page number"), true);
document.setFooter(footer);
try {
PdfWriter writer = PdfWriter.getInstance(document, stream);
SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
parser.parse(new ByteArrayInputStream(iTextXml.getBytes()), new SAXiTextHandler(document));
}
catch(Exception e) {
e.printStackTrace();
}
return byteStream;
}
