DynaPDF Manual - Page 340

Previous Page 339   Index   Next Page 341

Function Reference
Page 340 of 839
Return values:
If the function succeeds the return value is 1. If the function fails the return value is 0.
SI32 pdfEncryptPDF(
const PPDF* IPDF,
// Instance pointer
const char* FileName,
// File to encrypt
const char* OpenPwd,
// Open password (user password)
const char* OwnerPwd,
// Owner password
TKeyLen KeyLen,
// Key length for RC4 encryption
TRestrictions Restrict) // Restrictions
This function encrypts a PDF file. The input file must be unencrypted or no open password must be
set and the property SetUseExactPwd() must be set to false. The file is recompressed during import;
this reduces the file size in most cases.
By using specific import flags (see SetImportFlags()), it is also possible to remove unwanted objects
from the PDF file, such as annotations, form fields, bookmarks and so on.
If the input file contains a compressed object structure, it will be converted back to a normal PDF
The input PDF file will be replaced by the new one if no error occurred during import. If an error
occurred the file is left unchanged.
It is not possible to change the file except removing specific objects by using specific import flags.
However, the document info entries are changed to new values if they were set beforehand. See
SetDocInfo() for further information.
This function is implemented in an Ansi and Unicode compatible version. The Unicode version is
supported by Windows NT systems only. The file path is converted back to Ansi if the Unicode
version is used under Linux or UNIX.
Return values:
If the function succeeds the return value is 0. If the function fails the return value is a negative error
code. The returned error code can be used to determine whether a password is required to open the
file. Pass the return value to the macro PDF_WRONG_PWD(). If the return value of the macro is
true, use the function ReEncryptPDF() instead.

Previous topic: EditTemplate2, Ellipse

Next topic: EndContinueText (obsolete), EndLayer, EndPage, EndPattern, EndTemplate