如何在 PdfBox 中显示 Creator 的签名详情
How to show Creator in Detail of Signature in PdfBox
我想在签名详细信息中显示创作者。在“签名是使用不可用创建的。”
这是我添加标志信息的代码:
private void signDetached(SignatureInterface signature, PDDocument document, OutputStream output) throws IOException {
PDSignature pdSignature = new PDSignature();
pdSignature.setFilter(PDSignature.FILTER_ADOBE_PPKLITE);
pdSignature.setSubFilter(PDSignature.SUBFILTER_ADBE_PKCS7_DETACHED);
pdSignature.setName("jvmfy");
pdSignature.setReason("Learn how to sign pdf with jvmfy.com!");
// the signing date, needed for valid signature
pdSignature.setSignDate(Calendar.getInstance());
// register signature dictionary and sign interface
document.addSignature(pdSignature, signature);
// write incremental (only for signing purpose)
// use saveIncremental to add signature, using plain save method may break up a document
document.saveIncremental(output);
}
我在 PDF 32000 specification 中查找 Prop_Build
。这在 PDFBox 示例中没有实现,在搜索“PDF Signature Build Dictionary Specification”后,我认为它令人困惑。但根据我在现有签名 PDF 中看到的内容,此尝试有效:
COSDictionary pbDict = new COSDictionary();
COSDictionary appDict = new COSDictionary();
appDict.setName(COSName.NAME, "PDFBox");
pbDict.setItem(COSName.getPDFName("App"), appDict);
pdSignature.getCOSObject().setItem(COSName.getPDFName("Prop_Build"), pbDict);
我想在签名详细信息中显示创作者。在“签名是使用不可用创建的。”
这是我添加标志信息的代码:
private void signDetached(SignatureInterface signature, PDDocument document, OutputStream output) throws IOException {
PDSignature pdSignature = new PDSignature();
pdSignature.setFilter(PDSignature.FILTER_ADOBE_PPKLITE);
pdSignature.setSubFilter(PDSignature.SUBFILTER_ADBE_PKCS7_DETACHED);
pdSignature.setName("jvmfy");
pdSignature.setReason("Learn how to sign pdf with jvmfy.com!");
// the signing date, needed for valid signature
pdSignature.setSignDate(Calendar.getInstance());
// register signature dictionary and sign interface
document.addSignature(pdSignature, signature);
// write incremental (only for signing purpose)
// use saveIncremental to add signature, using plain save method may break up a document
document.saveIncremental(output);
}
我在 PDF 32000 specification 中查找 Prop_Build
。这在 PDFBox 示例中没有实现,在搜索“PDF Signature Build Dictionary Specification”后,我认为它令人困惑。但根据我在现有签名 PDF 中看到的内容,此尝试有效:
COSDictionary pbDict = new COSDictionary();
COSDictionary appDict = new COSDictionary();
appDict.setName(COSName.NAME, "PDFBox");
pbDict.setItem(COSName.getPDFName("App"), appDict);
pdSignature.getCOSObject().setItem(COSName.getPDFName("Prop_Build"), pbDict);