|
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'; // Установить пароль владельца HPDF.UserPassword := 'UserPass'; // Установить пароль пользователя HPDF.ProtectOptions := [prPrint, prExtractContent]; // Allow user to extract PDF content HPDF.BeginDoc; // Создать PDF-файл HPDF.CurrentPage.TextOut(10, 10, 0, 'Encrypted document !!!'); // Print text HPDF.EndDoc; // Закрыть PDF-файл finally HPDF.Free; end; end. |