Hello! As promised an example for the issue. BTW, while creating the example I found out that the issue only comes up if the document in question has more than one page (in addition to the streams used in page contents arrays multiple times, of course) --- this is due to eliminateSharedStreams() immediately returning for single page documents.
Sample file: http://old.nabble.com/file/p26756669/sample.pdf sample.pdf (Included verbatim at the end of this message.) Code fragment: PdfReader reader = new PdfReader(new URL("http://old.nabble.com/file/t1363360/sample.pdf")); PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(new File(sample.out.pdf")), '\0', true); stamper.addSignature("sig", 1, 100, 100, 200, 200); stamper.close(); This replaces the /Contents array of the first page: /Contents [4 0 R 4 0 R 5 0 R 5 0 R] by /Contents[4 0 R 7 0 R 5 0 R 8 0 R] without including any objects 7 0 obj or 8 0 obj. Regards, Michael. PS: sample.pdf: %PDF-1.3 %ÄÖÜäöüß 1 0 obj << /Type/Catalog /PageMode/UseNone /Pages 2 0 R >> endobj 2 0 obj << /Type/Pages /Count 2 /Kids[3 0 R 6 0 R] >> endobj 3 0 obj << /Type/Page /Parent 2 0 R /MediaBox [0 0 595.2 841.68] /Resources <</ProcSet [/PDF]>> /Contents [4 0 R 4 0 R 5 0 R 5 0 R] >> endobj 4 0 obj <</Length 2>> stream q endstream endobj 5 0 obj <</Length 23>> stream 30 700 460 100 re f Q endstream endobj 6 0 obj << /Type/Page /Parent 2 0 R /MediaBox [0 0 595.2 841.68] /Resources <</ProcSet [/PDF]>> /Contents [4 0 R 4 0 R 5 0 R 5 0 R] >> endobj xref 0 7 0000000000 65535 f 0000000020 00000 n 0000000093 00000 n 0000000161 00000 n 0000000312 00000 n 0000000368 00000 n 0000000446 00000 n trailer << /Size 7 /Root 1 0 R >> startxref 597 %%EOF -- View this message in context: http://old.nabble.com/Problem-with-PdfReader.eliminateSharedStreams%28%29-in-concert-with-appending-PdfStamper-tp26734822p26756669.html Sent from the iText - General mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
