Print Page | Close Window

SecurityInfo

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=3285
Printed Date: 18 Jan 26 at 5:42PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: SecurityInfo
Posted By: mdgodfrey
Subject: SecurityInfo
Date Posted: 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?



Replies:
Posted By: tfrost
Date 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.


Posted By: Ingo
Date 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



Posted By: mdgodfrey
Date Posted: 20 Mar 16 at 12:11AM
That's the answer I needed.

Thanks much



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