pdf签名无效红叉_“至少一个签名无效”。使用itext从pdf中删除签名后出现错误消息...

本文介绍了当尝试使用iText从已有多重签名的PDF中删除特定签名时,出现“至少一个签名无效”错误的原因及解决方案。在PDF签名中,每次新增签名都会保留原始内容并增加新数据。因此,移除早于其他签名的签名会导致后续签名失效。为正确删除签名,需要找到覆盖整个文档的签名,并通过提取修订历史来恢复到之前的签名状态。
摘要由CSDN通过智能技术生成

I have a digitally signed pdf with multiple signatures. Now I want to remove only one of the signatures. I am using itext for the same. The code is as follows:

PdfReader reader = new PdfReader(src_path);

PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(dest_path));

{

AcroFields.Item item = stamper.getAcroFields().getFieldItem(fieldname);

ClearSignatureDictionary(item.getMerged(0));

ClearSignatureDictionary(item.getWidget(0));

ClearSignatureDictionary(item.getValue(0));

}

}

private static void ClearSignatureDictionary(PdfDictionary dic)

{

dic.remove(PdfName.AP);

dic.remove(PdfName.AS);

dic.remove(PdfName.V);

dic.remove(PdfName.DV);

dic.remove(PdfName.SV);

dic.remove(PdfName.FF);

dic.put(PdfName.F, new Pdf

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值