Print Page | Close Window

Convert PDF with password to Image

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=2239
Printed Date: 13 Aug 25 at 5:27PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Convert PDF with password to Image
Posted By: waynefulcher
Subject: Convert PDF with password to Image
Date Posted: 19 Apr 12 at 3:23PM
I have read many posts here and cant seem to find anything quit like the problem I have.
I have a situation where I have a PDF file that appears to have a password (which I do not know).
I am able to open the PDF with say Adobe Reader and view it with no problems and I can print it with no problems. It never ask me for a password either. What I am trying to do in my Delphi 7 app is simply open the PDF with QuickPDF and render a page to an image file.
 
Of course I am getting an exception when trying to call LoadFromFile() ; I am on version 7.26. There is no specific message in the exception.
 
So to ask simply, is there a way to open a secure pdf if you dont know the password and render the page to an image, not to modify the pdf?
 
Thanks
Wayne
 



Replies:
Posted By: AndrewC
Date Posted: 26 Apr 12 at 1:12PM

In 7.xx you need to call QP.SetAdvancePassword(""); before calling QP.LoadFromFile()

The "" is an empty string.

It is safe to use this before an LoadFromFile call.

Andrew.




Posted By: waynefulcher
Date Posted: 26 Apr 12 at 2:39PM
That did it. THANKS.
 
Just for future reference. If a PDF has a password like that and I don't know what it is so I load it using SetAdvancePassword('') then what should I expect not to work?
Would it just be the SaveToFile() method(s) that dont work?
 


Posted By: AndrewC
Date Posted: 02 May 12 at 3:42PM
Wayne,

It is safe to always call  QP.SetAdvancePassword("")  before calling QP.LoadFromFile(), even for PDF files without a password.  You should check the return value from LoadFromFile just to be sure.  If the password is not correct then it will return 2 and the file will not be loaded and the SelectedDocument will not be updated.  Remember that QPL always maintains at least one open document in memory at all times.  When QPL is initialised then that document is a single blank page.

Andrew.



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