DynaPDF Manual - Page 233
Previous Page 232 Index Next Page 234

Function Reference
Page 233 of 874
To determine whether the PDF was already deleted or of it is still in memory call the function
HaveOpenDoc(). The function returns true if the PDF file is in memory. If the function returns false,
the last error was fatal and the PDF file has already been deleted.
The buffer of a memory based PDF file can be returned by GetBuffer() after this function was called.
Note that GetBuffer() does not free the used resources because it returns a pointer to the original
buffer. After the buffer was processed by your application call FreePDF() to free the uses resources.
See also CreateSigFieldAP(), CreateNewPDF(), GetBuffer(), FreePDF().
Remarks:
Further information about digital signatures can be found under Digital Signatures. The appearance
of a signature field can be user defined. See CreateSigFieldAP() for further information.
Return values:
If the function succeeds the return value is 1. If the function fails the return value is 0.
CloseAndSignFileExt
Syntax:
LBOOL pdfCloseAndSignFileExt(
const PPDF* IPDF,
// Instance pointer
struct TPDFSigParms* SigParms) // Important parameters
typedef enum
{
htDetached, // Byte ranges of the finish PDF file will be returned
htSHA1
// The SHA1 hash to be signed will be returned
}THashType;
struct TPDFSigParms
{
UI32
StructSize;
// Must be set to sizeof(TSignParms)
UI32
PKCS7ObjLen;
// Max length of the signed PKCS#7 object
THashType
HashType;
// See description
const BYTE*
Range1;
// Out -> Hash or byte range
UI32
Range1Len;
// Out -> Length of the buffer
const BYTE*
Range2;
// Out -> Set only if HashType = htDetached
UI32
Range2Len;
// Out -> Length of the buffer
const char*
ContactInfoA; // Optional, e.g. an email address
const UI16*
ContactInfoW; // Optional, e.g. an email address
const char*
LocationA;
// Optional location of the signer
const UI16*
LocationW;
// Optional location of the signer
const char*
ReasonA;
// Optional reason why the file was signed
const UI16*
ReasonW;
// Optional reason why the file was signed
const char*
SignerA;
// Optional, see comment
const UI16*
SignerW;
// Optional, see comment
LBOOL
Encrypt;
// If true, the file will be encrypted
// These members will be ignored if Encrypt is set to false
const char* OpenPwd;
// Optional open password
const char* OwnerPwd;
// Optional owner password
TKeyLen
KeyLen;
// Key length to encrypt the file
TRestrictions Restrict;
// What should be restricted?
// Windows only
const void* Certificate;
// Handle of a certificate context (PCCERT_CONTEXT), returned by
// CertFindCertificateInStore(), for example. If this paramteter is
// set, PKCS7ObjLen will be ignored and the file will be signed with
// this certificate. See description below.
Previous topic: Importing signed PDF files, Possible function errors
Next topic: Signing with a PCCERT_CONTEXT handle