Search code examples
activexadobe-readerhresultaxacropdf

Error HRESULT E_FAIL with AcroPDFLib component


I am having trouble starting a Windows Forms application. My application uses the AcroPDFLib component to view a PDF in a Windows form. When I start the application, I get the error indicated above. Looking at the StackTrace, I find muptiple calls to AxHost, so I'm pretty sure this has to do with the AcroPDF ActiveX component. I have Adobe Reader 11.

Here is what I have tried:

  • Enabling the Adobe PDF Reader add-in in IE.
  • Checking the "Display PDF in Browser" setting in the Edit -> Accessibility -> Setup Assistant.
  • Reinstalling the WinForms app.
  • Restarting my computer.
  • I can open other PDFs on the internet.

Here is the Stack Trace:

System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component.
   at System.Windows.Forms.UnsafeNativeMethods.CoCreateInstance(Guid& clsid, Object punkOuter, Int32 context, Guid& iid)
   at System.Windows.Forms.AxHost.CreateWithoutLicense(Guid clsid)
   at System.Windows.Forms.AxHost.CreateWithLicense(String license, Guid clsid)
   at System.Windows.Forms.AxHost.CreateInstanceCore(Guid clsid)
   at System.Windows.Forms.AxHost.CreateInstance()
   at System.Windows.Forms.AxHost.GetOcxCreate()
   at System.Windows.Forms.AxHost.TransitionUpTo(Int32 state)
   at System.Windows.Forms.AxHost.CreateHandle()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ContainerControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.Form.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)

Solution

  • You might have a problematic add-in enabled in IE.

    Please go to your add-ins in IE and disable the Adobe Acrobat Sharepoint OpenDocuments Control add-in. Now check if your application starts correctly. This addin seems to conflict with the Adobe PDF Reader add-in.

    This addin is used to prompt the user to Open or Save a PDF document clicked in Sharepoint. If the add-in is disabled, the PDF will show in IE directly.