Hi Paulo Thanks a lot for your comprehensive answer. The approach to use the PdfStamper to create a valid PDF out of a recovered PDF works for me.
Best wishes Reza On 03/13/12 14:32, Paulo Soares wrote: > On Tue, Mar 13, 2012 at 12:14 PM, Reza Hedayat<[email protected]> > wrote: >> Hi iText developers >> >> The PdfReader class has a protected member variable called rebuilt, which is >> set to true in some cases. Therefore, this causes a DocumentException in the >> PdfStamperImp class as follows: >> >> [start: Fragment of com.itextpdf.text.pdf.PdfStamperImp] >> ... >> >> PdfStamperImp(PdfReader reader, OutputStream os, char pdfVersion, boolean >> append) throws DocumentException, IOException { >> ... >> if (append) { >> if (reader.isRebuilt()) >> throw new >> DocumentException(MessageLocalization.getComposedMessage >> >> ("append.mode.requires.a.document.without.errors.even.if.recovery.was.possible")); >> } >> ... >> >> [end: Fragment com.itextpdf.text.pdf.PdfStamperImp] >> >> Based on the facts mentioned above, there are some questions that bother me: >> >> 1. What are the characteristics of a PDF document that are evaluated in >> terms of setting the rebuilt property to true? > The PDf is broken and the xref table had to be rebult. > >> 2. Is it possible to determine these characteristics by a tool? > Yes, the tool is iText. > >> 3. Is it possible to change these characteristics so that the rebuilt >> property is not set to true anymore? > Use PdfStamper to output the rebuilt PDF. This will result in a good PDF. > >> 4. What is the exact idea behind this logic that leads to a >> DocumentException if the document was recognized as "recovered"? > Append mode requires a good document as the changes are appended after > the original. If the original is broken we may not even know where it > ends to append new information. This is even more crucial when > signatures are present. > > Paulo > > ------------------------------------------------------------------------------ > Keep Your Developer Skills Current with LearnDevNow! > The most comprehensive online learning library for Microsoft developers > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > Metro Style Apps, more. Free future releases when you subscribe now! > http://p.sf.net/sfu/learndevnow-d2d > _______________________________________________ > 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 -- AdNovum Informatik AG Reza Hedayat, Software Engineer Dipl. Informatik-Ing. FH Roentgenstrasse 22, CH-8005 Zurich mailto:[email protected] phone: +41 44 272 6111, fax: +41 44 272 6312 http://www.adnovum.ch AdNovum Locations: Bern, Budapest, Singapore, Zurich (HQ) ------------------------------------------------------------------------------ Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d _______________________________________________ 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
