我们在 .net c# 应用程序中使用 AxInterop.AcroPDFLib.dll 在 Windows 窗体应用程序上显示 pdf。我创建了一个演示以重现此行为:
public AxAcroPDFLib.AxAcroPDF m_AxPdf;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
m_AxPdf = new AxAcroPDFLib.AxAcroPDF();
((System.ComponentModel.ISupportInitialize)m_AxPdf).BeginInit();
m_AxPdf.Dock = DockStyle.Fill;
panel1.Controls.Add(m_AxPdf);
m_AxPdf.Visible = true;
m_AxPdf.LoadFile(@"C:\temp\test.pdf");
m_AxPdf.setShowToolbar(true);
}
重现步骤:
- 启动应用程序
- 按下按钮以显示 pdf 内容
- 关闭表格
然后关闭表单最多需要 20 秒。在昨天(15.023.20053)的更新之前,表单关闭确实没有问题。这是一个已知的错误,还是有解决方法?
编辑:实际上是处理 AxAcroPDF 对象需要更长的时间。我能做些什么才能让它恢复正常,还是我必须等待 adobe 补丁?
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
//takes up to 20 seconds
m_AxPdf.Dispose();
}