kgk, kgk wrote > I am trying to insert/copy the revisions from an old PDF file (extracted > with AcroFields.ExtractRevision()) to a new one. > Can this be done with iText?
First of all, I hope you are aware that AcroFields.ExtractRevision() does not allow access to arbitrary revisions of a document, merely to all signed revisions. Thus, unless you apply signatures, you won't have anything to extract with that method. That being said, there unfortunately is no way to copy or insert revisions from one PDF into another one as such. Leonard already explained. BUT: you can of course add the new document version as a new revision to the old PDF document by opening that old PDF in a PdfStamper in append mode (have a look at the documentation of the PdfStamper constructors) and importing the pages of the new document version (as exported e.g. by MS Word) into it while at the same time removing the former pages! Afterwards you only need to sign the PDF to allow revision extraction by iText. Doing this you get a PDF containing all the versions of your document as revision extractable by e.g. AcroFields.ExtractRevision(). The downsides: 1. this PDF will become huge soon, as each document version essentially is stored separately in the document without any cross-revision object reuse. --- If your process knows that only certain pages have been changed, you can make your PDFStamping more intelligent and only replace changed pages. 2. page imports as available in the PdfStamper class most likely drop interactive features (forms, annotations, ...) of the original and may require rotation during insertion. --- If there are interactive features in your PDFs which must be preserved, you can try and implement a copying routine for them; if you really like challenges, you might want to port the PdfCopy page import code to PdfStamper; the page import code there does a real 1:1 copy. 3. Adobe Acrobat and Reader might display the signatures as broken as the changes from revision to revision proposed here indeed are beyond anything you can allow to be done to your signed revision. --- If you are not bound to revision extraction by AcroFields.ExtractRevision() you can drop the need to sign the revisions and implement your own revision extraction code which either directly works with the %%EOF markers or instead with information you inject into the document when creating a new revision. Regards, Michael -- View this message in context: http://itext-general.2136553.n4.nabble.com/Insert-Revisions-Programmatically-In-A-PDF-File-tp4657822p4657835.html Sent from the iText - General mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_mar _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net 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