PDF Generation Template Editor
Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.
Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.
Trusting certificates involve two steps:
This example shows how to trust certificates:
// Add the certificate in the local storage as a trusted certificate.
String certFilePath = FileUtils.getAssetsTempFile(context, "Certificate.pfx");
String password = "ComPDF";
if (CPDFSignature.checkPKCS12Password(certFilePath, password)) {
CPDFX509 x509 = CPDFSignature.getX509ByPKCS12Cert(certFilePath, password);
// Add your certificate to the trust path.
boolean result = x509.addToTrustedCertificates(context);
}
// Add digital signature certificate in pdf file as trusted certificate.
CPDFDocument document = new CPDFDocument(context);
document.open(FileUtils.getAssetsTempFile(context, "Signed.pdf"));
CPDFSignature signature = document.getPdfSignature(0);
CPDFSigner signer = signature.getSignerArr()[0];
CPDFX509 cpdfx509 = signer.getCert();
boolean result = cpdfx509.addToTrustedCertificates(context);// Add the certificate in the local storage as a trusted certificate.
val certFilePath: String = FileUtils.getAssetsTempFile(context, "Certificate.pfx")
val password = "ComPDF"
if (CPDFSignature.checkPKCS12Password(certFilePath, password)) {
val x509 = CPDFSignature.getX509ByPKCS12Cert(certFilePath, password)
// Add your certificate to the trust path.
val result = x509.addToTrustedCertificates(context)
}
// Add digital signature certificate in pdf file as trusted certificate.
val document = CPDFDocument(context)
document.open(FileUtils.getAssetsTempFile(context, "Signed.pdf"))
val signature = document.getPdfSignature(0)
val signer = signature.signerArr[0]
val cpdfx509 = signer.cert
val result = cpdfx509.addToTrustedCertificates(context)