Page 1 of 1

PDF password

Posted: Mon Feb 15, 2010 10:27 pm
by GrubyGreg
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

Re: PDF password

Posted: Tue Feb 16, 2010 9:48 am
by Loïc
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

Re: PDF password

Posted: Thu Mar 03, 2011 1:35 am
by rhahn
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

Re: PDF password

Posted: Fri Mar 04, 2011 2:06 am
by rhahn
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.

Re: PDF password

Posted: Tue Jan 15, 2013 6:21 pm
by rhahn
SilentMode = True