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!
![]() |
SecurityInfo |
Post Reply
|
| Author | |
mdgodfrey
Team Player
Joined: 09 Jul 13 Location: Utah Status: Offline Points: 23 |
Post Options
Thanks(0)
Quote Reply
Topic: SecurityInfoPosted: 19 Mar 16 at 12:30AM |
|
I am trying to discover if a PDF has a password or not before attempting to decrypt it.
I have tried using SecurityInfo(1) and SecurityInfo(2) which checks for Master and User respectively. At least according to the documentation I have. They both just seem to just want to return 2 which is 'No'. I know the file has a password because I can decrypt it using the password. So I am not sure what I am missing. Any help, please?
|
|
![]() |
|
tfrost
Senior Member
Joined: 06 Sep 10 Location: UK Status: Offline Points: 437 |
Post Options
Thanks(0)
Quote Reply
Posted: 19 Mar 16 at 9:17AM |
|
How did you open in QPDF it if it had a password? You can simply call DAOpenFileReadOnly with an empty password. If the file has a password you should get a zero result and the last error code should be 404. But it depends what type of functionality the password you are checking for would be protecting.
|
|
![]() |
|
Ingo
Moderator Group
Joined: 29 Oct 05 Status: Offline Points: 3530 |
Post Options
Thanks(0)
Quote Reply
Posted: 19 Mar 16 at 3:31PM |
|
Up to the 7.xx-versions of QuickPDF you could use SecurityInfo after LoadFromFile to check for user- and masterpassword.
Debenu decided then to be completely legal to the pdf-specs. This means that a user-password should prevent for looking into a pdf-document. So the LoadFromFile won't work proper if the pdf-document has a user-password. The main-password isn't a problem - SecurityInfo will check this in a proper way. If you want to load a pdf-document with a user-password, after LoadFromFile it's always necessary now to use LastErrorCode. The last error code 404 shows you that there's a user password. I've comunicated about this issue with Debenu in the past. |
|
|
Cheers,
Ingo |
|
![]() |
|
mdgodfrey
Team Player
Joined: 09 Jul 13 Location: Utah Status: Offline Points: 23 |
Post Options
Thanks(0)
Quote Reply
Posted: 20 Mar 16 at 12:11AM |
|
That's the answer I needed.
Thanks much
|
|
![]() |
|
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