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!
![]() |
Password Detection |
Post Reply
|
| Author | |
Si
Beginner
Joined: 13 Jan 11 Status: Offline Points: 5 |
Post Options
Thanks(0)
Quote Reply
Topic: Password DetectionPosted: 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.
|
|
![]() |
|
Ingo
Moderator Group
Joined: 29 Oct 05 Status: Offline Points: 3530 |
Post Options
Thanks(0)
Quote Reply
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 |
|
![]() |
|
Si
Beginner
Joined: 13 Jan 11 Status: Offline Points: 5 |
Post Options
Thanks(0)
Quote Reply
Posted: 13 Jan 11 at 12:13PM |
|
Ah, missed that one. Will give it a try, thanks.
|
|
![]() |
|
Si
Beginner
Joined: 13 Jan 11 Status: Offline Points: 5 |
Post Options
Thanks(0)
Quote Reply
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.
|
|
![]() |
|
Ingo
Moderator Group
Joined: 29 Oct 05 Status: Offline Points: 3530 |
Post Options
Thanks(0)
Quote Reply
Posted: 13 Jan 11 at 4:44PM |
|
Sorry.
Read the online reference and try "SecurityInfo"... It will work for you... sure ;-) |
|
![]() |
|
Si
Beginner
Joined: 13 Jan 11 Status: Offline Points: 5 |
Post Options
Thanks(0)
Quote Reply
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.
|
|
![]() |
|
Ingo
Moderator Group
Joined: 29 Oct 05 Status: Offline Points: 3530 |
Post Options
Thanks(0)
Quote Reply
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 |
|
![]() |
|
Si
Beginner
Joined: 13 Jan 11 Status: Offline Points: 5 |
Post Options
Thanks(0)
Quote Reply
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.
|
|
![]() |
|
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