Products | Support | Email a link to this topic. | Send comments on this topic. | Back to Introduction | Help Version 19.0.6.22
|
Some documents formats such as PDF, support optional encryption and require being decrypted with a password before they can be used.
When using the DocumentFactory to load such documents, a Document object is created and returned as usual. However it will be encrypted and unusable till the correct password is applied to decrypt it. Unusable means only the information properties of the document are available (such as its DocumentId, DocumentType and MimeType), but the Pages collection will be empty and cannot interact with the document by getting any more information from it.
Two ways to pass the password phrase used to decrypt a document:
If the password is wrong, an exception will be thrown and the document will be deleted.
Retrying with another password requires the application to call DocumentFactory.LoadFromUri again and repeating the whole process which is non-optimal solution.
Document.IsEncrypted is set to true (it is encrypted).Document.IsDecrypted is set to false (it has not been decrypted).
The application can check for this value and then prompt the user for the password phrase, it can then call Document.Decrypt with the password as many times as needed while checking the Document.IsDecrypted property. When this property becomes true, it means the correct password was applied and the document is unlocked and ready to use.For an example, refer to Document.IsEncrypted
Documents Library Features
Loading Using LEADTOOLS Documents Library
Uploading Using the Documents Library
Documents Library Coordinate System
Parsing Text with the Documents Library
Barcode processing with the Documents Library
Using LEADTOOLS Document Viewer
Using LEADTOOLS Document Converters