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!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - Password Detection
  FAQ FAQ  Forum Search   Register Register  Login Login

Password Detection

 Post Reply Post Reply
Author
Message
Si View Drop Down
Beginner
Beginner


Joined: 13 Jan 11
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote Si Quote  Post ReplyReply Direct Link To This Post Topic: Password Detection
    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.
 
 
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3529
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post 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


Back to Top
Si View Drop Down
Beginner
Beginner


Joined: 13 Jan 11
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote Si Quote  Post ReplyReply Direct Link To This Post Posted: 13 Jan 11 at 12:13PM
Ah, missed that one. Will give it a try, thanks.
Back to Top
Si View Drop Down
Beginner
Beginner


Joined: 13 Jan 11
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote Si Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3529
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 13 Jan 11 at 4:44PM
Sorry.
Read the online reference and try
"SecurityInfo"...
It will work for you... sure ;-)

Back to Top
Si View Drop Down
Beginner
Beginner


Joined: 13 Jan 11
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote Si Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3529
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
Si View Drop Down
Beginner
Beginner


Joined: 13 Jan 11
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote Si Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store