Enabling LTV To Signed File
This guide shows how to LTV enable the signatures in a signed PDF file, by adding a second revision to the document containing the validation data.
Before you begin
You should get your API key from your UniCloud account.
If this is your first time using UniPDF SDK, follow this guide to set up a local development environment.
Clone the project repository
git clone https://github.com/unidoc/unipdf-examples.git
Then navigate to the
signatures folder in the
Configure environment variables
Configure your license key using the following command: Replace the
UNIDOC_LICENSE_API_KEY with your API credentials from your UniCloud account.
How it works
In the example code, the
import section is used to import the necessary UniPDF packages and other Go libraries.
init function initializes the program by setting the license key which are loaded in your system environment.
main function defined in lines
33-100, does the LTV enabling of the signature. In lines
43-63, the certificate chain is loaded. Then in line
78, a new
PdfAppender is created using
appender, err := model.NewPdfAppender(reader). The certificate chain is LTV enabled using
ltv.EnableAll(certChain) in line
89. Then the document is written to file using
appender.WriteToFile(outputPath) in line
Run the code
Use the following commands to run the code:
go run pdf_ltv_enable_signed_file.go <INPUT_PDF_PATH> <OUTPUT_PDF_PATH> [<EXTRA_CERTS.pem>]