0

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?

4

2 回答 2

1

您必须更新现有的 PDF 而不是完全重写它。将以下属性设置为 true 以启用更新。

PdfReader reader;
...
reader.Appendable = true;
于 2009-12-16T20:01:23.013 回答
0

我想 Adob​​e 会用图层来做到这一点。PDF 的每个修订版都可能放置在不同的层中,然后进行签名。如果 iText 支持图层,您可以以类似的方式进行操作。

于 2011-05-09T04:16:32.033 回答