EncryptFileEx

Security and signatures

Description

Writes an encrypted copy of a PDF file using the supplied owner and user passwords, encryption strength and typed permission set, returning 1 when the output file is written and 0 when encryption fails.

Syntax

Delphi

Function TPDFlib.EncryptFileEx(Const InputFileName, OutputFileName, Owner, User: WideString; Strength: Integer; Permissions: TPDFlibUserPermissions): Integer;

Parameters

InputFileNameSource PDF path
OutputFileNameDestination PDF path
OwnerOwner password
UserUser password
Strength0 = RC4-40, 1 = RC4-128, 2 = AES-128, 3 = AES-256, 4 = AES-256 Acrobat X, 5 = AES-256-GCM for PDF 2.0 with ISO TS 32003
PermissionsTyped permission set

Return values

0Encryption failed
1Encryption succeeded

Remarks

Call SetPDFMACEnabled first to add a standalone PDF MAC integrity token when strength 4 or 5 is selected