我正在使用适用于 Windows 桌面的 VS 2012 Express。
private void button1_Click(object sender, EventArgs e)
{
DialogResult result = openFileDialog1.ShowDialog();
if (result == DialogResult.OK)
{
axAcroPDF1.LoadFile(openFileDialog1.FileName);
}
}
我使用Acrobat Reader ActiveX控件;并将其变成一种形式。我正在尝试加载 PDF 文件。但我收到以下错误消息:
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))
最佳答案
您是否有可能在 64 位 Windows 上构建“x64”目标或“任何 CPU”?根据这篇文章Using Adobe Reader in a WPF app Acrobat DLL 是 32 位,因此必须在“x86”32 位版本中运行。
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!”
关于winforms - 尝试在 C# 中使用 ActiveX 控件加载 PDF 文件时出现 COMException 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15182052/