Print Page | Close Window

Passwort Check

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=3369
Printed Date: 28 Apr 24 at 8:56PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Passwort Check
Posted By: luet
Subject: Passwort Check
Date Posted: 16 Aug 16 at 12:46PM
How can I check whether a password must be specified before opening a PDF file?
To open a protected PDF file so I need a Paswort how do I know that before opening QPdf.LoadFromFile?

Thank you for a few lines of code
luet



Replies:
Posted By: tfrost
Date Posted: 16 Aug 16 at 2:32PM
I have found it simplest and quickest to open the file and see if it fails with "invalid password" (404).  If you use DAopenfilereadonly it should be very quick because it does not have to read the whole file.  You can close it if it is successful and then re-open the file with LoadFromFile if you prefer this.


Posted By: luet
Date Posted: 16 Aug 16 at 2:47PM
thank for answer.
is there no other possibility?
There's a CheckPassword method ...
Or do I have previously also run only LoadFromFile?

Thank you for a few lines of code
luet


Posted By: Ingo
Date Posted: 16 Aug 16 at 5:38PM
Hi Luet,

the functionality offered by Debenu isn't completely straight.
LoadFromFile should be the first...
LastErrorCode should be the second (to check code 404 = password error).
GetAnalysisInfo (for detecting a mainpassword) should be the last.

Loading a pdf with QuickPDF always works, even if you don't know the main password (an empty string is enough). So having a file with an unknown main password you can load it and use GetAnalyseInfo to check for a main password.
If there's a user password even LoadFromFile (and all similar functions) fails. So there's no possibility to check if a user password is set even if GetAnalysisInfo offers these option ;-)
In this case (existing user password) you can only use LastErrorCode and check for result 404.



-------------
Cheers,
Ingo



Posted By: luet
Date Posted: 16 Aug 16 at 8:58PM
thanks for good help.

It is fun with Quick PDF to work, but I need more time to understand anything.
Working only one week so ...

It's nice that you help so much :-)
thank you very much
luet


Posted By: Ingo
Date Posted: 16 Aug 16 at 9:05PM
You should really read the developer guide - many samples and much help ;-)



-------------
Cheers,
Ingo



Posted By: luet
Date Posted: 16 Aug 16 at 9:35PM
I've already done that, but everything is a characterized also not clear.
It lacks a few other examples.
Although it is already a good start.

I also study the reference

thank you
luet



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk