Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!
Error 404 when trying to load encrypted PDF |
Post Reply |
Author | |
user285
Beginner Joined: 15 Mar 19 Status: Offline Points: 3 |
Post Options
Thanks(0)
Posted: 15 Mar 19 at 12:32PM |
Hi,
I'm experiencing difficulties when trying to open an encrypted PDF. Opening in Adobe Reader or another PDF viewer is no problem. LoadFromString or LoadFromFile gives the same result. LastErrorCode is 404 - Invalid password. It seems I can open encrypted PDF files, just not the ones encrypted with PDFBox. QuickPDF:
QPDF:
PDFBox:
Test files available at: https://we.tl/t-G0JnQTa4Th Any ideas? Thanks!
|
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(1)
|
Hi User285, the PDFbox-files are buggy made. The 100 mb of a main pdf-reader installation can handle this problem but not the few mb of a slim line library (with many functionality) like QuickPDF. If you're looking into the PDFbox-files with Notepad you#ll find the pdf-version on the first line. There's "%PDF-1.4" in both files. Later in the sources there is a 1.7 but that's not relevant. So you have two files from PDFbox: One is made as AES/128 bit and the pdf-specs says that pdf-version have to be at least 1.6... The second one is made as AES/256 bit and the pdf-specs says that at least 1.7 is necessary. In both files at the beginning there's a 1.4 ... and that's not okay for QuickPDF. Here's a short sample in Delphi which always work with any correct pdf-documents: // . . . QP := TDebenuPDFLibrary1611.Create; try QP.LoadFromFile(Edit1.Text, ''); If ( QP.EncryptionStatus > 0 ) Then QP.Decrypt; // . . . Cheers and welcome here, Ingo |
|
Cheers,
Ingo |
|
user285
Beginner Joined: 15 Mar 19 Status: Offline Points: 3 |
Post Options
Thanks(0)
|
Thank you for your reply. I forgot to mention I use the .NET version (dll) of QuickPDF. The result from "LoadFromFile" or "LoadFromString" is always 0, so .Decrypt function doesn't do anything. result = QP.LoadFromFile(file, "") If QP.EncryptionStatus > 0 Then QP.Decrypt() result = 0. So EncryptionStatus can't be checked = 0. |
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(1)
|
Read in the relevant pdf-content - without QuickPDF - in a stream or string.
Search for AES and 256 or 128... Check the first characters (which version?)... Change them if necessary... And then LoadFromStream or LoadFromString... It's not as easy as i've written it but it's not too complicated ;-) Please keep in mind: The library is okay - the pdf-document is mal formed ;-) |
|
Cheers,
Ingo |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store