Seehyung Lee
Seehyung Lee

Reputation: 610

COMException error when trying to load PDF file using ActiveX Control in C#

I'm using VS 2012 Express for Windows Desktop.

private void button1_Click(object sender, EventArgs e)
{
    DialogResult result = openFileDialog1.ShowDialog();
    if (result == DialogResult.OK)
    {
        axAcroPDF1.LoadFile(openFileDialog1.FileName);
    }
}

I use the Acrobat Reader ActiveX control; with that dropped into a form. And I'm trying to load a PDF file. But I'm getting the error message below:

An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in System.Windows.Forms.dll

Additional information: Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))

Upvotes: 2

Views: 2136

Answers (1)

jross
jross

Reputation: 1119

Is it possible that you are building an “x64” target OR “Any CPU” on a 64 bit Windows? According to this article Using Adobe Reader in a WPF app the Acrobat DLL is 32 bit so therefore must run in “x86” 32 bit build.

Quote from article: “Also as there is not currently an x64 version of the Acrobat DLL it is wise to ensure that the target platform is set to x86 (this is on the build tab of the project properties), otherwise an error along the lines of {"Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))"} will occur – pretty cryptic if you ask me!”

Upvotes: 3

Related Questions