PDFium Delphi Component Docs

Password property

Component: TPdf  ·  Unit: PDFium
Decryption password assigned before Active := True

Syntax

property Password: string;

Description

Decryption password assigned before Active := True; like FileName it can only be changed while the component is inactive

The password is kept until it is reassigned and is scrubbed from memory when the component is destroyed. A wrong password makes LoadDocument raise EPdfError, while Active := True leaves the component inactive and reports the failure in LastLoadReport

The password is passed to PDFium as UTF-8, which PDFium converts to Latin-1 for older security handlers when needed; Free Pascal builds convert from the string's own code page, so non-ASCII passwords work with or without the Lazarus UTF-8 string mode

Wraps the corresponding PDFium API and exposes it as a TPdf instance member so consumers do not have to manage FPDF_DOCUMENT handles directly

Remarks

Example

Pdf1.Active := False;
Pdf1.Password := 'secret';
Pdf1.FileName := 'encrypted.pdf';
Pdf1.Active := True;

See Also

Active, Permissions, UserPermissions