Could someone please tell me what I am doing
wrong here? I am basically using the sample code
from AddWatermarkPageNumbers.java but I am not
seeing any extra text at all. The inserted page
has text stamped on it, but none of the others.
PdfReader reader = new PdfReader(new
RandomAccessFileOrArray("3.pdf"), null);
n = reader.getNumberOfPages();
//we create a stamper that will copy the document
to a new file
PdfStamper stamp = new PdfStamper(reader, new
FileOutputStream("output.pdf"));
BaseFont bf =
BaseFont.createFont(utils.properties.getProperty("fonts_path")+File.separator+"UVCB____.TTF",
BaseFont.WINANSI, BaseFont.NOT_EMBEDDED);
PdfContentByte cb;
for(int p=1; p<=n; p++){
// watermark under the existing page
//under = stamp.getUnderContent(i);
//under.addImage(img);
// page number over the existing page
cb = stamp.getOverContent(p);
int rotation = reader.getPageRotation(p);
cb.beginText();
cb.setFontAndSize(bf, 18);
cb.setTextMatrix(30, 30);
cb.showText("page " + p);
cb.setFontAndSize(bf, 32);
cb.showTextAligned(Element.ALIGN_LEFT,
"DUPLICATE", 230, 430, 45);
cb.endText();
}
// adding an extra page
stamp.insertPage(1, PageSize.A4);
cb = stamp.getOverContent(1);
cb.beginText();
cb.setFontAndSize(bf, 18);
cb.showTextAligned(Element.ALIGN_LEFT, "DUPLICATE
OF AN EXISTING PDF DOCUMENT", 30, 600, 0);
cb.endText();
stamp.close();
reader.close();
stamp=null;
reader=null;
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
iText-questions mailing list
iText-questions@(protected)
https://lists.sourceforge.net/lists/listinfo/itext-questions