THotPDF.DecryptLoadedDocument

THotPDF

Top

Decrypts a loaded RC4 Standard encrypted PDF object graph in memory.

 

Delphi syntax:

procedure DecryptLoadedDocument(const Password: AnsiString);

 

Description

DecryptLoadedDocument validates the supplied user or owner password for a PDF already loaded with LoadFromFile or LoadFromStream. For RC4-40 and RC4-128 Standard security handler files, it decrypts loaded strings and streams, clears the loaded encryption state, and allows SaveLoadedDocument to write an unencrypted copy.

The password overloads of LoadFromFile and LoadFromStream call this method automatically. Unsupported encryption revisions raise an exception before output is written.

Code Example

PDF.LoadFromFile('Protected.pdf', 'user-password');
PDF.SaveLoadedDocument('Unencrypted.pdf');