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.
A signature timestamp proves that a signature existed at a particular time. Long-term validation (LTV) embeds certificates and revocation information in the PDF for later verification. Assess these separately from signature validity and certificate trust.
Set timestampServerUrl in the writeSignature() configuration. Follow the remaining steps in Create Digital Signatures.
import type { CPDFSignatureConfig }
from '@compdfkit_pdf_sdk/react_native';
function timestampConfig(certificatePath: string, password: string): CPDFSignatureConfig {
return { certificatePath, password,
timestampServerUrl: 'https://tsa.example.com/timestamp' };
}The example URL is a placeholder. Replace it with an accessible RFC 3161 HTTP(S) timestamp service. Network, service, or validation failures cause signing to fail; the method does not fall back to signing without a timestamp.
The verification result's timestampSource corresponds to CPDFSignatureTimestampSource: NONE means no time source, LOCAL_CLOCK means the local clock, EMBEDDED means an embedded signature timestamp, and DOCUMENT means a document timestamp. Also check timestampTrusted and embeddedTimestampValid.
import { CPDFReaderView } from '@compdfkit_pdf_sdk/react_native';
async function inspectLtv(reader: CPDFReaderView) {
if (!await reader.save()) throw new Error('Failed to save the document');
const readiness = await reader._pdfDocument.getLtvReadiness();
return readiness;
}getLtvReadiness() inspects document-level material in the saved file. success indicates whether inspection succeeded, and ltvReady indicates whether the material meets readiness conditions. hasDss, hasVri, hasCertificates, and hasRevocation describe available material. Use missingMaterials, material counts, errors, and warnings to identify missing items and diagnostics.
Readiness does not establish signature validity or certificate trust. Also call verifyDigitalSignature().
Open the saved signed PDF first. trustedCertificatePath is a local PEM trust-anchor certificate. The output directory must exist, and the output file must differ from the source.
import { CPDFReaderView } from '@compdfkit_pdf_sdk/react_native';
async function addLtv(reader: CPDFReaderView,
trustedCertificatePath: string, outputPath: string) {
if (!await reader.save()) throw new Error('Failed to save the document');
const result = await reader._pdfDocument.addSignatureLtv(outputPath, {
trustedCertificatePath,
});
if (!result.success || !result.finalPath) {
throw new Error(JSON.stringify(result.errors));
}
if (!await reader._pdfDocument.open(result.finalPath)) {
throw new Error('Failed to open the LTV file');
}
return result;
}Optional ocspUrls and crlUrls specify certificate-status and revocation-list sources. Material collection may require network access. The result includes success, ltvPath, ltaPath, finalPath, errors, and warnings. Check success and diagnostics even when the Promise resolves.
Append a document timestamp
Add appendDocumentTimestamp: true, timestampServerUrl, and timestampOutputPath to the same options object to generate an LTA copy with a document timestamp. Use different paths for the source, LTV output, and timestamp output. The method does not switch the current reader automatically. On success, open finalPath and check material and signatures again. Parameter or bridge errors may also reject the Promise.