Print Page | Close Window

Password Detection

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=1708
Printed Date: 05 May 25 at 8:33AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Password Detection
Posted By: Si
Subject: Password Detection
Date Posted: 13 Jan 11 at 11:36AM
Hi there
 
I've been using Quick PDF for a few months now but am new to the forums :)
 
I am trying to determine whether user selected files are password protected. Some PDFs are encrypted but do not have passwords, requiring a blank password to be set with SetAdvancePassword(""), but some files will need the user to enter the password so I need to be able to determine which is needed.
 
I thought the return value from LoadFromFile might do the trick but it always returns a 1, regardless if the file is encrypted with or without a password. So I'm not sure if this is a bug or I'm doing something wrong, or if this is even the correct way to check for password protected files?
 
Any help would be appreciated, thanks.
 
 



Replies:
Posted By: Ingo
Date Posted: 13 Jan 11 at 11:50AM
Hi Si!

//in Delphi:
// EncryptionStatus 1 and 2 means encrypted
If EncryptionStatus > 0 Then
   Decrypt;

With "GetAnalysisInfo" you can check if there's
a user- or main password (and other things).
Have a look here:
http://www.quickpdflibrary.com/help/quickpdf/GetAnalysisInfo.php

Cheers and welcome here,
Ingo




Posted By: Si
Date Posted: 13 Jan 11 at 12:13PM
Ah, missed that one. Will give it a try, thanks.


Posted By: Si
Date Posted: 13 Jan 11 at 3:36PM
Just tried that and AnalyseFile requires the password in order to analyse the file. I need to find out if a password is needed so I can prompt the user for it, which I can then use to open the file.


Posted By: Ingo
Date Posted: 13 Jan 11 at 4:44PM
Sorry.
Read the online reference and try
"SecurityInfo"...
It will work for you... sure ;-)



Posted By: Si
Date Posted: 13 Jan 11 at 5:05PM
I already tried using that, but it returns 0 for all items. But as you say it should work - I'll double check my code to make sure.


Posted By: Ingo
Date Posted: 14 Jan 11 at 11:13AM
Hi!

SecurityInfo is one of the oldest function.
It WILL work if your code is okay.
Perhaps you should post it here?

Cheers, Ingo



Posted By: Si
Date Posted: 14 Jan 11 at 11:37AM
Ah my bad. My wrapper for that function was wrong ;)  All sorted now, thanks for your help Ingo.



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