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 - Detecting Invalid Password?
  FAQ FAQ  Forum Search   Register Register  Login Login

Detecting Invalid Password?

 Post Reply Post Reply
Author
Message Reverse Sort Order
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Topic: Detecting Invalid Password?
    Posted: 23 Jul 12 at 7:54AM
LoadFromFile should return "2" if the password is incorrect in QPL 7.26.  This used to be quite reliable in 7.xx and this logic was moved to QPL 8.xx where it now returns a 0 and LastErrorCode is set to 404 - InvalidPassword.

Does the PDF file have a User and Master password ?  It could also depend on the PDF file itself. If the file has a blank user password but has a master password then the file will still open correctly with QP.SetAdvancePassword('');  - It could be that the renderer is having a problem rendering the file.  Where does the Exception happen and what is the exception reporting ?

If you send me the PDF I will see if I can reproduce the Exception in QPL 8.xx.  There have been many bugs and enhancements added to QPL 8.xx compared to 7.26.

Andrew.

Back to Top
ExchangeViews View Drop Down
Team Player
Team Player
Avatar

Joined: 13 Mar 12
Status: Offline
Points: 38
Post Options Post Options   Thanks (0) Thanks(0)   Quote ExchangeViews Quote  Post ReplyReply Direct Link To This Post Posted: 21 Jul 12 at 8:11AM
V8.x does not use SetAdvancePassword(). You need to directly use loadfromfile('test.pdf', password);
Upgraded version return correct value for invalid password. You can try the trial version.
Back to Top
Wheeley View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 Oct 05
Location: United States
Status: Offline
Points: 146
Post Options Post Options   Thanks (0) Thanks(0)   Quote Wheeley Quote  Post ReplyReply Direct Link To This Post Posted: 20 Jul 12 at 8:39PM
Straight from the upgrade to 8 technical guide:

The LoadFrom* functions now return 1 on success and 0 on failure. In QPL v7 these functions would return 2 if an encrypted document made use of object streams or cross reference streams. This is no longer necessary as these functions have a new password parameter. If the wrong password is given, the LoadFrom* functions will return 0 and the LastErrorCode function will return error code 404.

Wheeley
Back to Top
waynefulcher View Drop Down
Senior Member
Senior Member
Avatar

Joined: 23 Jun 08
Location: United States
Status: Offline
Points: 99
Post Options Post Options   Thanks (0) Thanks(0)   Quote waynefulcher Quote  Post ReplyReply Direct Link To This Post Posted: 20 Jul 12 at 1:53PM
I have no problem upgrading but are you saying 8.x will work differently than 7.26 as far as what I described?
Can you tell me what will be different in 8.x that would allow me to have a controlled test to see if the password is invalid?
Does RenderPageToStream() return somethig different? Does LoadFromFile() return something different?
Back to Top
ExchangeViews View Drop Down
Team Player
Team Player
Avatar

Joined: 13 Mar 12
Status: Offline
Points: 38
Post Options Post Options   Thanks (0) Thanks(0)   Quote ExchangeViews Quote  Post ReplyReply Direct Link To This Post Posted: 20 Jul 12 at 8:54AM
Use QuickPDF 8.xx.
Back to Top
waynefulcher View Drop Down
Senior Member
Senior Member
Avatar

Joined: 23 Jun 08
Location: United States
Status: Offline
Points: 99
Post Options Post Options   Thanks (0) Thanks(0)   Quote waynefulcher Quote  Post ReplyReply Direct Link To This Post Posted: 18 Jul 12 at 4:01PM
I am using Delphi 7 and QuickPDF 7.26.
I have a program that allows the user to select a PDF file from disk and it gives them the option to input a password in case the PDF is secured.
 
My program then calls SetAdvancePassword(), then LoadFromFile().
Then it loops for each page calling RenderPageToStream().
I then display the rendered image so the user can view each page.
All of this code works fine if...The PDF is not secured or the PDF is secured and the user has supplied the correct password.
 
But if the PDF is secured and the user supplies an incorrect password, I can't seem to figure out how to "detect" that. The LoadFromFile() method works and returns a 1.
The RenderPageToStream() also returns a 1 and the LastRenderError is blank. So I have no way to detect it actually fails. The result is the rendered image is just a blank white image.
 
The odd thing is when I run my program from the Delphi IDE, the call to RenderPageToStream() actually throws an exception message that shows up in the Delphi IDE but the QuickPDF library must be trapping that exception because I do not get an exception in my code. So once again I cant seem to figure out how to detect an invalid password.
 
Any help would be much appriciated.
Wayne
 
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