program Encryption;

uses

  SysUtils, Graphics, Classes, HPDFDoc;

 

var

  HPDF: THotPDF;

 

begin

HPDF:= THotPDF.Create(nil);

try

     HPDF.FileName := 'Encrypt.pdf';              

     HPDF.ActivateProtection := true;                                        // Habilita a criptografia

     HPDF.CryptKeyLength := k128;                                           // Define o tipo de criptografia para 128 bits

     HPDF.OwnerPassword := 'OwnerPass';                                // Define a senha de owner

     HPDF.UserPassword := 'UserPass';                                     // Define a senha de usuário

     HPDF.ProtectOptions := [prPrint, prExtractContent];             // Allow user to extract PDF content

     HPDF.BeginDoc;                                                               // Cria o arquivo PDF

     HPDF.CurrentPage.TextOut(10, 10, 0, 'Encrypted document !!!'); // Imprime o texto

     HPDF.EndDoc;                                                                  // Fecha o arquivo PDF

finally

       HPDF.Free;

end;

end.