PDF password

Discussions about document viewing.
Post Reply
GrubyGreg
Posts: 8
Joined: Sun Feb 15, 2009 6:48 pm

PDF password

Post by GrubyGreg » Mon Feb 15, 2010 10:27 pm

I have some PDF files which are password protected. Can you supply the password programmatically? I would like to create a procedure which would check the Windows user and if it is me then the procedure would supply the password (so that gdViewer does not ask me for the password).
Greg

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: PDF password

Post by Loïc » Tue Feb 16, 2010 9:48 am

Hi Greg,


Turn the PdfShowDialogForPassword property to False. Then, catch the PdfPasswordRequest to provide the PDF passwortd using your own way.

IE:

Code: Select all

Private Sub GdViewer1_PdfPasswordRequest(Password As String)
   Password = MyPasswordQuery()
End Sub
With best regards,

Loïc

rhahn
Posts: 10
Joined: Fri Feb 18, 2011 1:27 am
Location: Edmonton Alberta Canada
Contact:

Re: PDF password

Post by rhahn » Thu Mar 03, 2011 1:35 am

Sorry to dig up an old post.
Is there a way to Cancel from the event? The box I show to the user lets them cancel the operation but then an invalid PW error is shown. What I would like to do is Catch the Cancel from my dialog and err.raise 32755. The rest of my app does a lot of work with windows Common dialog and I've got it wired up to fall through and pretend like nothing happed.
I"ve tried raising the err inside the event but VB will not let it fall down the stack and let my FileOpen() handle it. It just shows a runtime err0r

The only reason I don't use the built in GD password dialog is so that I can catch the PW and reuse it during saving and to send it to a thumbnail ocx i use so the user doesn't need to enter it twice.


Thanks
Ron

rhahn
Posts: 10
Joined: Fri Feb 18, 2011 1:27 am
Location: Edmonton Alberta Canada
Contact:

Re: PDF password

Post by rhahn » Fri Mar 04, 2011 2:06 am

I was able to get close to what I want using the status id's 201 202 to tell the difference between a blank pw and a wrong pw. I set up my form to send a blank pw if cancel was pressed and if the user entered a blank pw i returned a vbcrlf as a placeholder so it would come back as bad rather than canceled. I get the GdPicturePro5 msgbox "Invalid password." which is annoying if cancel is pressed.

A very nice improvement would be to have all of the management pushed to the application if PDFShowDialogForPassword = false . Also, a function to test whether or not a PDF is pw protected and with what method would be nice.

rhahn
Posts: 10
Joined: Fri Feb 18, 2011 1:27 am
Location: Edmonton Alberta Canada
Contact:

Re: PDF password

Post by rhahn » Tue Jan 15, 2013 6:21 pm

SilentMode = True

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest