|
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. |