gpt4 book ai didi

winforms - 尝试在 C# 中使用 ActiveX 控件加载 PDF 文件时出现 COMException 错误

转载 作者:行者123 更新时间:2023-12-04 05:08:37 25 4
gpt4 key购买 nike

我正在为 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com