HotPDF Developer Reference
Delphi and C++Builder PDF component help
|
program Encryption; uses SysUtils, Graphics, Classes, HPDFDoc;
var HPDF: THotPDF;
begin HPDF:= THotPDF.Create(nil); try HPDF.FileName := 'Encrypt.pdf'; HPDF.ActivateProtection := true; // Enable encryption HPDF.CryptKeyLength := k128; // Set encryption type to 128 bit HPDF.OwnerPassword := 'OwnerPass'; // Set owner password HPDF.UserPassword := 'UserPass'; // Set user password HPDF.ProtectOptions := [prPrint, prExtractContent]; // Allow user to extract PDF content HPDF.BeginDoc; // Create PDF file HPDF.CurrentPage.TextOut(10, 10, 0, 'Encrypted document !!!'); // Print text HPDF.EndDoc; // Close PDF file finally HPDF.Free; end; end. |