DynaPDF Manual - Page 223

Previous Page 222   Index   Next Page 224

Function Reference
Page 223 of 860
Remarks:
Text objects are handled separately in PDF for use as clipping path. See SetTextDrawMode() for
further information.
Return values:
If the function succeeds the return value is 1. If the function fails the return value is 0.
CloseAndSignFile
Syntax:
SI32 pdfCloseAndSignFile(
const PPDF* IPDF,
// Instance pointer
const char* CertFile, // File path to a PKCS#12 certificate file
const char* Password, // Password to decrypt the cert's private key
const char* Reason,
// Optional reason string
const char* Location) // Optional signers location string
This function finishes the PDF file, digitally signs it, and frees all used resources if the file was not
created in memory. The parameter CertFile must be a valid path to a PKCS#12 certificate file.
DynaPDF signs PDF files on Windows with the Windows Crypt API. This signature handler
supports certificates with up to 4096 bits key length. Note that this function does not add a
timestamp to the signature. If a timestamp should be added then call CloseAndSignFileExt() with a
certificate handle instead.
On non-Windows systems the function uses the AiCrpyto library to sign PDF files. This signature
handler supports certificates with up to 1024 bits key lengths only. However, if certificates with a
stronger encryption should be used it is possible to sign the file with an external signature handler
(see CloseAndSignFileExt() for further information).
The parameter Password holds the password to decrypt the private key. The parameters Reason and
Location are both optional. These strings are printed into the signature field if set.
Digital signatures are stored in a signature field which is a special type of Interactive Form field. If
no signature field exist when the function is called then DynaPDF creates an invisible signature
field. Hidden signature fields appear in the signatures tab of Adobe's Acrobat.
If one or more signature fields exist when the function is called then the first signature field is used
for signing. Signature fields can be created with the function CreateSigField() but it is also possible
to import empty signature fields from an external PDF file.
Importing signed PDF files
Signed PDF files can only be changed, without invalidating existing signatures, when changes are
stored with an incremental update. An incremental update is a special way to modify a PDF file;
changes are appended to the end of the file, leaving its original contents intact. This technique is
required since altering any existing bytes in the file invalidates existing signatures.
 

Previous topic: ClipPath

Next topic: Possible function errors, CloseAndSignFileEx