You never increment i... int i=1; while(i < nu_pages) { over = stamper.getOverContent(i); putData(over, helv); }
Try changing to while(i < nu_pages) { over = stamper.getOverContent(i); putData(over, helv); i++; } Howard ----- Original Message ---- From: "Gawędzki, Paweł" <[EMAIL PROTECTED]> To: Post all your questions about iText here <itext-questions@lists.sourceforge.net> Sent: Thursday, April 3, 2008 10:43:35 AM Subject: [iText-questions] pdf Image to real Image? I can't add data to existing pdf. It's adding data only to first page. Nothing hepends on others. This is my code: try { PdfReader reader = new PdfReader(pdf_path1); int nu_pages = reader.getNumberOfPages(); PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(pdf_path2)); PdfContentByte over; BaseFont helv = BaseFont.createFont(BaseFont.COURIER_BOLD, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED); int i=1; while(i < nu_pages) { over = stamper.getOverContent(i); putData(over, helv); } stamper.close(); } catch (IOException ioe) { ioe.printStackTrace(); System.out.println(ioe.getMessage()); } catch (DocumentException de) { de.printStackTrace(); System.out.println(de.getMessage()); } private void putData(PdfContentByte over, BaseFont helv) throws DocumentException, IOException { over.beginText(); over.setFontAndSize(helv, 11); over.setTextMatrix(, oy); over.showText("Text to add"); over.endText(); } I do not know why it works only for first page. ------------------------------------------------------------------------------ Skandia Życie Towarzystwo Ubezpieczeń S.A. ul. Cybernetyki 7, 02-677 Warszawa Sąd Rejonowy dla m.st. Warszawy, XIII Wydział Gospodarczy Krajowego Rejestru Sądowego Nr KRS 0000056463, Regon: 016003836, NIP: 951-19-33-418 wysokość kapitału zakładowego: 46.000.000,00 PLN wysokość kapitału wpłaconego: 46.000..000,00 PLN ------------------------------------------------------------------------------ ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Do you like iText? Buy the iText book: http://www.1t3xt.com/docs/book.php Or leave a tip: https://tipit.to/itexttipjar ____________________________________________________________________________________ You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost. http://tc.deals.yahoo.com/tc/blockbuster/text5.com ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Do you like iText? Buy the iText book: http://www.1t3xt.com/docs/book.php Or leave a tip: https://tipit.to/itexttipjar