|
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; // PDF 파일 생성 HPDF.CurrentPage.TextOut(10, 10, 0, 'Encrypted document !!!'); // Print text HPDF.EndDoc; // PDF 파일 닫기 finally HPDF.Free; end; end. |