locked
Acrobat Reader Issue RRS feed

  • Question

  • I have written a program in VB.NET that has the ability to display PDF files in a windows form.  I created a new window and added the AXAcroPDF component.  Here is the code that I use to display the PDF file from my main form:

      frmAcrobat.AxAcroPDF1.LoadFile("{File Name}"
    )
      frmAcrobat.AxAcroPDF1.setLayoutMode(
    "SinglePage")
      frmAcrobat.AxAcroPDF1.setView(
    "Fit")
      frmAcrobat.AxAcroPDF1.setCurrentPage(
    CInt("{Page Number"))
      frmAcrobat.Show()

    Everything works fine in debug mode.  When I compile the program and try it outside of Visual Studio, the program AVs with the message below.  For some reason, the compiled program can't find the Acrobat component.  I know that there is a simple fix to this but I have tried every thing that I know of and so far nothing has worked.

    Any ideas?



    See the end of this message for details on invoking
    just-in-time (JIT) debugging instead of this dialog box.

    ************** Exception Text **************
    System.IO.FileNotFoundException: Could not load file or assembly 'AxInterop.AcroPDFLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
    File name: 'AxInterop.AcroPDFLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
       at Yakima_Steel_MES.frmPriceLookup.Button1_Click_1(Object sender, EventArgs e)
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ButtonBase.WndProc(Message& m)
       at System.Windows.Forms.Button.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam


    John
    Monday, April 20, 2009 5:44 PM

Answers

  • When you added the Acrobat Reader control to your form, it copied AxInterop.acroPDFLib.dll to your bin\Debug and bin\Release directory.  Don't forget to copy that file as well.  And install Acrobat Reader on the target machine.
    Hans Passant.
    • Marked as answer by Johngeh Tuesday, April 21, 2009 1:43 AM
    • Unmarked as answer by Johngeh Tuesday, April 21, 2009 1:44 AM
    • Marked as answer by Johngeh Tuesday, April 21, 2009 1:46 AM
    Monday, April 20, 2009 6:11 PM

All replies

  • When you added the Acrobat Reader control to your form, it copied AxInterop.acroPDFLib.dll to your bin\Debug and bin\Release directory.  Don't forget to copy that file as well.  And install Acrobat Reader on the target machine.
    Hans Passant.
    • Marked as answer by Johngeh Tuesday, April 21, 2009 1:43 AM
    • Unmarked as answer by Johngeh Tuesday, April 21, 2009 1:44 AM
    • Marked as answer by Johngeh Tuesday, April 21, 2009 1:46 AM
    Monday, April 20, 2009 6:11 PM
  • Hi Hans,

    That was it.  I copied over the two files that were added to the bin\Release directory to the application directory on the target machine (Reader was already installed) and it worked.

    Is there any way to add those two files to the executable?  I know that I can add them using the installer but I thought that I would ask.

    Thanks for your help.

    John
    John
    Tuesday, April 21, 2009 1:48 AM
  • You'll have to wait until C# version 4.0
    Hans Passant.
    Tuesday, April 21, 2009 1:50 AM