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!
Passwort Check |
Post Reply |
Author | |
luet
Team Player Joined: 09 Aug 16 Location: Germany Status: Offline Points: 41 |
Post Options
Thanks(0)
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
|
|
tfrost
Senior Member Joined: 06 Sep 10 Location: UK Status: Offline Points: 437 |
Post Options
Thanks(0)
|
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.
|
|
luet
Team Player Joined: 09 Aug 16 Location: Germany Status: Offline Points: 41 |
Post Options
Thanks(0)
|
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 |
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
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 |
|
luet
Team Player Joined: 09 Aug 16 Location: Germany Status: Offline Points: 41 |
Post Options
Thanks(0)
|
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 |
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
You should really read the developer guide - many samples and much help ;-)
|
|
Cheers,
Ingo |
|
luet
Team Player Joined: 09 Aug 16 Location: Germany Status: Offline Points: 41 |
Post Options
Thanks(0)
|
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
|
|
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