program Encryption;

uses

  SysUtils, Graphics, Classes, HPDFDoc;

 

var

  HPDF: THotPDF;

 

begin

HPDF:= THotPDF.Create(nil);

try

     HPDF.FileName := 'Encrypt.pdf';              

     HPDF.ActivateProtection := true; // אפשר הצפנה

     HPDF.CryptKeyLength := k128; // הגדר סוג הצפנה ל-128 סיביות

     HPDF.OwnerPassword := 'OwnerPass'; // הגדר סיסמת בעלים

     HPDF.UserPassword := 'UserPass'; // הגדר סיסמת משתמש

HPDF.ProtectOptions := [prPrint, prExtractContent]; // אפשר למשתמש להפיק תוכן PDF

     HPDF.BeginDoc; // צור קובץ PDF

     HPDF.CurrentPage.TextOut(10, 10, 0, 'Encrypted document !!!'); // הדפס טקסט

     HPDF.EndDoc; // סגור קובץ PDF

finally

       HPDF.Free;

end;

end.