English 中文(简体)
How can I use revisions to avoid invalidating digital signatures in a PDF?
原标题:

Using Acrobat 9, if I sign a PDF using a self-signed certificate and then edit the PDF after I sign it, Acrobat will inform me that there is a valid signature on the document but that the document also has unsigned changes. If I then sign the PDF again and look in the signature panel, it will show the first signed revision with a valid signature, notate that changes were made after the first revision was signed and then show a second signed revision with a valid signature.

I am trying to duplicate that behavior using iTextSharp. In code, I create a PDF and sign it. Then, I edit the PDF and sign it again. When I open the document in Acrobat, it shows both revisions but marks the first revision as an invalid signature because the document was altered. From what I can gather, I think iTextSharp is signing the entire document rather than just the first revision inside that document. I have set the Append parameter to true in both the PdfStamper and PdfSignatureAppearance constructors, but it does not seem to have any effect.

Since I can get the desired result using Acrobat, I am assuming I am just not using iTextSharp correctly. Can anyone shed some light on this?

问题回答

You have to update the existing PDF instead of rewriting it entirely. Set the following attributes to true to enable updating.

PdfReader reader;
...
reader.Appendable = true;

Adobe does this with layers I suppose. Each revision of the PDF is probably placed in a different layer and then signed. If iText supports layers, you may be able to do it in a similar way.





相关问题
How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Extract everything from PDF [closed]

Looking for solution to extract content from a PDF file (using console tool or a library). It will be used on server to produce on-line e-books from uploaded PDF files. Need to extract following ...

PDF compression How does Adobe do it?

This is a bit more of a fun question than a serious one, but how does the Adobe PDF format make documents so... portable? I just created a small Word document, 235kb in size, containing multiple ...

Exporting HTML Tables

How can I export an HTML table in my page as PDF and/or XLS? (preferably using JS (+jquery))

Using Java PDFBox library to write Russian PDF

I am using a Java library called PDFBox trying to write text to a PDF. It works perfect for English text, but when i tried to write Russian text inside the PDF the letters appeared so strange. It ...

HTML --> PDF with PHP [duplicate]

Possible Duplicate: Convert HTML + CSS to PDF with PHP? How can I convert an HTML page (via $cURL or something) to a PDF file?

Free way to convert PDF to XPS with C#

Are there any free tools that I can use to convert a PDF document into an XPS document? Although a nice programmatic API would be nice, I m not opposed to shelling out to a command line tool to do ...

PDF conversion service

I need to develop a service able to convert MS Office and Open Office documents to PDF. And the PDF`s also need to be commentable when opened in ADOBE Reader. I have used a piece of software from www....

热门标签