On 9/4/2013 8:18 PM, linuxunil wrote: > First, read the PDF format specification v1.7, section 3.4.5 page 98 > http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_reference_1-7.pdf > Talks about "Incremental Updates." Read this section for more info of what > I'm talking here.
We know ISO-32000-1 inside-out, we know what incremental updates are. > Second, in my previous posts when I referred to pdfStamper.extractRevision > () I was actually referring to me > pdfStamperInstance.getAcroFields().extractRevision(); Incremental updates is a means to create a signed revision, however, not every incremental update is a revision. Are you mixing the concepts of incremental updates and signed revisions? > 1 - I get a template server. The concept of a "template server" is unknown. You probably mean: I get a template from a server. > 2 - I open this file fill some fields and sign. Saved and closed the file. From your code, it's impossible to detect whether or not you sign in append mode. To fill out the form, you use: PdfStamper stamper = new PdfStamper(reader, outputFilled1PdfFos); This means you are NOT creating an incremental update. To sign the form, you use: ItextSmartCardPdfSigner signer = new ItextSmartCardPdfSigner("smartCardPasswordHere".toCharArray()); signer.sign(outputFilled1Pdf, outputSignedPdf, "reason", "local", "contact", 0, 1, "SignatureFieldNameHere"; We can't GUESS if you're creating an incremental update, and you're not telling us. > 3 - We reopen this file and try to extract the file revision. ??? This requirement is absurd. You don't have a revision. There's only one signature! > 4 - Mando InputStream to the revision to the server. What is "Mando"? > 5 - The server receives the inputStream and must make a revision in the > append template. What is this requirement about? I don't understand what you mean. Let's take a look at the code: > //------------------------------------------------- > // Incremental Update (!i want to know how to do this > part!) > //Here we simulate the server received the revision > //and is trying to append the revision on the template > //------------------------------------------------- Do you want to append something to the UNSIGNED filled out form? Do you want to append something to the SIGNID filled out form? What are you trying to append to what? Why would you need the template? You've already filled it out? > System.out.println("#> STARTING THE INCREMENTAL UPDATE"); > > FileInputStream templateFis = new FileInputStream(pdfTemplate); > byte[] templateFisBuffer = new byte[templateFis.available()]; > templateFis.read(templateFisBuffer); > templateFis.close(); This is your original template. > > File outputFile = new File("out.pdf"); > FileOutputStream fos = new FileOutputStream(outputFile); > > fos.write(templateFisBuffer); > fos.flush(); > > fos.write(revisionBuffer); > fos.flush(); > > fos.close(); > > System.out.println("#> END OF THE INCREMENTAL UPDATE"); > } > > } Ouch... you're doing something completely wrong! You have a file that starts with %PDF-1.7 and ends with %%EOF. If you fill out that form in append mode (incremental update, something you DON'T do), then you add extra stuff after the last %%EOF and you add an extra %%EOF. If you sign that form in append mode, you add extra stuff after that %%EOF and you add another %%EOF. The COMPLETE file is a single revision. Only when you add another signature in append mode, you create another revision. That COMPLETE file is the second revision. You are making the following false assumptions: 1. you think you are filling out the form in append mode, but you don't. 2. you assume that a revision is the part that is added after the original %%EOF, but it isn't. In short: you think something isn't working in iText based on the wrong interpretation of the concepts incremental update and revision. iText can extract revisions, but iText doesn't have any functionality to return different stages in an incremental update. Why would iText need such functionality? Getting the different updates is only a matter of finding one of the previous %%EOF markers and removing all the bytes that follow it. ------------------------------------------------------------------------------ Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! Discover the easy way to master current and previous Microsoft technologies and advance your career. Get an incredible 1,500+ hours of step-by-step tutorial videos with LearnDevNow. Subscribe today and save! http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk _______________________________________________ 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