Projeto-ACBr-Oficial / FPDF-Pascal

Tradução do Projeto FPDF de PHP para Pascal, compatível com D7-D12, Lazarus, Win, Linux, Android
Other
72 stars 21 forks source link

Applying permissions to a PDF #14

Closed Olivier-de-Saint-Leger closed 9 months ago

Olivier-de-Saint-Leger commented 11 months ago

Just installed the library on Delphi Alexandria CE through GetIt (as I need a replacement for an old QuickPDF licence which cannot be installed in parallel to an existing DXE3 version). Playing with the console demo, I added the directive {$DEFINE HAS_PROTECTION} as I saw it enables some protection features. There are 2 issues: 1 -the md5 routine (called in function TFPDFExt._md5_16(AStr: AnsiString): AnsiString;) does not exist. I then added one I had found long ago (MD5 Message-Digest for Delphi 4, Implementation of Ronald L. Rivest's RFC 1321, Copyright © 1997-1999 Medienagentur Fichtner & Meyer, Written by Matthias Fichtner. So it compiles fine, but: 2 - the field Self.Padding remains empty and the routine TFPDFExt._generateencryptionkey(const UserPass: AnsiString; const OwnerPass: AnsiString; protection: Integer) does not generate anything (_UValue returns empty)

Then demo.pdf.SetProtection ( [canPrint], 'sdfqsdfqs', 'whatever') finally does not protect at all the document.

Well, would be nice if it could work ! Anyway thanks for this FPDF library which can be used for simple things (btw I had used the PHP original long time ago, and had replaced it by TCPDF. Kind regards, Olivier de SAint Leger

dopidaniel commented 11 months ago

https://github.com/Projeto-ACBr-Oficial/FPDF-Pascal#dependencies-of-third-party-units

You need SYNAPSE Library