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!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - Error 404 when trying to load encrypted PDF
  FAQ FAQ  Forum Search   Register Register  Login Login

Error 404 when trying to load encrypted PDF

 Post Reply Post Reply
Author
Message
user285 View Drop Down
Beginner
Beginner


Joined: 15 Mar 19
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote user285 Quote  Post ReplyReply Direct Link To This Post Topic: Error 404 when trying to load encrypted PDF
    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:
  • all encrypted files work.

QPDF:
  • test-qpdf-R5.pdf = PDF 1.7 Adobe Extension Level 3 (Acrobat 9) = OK.
  • test-qpdf-R6.pdf = PDF 1.7 Adobe Extension Level 8 (Acrobat X) 256-bit AES = OK.

PDFBox:
  • test-pdfbox-128.pdf = PDF 1.7 128-bit AES = Not OK.
  • test-pdfbox-256.pdf = PDF 1.7 256-bit AES = Not OK.

Test files available at: https://we.tl/t-G0JnQTa4Th

Any ideas?

Thanks!
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (1) Thanks(1)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 15 Mar 19 at 1:45PM
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

Back to Top
user285 View Drop Down
Beginner
Beginner


Joined: 15 Mar 19
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote user285 Quote  Post ReplyReply Direct Link To This Post Posted: 15 Mar 19 at 2:03PM
Originally posted by Ingo Ingo wrote:

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

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.

Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (1) Thanks(1)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 15 Mar 19 at 7:45PM
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

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store