Xojo Conferences
MBSOct2019CologneDE

DynaPDF Manual - Page 192

Previous Page 191   Index   Next Page 193

Function Reference
Page 192 of 770
#define rsModify
0x00000008 // Deny modification of contents
#define rsCopyObj
0x00000010 // Deny copying of contents
#define rsAddObj
0x00000020 // No commenting
/* 128/256 bit encryption only -> ignored if 40 bit encryption is used */
#define rsFillInFormFields 0x00000100 // requires rsModify + rsAddObj
#define rsExtractObj
0x00000200 // requires rsModify
#define rsAssemble
0x00000400 // requires rsModify
#define rsPrintHighRes
0x00000800 // Disable high res. printing
#define rsExlMetadata
0x00001000 // PDF 1.5 Exclude metadata streams
#define rsEmbFilesOnly
0x00002000 // PDF 1.6 AES Encryption only
The function finishes the PDF file, encrypts it, and frees all used resources if the file was not created
in memory. The buffer of a memory based PDF file can be accessed with GetBuffer() after the
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 used resources. See also CreateNewPDF(), GetBuffer(), FreePDF().
The parameter KeyLen specifies the encryption filter and key length which should be used to encrypt
the PDF file. The parameter Restrict specifies which features should be disabled in a viewer
application. Note that several restriction flags depend on the used encryption filter. Flags which are
not supported by the encryption filter will be ignored.
However, the restriction flags cannot be combined in any order; only specific flag combinations are
allowed. Valid flag combinations are described in detail on the next page.
Passwords
PDF files support two different passwords to decrypt a PDF file. A PDF viewer asks for the owner
password when the user tries to change the encryption settings. So, the owner password grands full
access to the PDF file. If no open password is set, a viewer opens the PDF file with user privilegs
without asking for a password.
If an open password is set, the PDF file cannot be opened without entering the open password. The
open password causes the file to be opened with user privilegs. So, the user cannot change the
security settings and only non-restricted features can be used.
Beginning with PDF 1.6 it is also possible to encrypt embedded files only (flag rsEmbFilesOnly). The
PDF file is left unencrypted in this case but access to the embedded files can be restriced. The open
password can be used to grand access on the embedded file to authorized persons only. A viewer
asks for the password only if it is set and if the user tries to open or extract the embedded file.
Note that this feature is supported since Adobe's Acrobat or Reader 7. Prior versions cannot open
such a PDF file also if it is unencrypted.
In no password is set the PDF file is still encrypted and the file is opened with user privilegs in a
viewer. However, the seceurity settings can be easily changed in this case if the user tests an empty
password.
 

Previous topic: CloseFile, CloseFileEx

Next topic: Password encodings, UTF-8 Passwords, Encryption flags