Hi, I am just trying to add current page number to the footer of my document.
I followed the example from "iText in Action" and it works except for one
small issue. For some reason the page number gets broken up. I have pasted
the following code I use to write the footer but it produces the following
result for a 3 page document.
Confidential Page 0 03/23/11 07:36:221
Confidential Page 0 03/23/11 07:36:222
Confidential Page 0 03/23/11 07:36:223
The page numbers are being split after the 0 on either side of the dates.
Is there something I'm not doing correctly?
Also, I tried using the example in the book
class IHeaderFooter extends PdfPageEventHelper {
Phrase[] header = new Phrase[2];
int pagenumber;
with the same result.
========== my code ======================
public void onOpenDocument(PdfWriter writer, Document document) {
PDFHeaderFooter PDFUtil = new PDFHeaderFooter();
String HeaderImageFile =
GeneralUtils.getConfigPropValue("report_header");
document.setHeader(PDFUtil.GetHeader(HeaderImageFile));
DateFormat dateFormat = new SimpleDateFormat("MM/dd/yy");
DateFormat timeFormat = new SimpleDateFormat("HH:mm:ss");
Date date = new Date();
String CurrentDate = dateFormat.format(date);
String CurrentTime = timeFormat.format(date);
HeaderFooter footer = null;
String pgNum = Integer.toString(writer.getPageNumber());
String footerPhrase = "Confidential Page " + pgNum + " " +
CurrentDate +
" " + CurrentTime;
Phrase fp = new Phrase(footerPhrase);
footer = new HeaderFooter(fp, true);
footer.setBorder(Rectangle.NO_BORDER);
footer.setAlignment(Element.ALIGN_CENTER);
document.setFooter(footer);
}
--
View this message in context:
http://itext-general.2136553.n4.nabble.com/Question-about-page-number-footers-tp3399290p3399290.html
Sent from the iText - General mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software
be a part of the solution? Download the Intel(R) Manageability Checker
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php