-1

我正在使用 axAcroPDF 在我的 win 表单应用程序中查看 PDF 文件。每当我尝试运行该应用程序时,我都会收到一个空消息框,如下图所示。

有谁知道为什么?要加载 PDF 文件,我将此代码添加到按钮

OpenFileDialog dialog = new OpenFileDialog();
        dialog.Filter = "PDF files (*.PDF)|*.PDF|All files (*.*)|*.*";
        dialog.InitialDirectory = "C:";
        dialog.Title = "Select a PDF file";
        if (dialog.ShowDialog() == DialogResult.OK)
        {
            this.Controls.Add(this.axAcroPDF1);
            axAcroPDF1.src = dialog.FileName;
            filname1 = dialog.FileName;
            button2.Enabled = true;

图片:

在此处输入图像描述

4

1 回答 1

1

我不知道这个答案是否可以帮助您:我正在使用 Adob​​e Reader 9 做同样的工作,它给了我相同的消息框。然后我切换到 Adob​​e Reader 10,消息框消失,我的应用程序正常工作。

这是我的代码

        OpenFileDialog dlg = new OpenFileDialog();
        dlg.Filter = "pdf files (*.pdf) |*.pdf;";
        dlg.ShowDialog();
        if (dlg.FileName != null)
        {
            axAcroPDF1.setShowToolbar(true);
            axAcroPDF1.LoadFile(dlg.FileName);
        }
于 2015-11-04T08:31:21.760 回答