PDF 生成模板编辑器
开源可视化 PDF 生成引擎,支持自定义模板,并提供面向开发者的 API,灵活构建文档生成流程。
信任证书分为两个步骤:
信任证书的关键代码如下:
// 将本地存储中的证书添加为可信任证书
String certFilePath = rootDir+"/certificate/Certificate.pfx";
String password = "ComPDFKit";
if (CPDFSignature.checkPKCS12Password(certFilePath, password)) {
CPDFX509 x509 = CPDFSignature.getX509ByPKCS12Cert(certFilePath, password);
// Add your certificate to the trust path.
boolean result = x509.addToTrustedCertificates(rootDir + "/trusted","compdfkit.pem");
if (result) {
System.out.println("add to trusted certificates success");
}else {
System.out.println("add to trusted certificates fail");
}
}
// Add digital signature certificate in pdf file as trusted certificate.
CPDFSignature signature = document.getPdfSignature(0);
CPDFSigner signer = signature.getSignerArr()[0];
CPDFX509 cpdfx509 = signer.getCert();
boolean result = cpdfx509.addToTrustedCertificates(rootDir + "/trusted","compdfkit.pem");
if (result) {
System.out.println("add to trusted certificates success");
}else {
System.out.println("add to trusted certificates fail");
}