Display a PDF from Visual Basic 6.0

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lorisig
    New Member
    • Apr 2007
    • 3

    Display a PDF from Visual Basic 6.0

    Was wondering if anyone can help with a rather simple task. I am trying to display a PDF file when the user clicks a command button from a simple VB 6.0 form. I have AcroRd32.dll version 7, but all the documentation I find is for version 4.0, which does not work. Was wondering if anyone knows how to use this version that comes with Acrobat 7.0, or if there is an easier way. I already spent 2 days "googling" this. I also tried FreeVBCode.com. The code they provided would not compile, so obviously I'm using the wrong DLL for their code. Very desperate to get this done, so thanks for any help.
  • SammyB
    Recognized Expert Contributor
    • Mar 2007
    • 807

    #2
    Originally posted by lorisig
    Was wondering if anyone can help with a rather simple task. I am trying to display a PDF file when the user clicks a command button from a simple VB 6.0 form. I have AcroRd32.dll version 7, but all the documentation I find is for version 4.0, which does not work. Was wondering if anyone knows how to use this version that comes with Acrobat 7.0, or if there is an easier way. I already spent 2 days "googling" this. I also tried FreeVBCode.com. The code they provided would not compile, so obviously I'm using the wrong DLL for their code. Very desperate to get this done, so thanks for any help.
    Assuming that you have Adobe Reader, then you have pdf.ocx which is what you want to use. In VB6, right-click on the toolbox and select components. Browse to pdf.ocx (it was in Program Files\Adobe\Acr obat\Reader\Act iveX on my machine). That adds Acrobat Control for ActiveX, click OK. Add the control to your form and you're good to go. Use the LoadFile method to ,duh, load a file. It has problems: is not a full ActiveX control, but hopefully it will do what you want. --Sam

    Comment

    • lorisig
      New Member
      • Apr 2007
      • 3

      #3
      Sam,

      Thank you so much! :) I knew it had to be easy, just couldn't find the right tool. I was trying to use a .DLL, because of the available documentation. My ocx is called AcroPDF.ocx and is in a different location than yours, but it works!!! Thanks again for this simple solution!

      Comment

      • lorisig
        New Member
        • Apr 2007
        • 3

        #4
        Originally posted by SammyB
        Assuming that you have Adobe Reader, then you have pdf.ocx which is what you want to use. In VB6, right-click on the toolbox and select components. Browse to pdf.ocx (it was in Program Files\Adobe\Acr obat\Reader\Act iveX on my machine). That adds Acrobat Control for ActiveX, click OK. Add the control to your form and you're good to go. Use the LoadFile method to ,duh, load a file. It has problems: is not a full ActiveX control, but hopefully it will do what you want. --Sam

        The AcroPDF does have problems. Once you end the VB application, the PDF closes but AcroRD32.exe is still running and occupying memory. After about 4 or 5 executions, you run out of memory. I have to run the task manager to end the AcroRd32.exe process. I read in other forums about this problem, but no solutions were posted. Can't have users running their task manager. The process should end when the VB app is closed. Can anyone help?

        Comment

        • iliekater
          New Member
          • Jun 2007
          • 1

          #5
          Is it possible to specify the password with code in case of a password protected file ? Ofcourse given the fact we know the password .

          Comment

          Working...