Manoj wrote: > I hava a bunch of PDF files and on the first page i want to enter a text > in the top of the page "DUPLICATE".
Aha, I prefer to call this PDF manipulation instead of PDF editing (to avoid confusion). > Would like to know if I will be able to achieve this by using iText. Yes, that's very easy with PdfStamper. Carsten Hammer has written a plug-in for the toolbox that shows how it works, and there's an example in the tutorial: http://itextdocs.lowagie.com/tutorial/general/copystamp/#pdfstamper PdfReader reader = new PdfReader("existing.pdf"); PdfStamper stamp = new PdfStamper(reader, new FileOutputStream("stamped.pdf")); PdfContentByte under = stamp.getUnderContent(1); // change the content beneath page 1 PdfContentByte over = stamp.getOverContent(1); // change the content on top of page 1 stamp.close() Once you have a PdfContentByte object such as under or over, you need a method like showTextAligned: http://itext.ugent.be/library/api/com/lowagie/text/pdf/PdfContentByte.html#showTextAligned(int,%20java.lang.String,%20float,%20float,%20float) under.beginText(); under.setFontAndSize(bf, 12); under.showTextAligned( PdfContentByte.ALIGN_CENTER, "Duplicate", 250, 650, 0); under.endText(); bf is an object of type BaseFont. http://itextdocs.lowagie.com/tutorial/fonts/#basefont You'll find more info and examples in the book on iText: http://itext.ugent.be/itext-in-action/ br, Bruno ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://itext.ugent.be/itext-in-action/
