我正在尝试使用itext7以附加模式对PDF进行数字签名。我在同一个pdf文件上有多个签名。我现在指的是Bruno Lowagie的白皮书来解决这个问题。我没有在iText7中获得PdfStamper的任何替代方案。我目前使用的代码在下面分享: -
PdfReader reader = new PdfReader(src);
FileStream os = new FileStream(dest,FileMode.Open);
PdfStamper stamper = PdfStamper.createSignature(reader, os, '\\', null, true);
// Creating the appearance
PdfSignatureAppearance appearance = stamper.getSignatureAppearance();
appearance.setVisibleSignature(name);
appearance.setCertificationLevel(level);
// Creating the signature
ExternalSignature pks = new PrivateKeySignature(pk, "SHA-256", "BC");
MakeSignature.signDetached(appearance, digest, pks, chain, null, null, null, 0, CryptoStandard.CMS);