Visual Basic > Visual Basic Forums > Visual Basic General > open a pdf file with user password in vb 2008
Ask a questionAsk a question
 

Answeropen a pdf file with user password in vb 2008

  • Friday, November 06, 2009 2:06 PMaswinq Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hai!

    I use adobe reader component in vb.net.
    normal loading : AdobeReader.src = "C:\mydoc.pdf" is ok!

    or 
    webbrowser1.navigate("C:\mydoc.pdf")


    I have two questions..

    1. how do i know whether the given pdf file required user password?
    2. how can i send the password via my program?


    please help me.

Answers

  • Friday, November 06, 2009 3:29 PMOmie Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Kaymaf,

    no. It does require a password even to open a file. I think you can set level of authentication while applying password originally.

    When Adobe Reader component is used, using src attribute, you can also open the protected document, it shows a component's Enter Password dialog.

    I think aswinq wants a way to prevent showing password window and Pass password internally to the document.


    Thanks

    My BlogMy FacebookYOUR Place to have fun time ! Awesome RPG Action Game
  • Saturday, November 07, 2009 7:14 AMOmie Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Hello,

    I searched a bit and reached here , it says

    To programmatically enter a password and bypass the user interface prompt for password, you must replace the standard "security handler" for
    Acrobat with your own security handler. There is no way to bypass the password prompt with the standard Acrobat security handler. For an example of a custom security handler, see the "Rot13" sample plug-in.


    Drop Adobe Reader component. Its Pain.

    I tried to achieve the same using Foxit Reader Active Ex and am glad to tell you that its easier than you thought of.

    Get Standard Version from Here, Its free.
    http://www.foxitsoftware.com/pdf/sdk/activex/

    Use Try Std Version Link.

    Install it.

    Start Visual Studio, right click on toolbox and select Choose Items. Go to COM Components Tab and scroll down the list.
    Find Foxit Reader SDK Std Control and select Ok.

    Click on Form to drop Foxit reader control. Now in Button Click or some event when you want to open pdf file, use this line of code, provided Foxit Control has default name.

    AxFoxitReaderSDK1.OpenFile("AbsolutePath.pdf", "Password")

    Note that it takes absolute path only. Eg. D:\file.pdf, relative path like ./../file.pdf may not work.

    Tested Ok on Windows 7 + Visual Studio 2008






    Thanks

    My BlogMy FacebookYOUR Place to have fun time ! Awesome RPG Action Game

All Replies

  • Friday, November 06, 2009 3:14 PMkaymaf Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Adobe pdf does not require password to view protected pdf. Password prevents editing the document. So to detect if the pdf document is protected, try to edit it or look at the title bar, there should be a secured message at the end of file name on title bar.

    For example, if you have filename : mydoc.pdf, on the title bar, you should see mydoc.pdf (SECURED) - Adobe Reader if the document is password protected.  so use process from disgnostics class to get the title text from the adobe reader, then search for (SECURED).

    kaymaf
    If that what you want, take it. If not, ignored it and no complain
  • Friday, November 06, 2009 3:29 PMOmie Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Kaymaf,

    no. It does require a password even to open a file. I think you can set level of authentication while applying password originally.

    When Adobe Reader component is used, using src attribute, you can also open the protected document, it shows a component's Enter Password dialog.

    I think aswinq wants a way to prevent showing password window and Pass password internally to the document.


    Thanks

    My BlogMy FacebookYOUR Place to have fun time ! Awesome RPG Action Game
  • Friday, November 06, 2009 5:59 PMkaymaf Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Kaymaf,

    no. It does require a password even to open a file. I think you can set level of authentication while applying password originally.

    When Adobe Reader component is used, using src attribute, you can also open the protected document, it shows a component's Enter Password dialog.

    I think aswinq wants a way to prevent showing password window and Pass password internally to the document.


    Thanks

    My BlogMy FacebookYOUR Place to have fun time ! Awesome RPG Action Game

     Well, i didnt know that adobe reader control (component) from .net requires password for protected document. Thanks for the information omie.

    kaymaf
    If that what you want, take it. If not, ignored it and no complain
  • Saturday, November 07, 2009 5:30 AMaswinq Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Kaymaf,

    no. It does require a password even to open a file. I think you can set level of authentication while applying password originally.

    When Adobe Reader component is used, using src attribute, you can also open the protected document, it shows a component's Enter Password dialog.

    I think aswinq wants a way to prevent showing password window and Pass password internally to the document.


    Thanks

    My BlogMy FacebookYOUR Place to have fun time ! Awesome RPG Action Game

    Thanks to omie and kaymaf !!!

    Absolutely "omie" correct, i wil get the password by my own app... I need to pass the password internally to the document....

    To open the pdf it wil ask the password, so i cant read the title bar....

    Any other suggesstion guys!
  • Saturday, November 07, 2009 7:14 AMOmie Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Hello,

    I searched a bit and reached here , it says

    To programmatically enter a password and bypass the user interface prompt for password, you must replace the standard "security handler" for
    Acrobat with your own security handler. There is no way to bypass the password prompt with the standard Acrobat security handler. For an example of a custom security handler, see the "Rot13" sample plug-in.


    Drop Adobe Reader component. Its Pain.

    I tried to achieve the same using Foxit Reader Active Ex and am glad to tell you that its easier than you thought of.

    Get Standard Version from Here, Its free.
    http://www.foxitsoftware.com/pdf/sdk/activex/

    Use Try Std Version Link.

    Install it.

    Start Visual Studio, right click on toolbox and select Choose Items. Go to COM Components Tab and scroll down the list.
    Find Foxit Reader SDK Std Control and select Ok.

    Click on Form to drop Foxit reader control. Now in Button Click or some event when you want to open pdf file, use this line of code, provided Foxit Control has default name.

    AxFoxitReaderSDK1.OpenFile("AbsolutePath.pdf", "Password")

    Note that it takes absolute path only. Eg. D:\file.pdf, relative path like ./../file.pdf may not work.

    Tested Ok on Windows 7 + Visual Studio 2008






    Thanks

    My BlogMy FacebookYOUR Place to have fun time ! Awesome RPG Action Game
  • Saturday, November 07, 2009 2:42 PMaswinq Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hello,

    I searched a bit and reached here , it says

    To programmatically enter a password and bypass the user interface prompt for password, you must replace the standard "security handler" for
    Acrobat with your own security handler. There is no way to bypass the password prompt with the standard Acrobat security handler. For an example of a custom security handler, see the "Rot13" sample plug-in.


    Drop Adobe Reader component. Its Pain.

    I tried to achieve the same using Foxit Reader Active Ex and am glad to tell you that its easier than you thought of.

    Get Standard Version from Here, Its free.
    http://www.foxitsoftware.com/pdf/sdk/activex/

    Use Try Std Version Link.

    Install it.

    Start Visual Studio, right click on toolbox and select Choose Items. Go to COM Components Tab and scroll down the list.
    Find Foxit Reader SDK Std Control and select Ok.

    Click on Form to drop Foxit reader control. Now in Button Click or some event when you want to open pdf file, use this line of code, provided Foxit Control has default name.

    AxFoxitReaderSDK1.OpenFile("AbsolutePath.pdf", "Password")

    Note that it takes absolute path only. Eg. D:\file.pdf, relative path like ./../file.pdf may not work.

    Tested Ok on Windows 7 + Visual Studio 2008






    Thanks

    My BlogMy FacebookYOUR Place to have fun time ! Awesome RPG Action Game

    Thanks a lot for your effort dude!

    i wil try this component....