简体   繁体   English

使用axAcroPDF清除并重新加载PDF

[英]Clear and Reload PDF with axAcroPDF

I have a axAcroPDF object with a textbox and two buttons. 我有一个带有文本框和两个按钮的axAcroPDF对象。

Button1 loads Open File Dialog, sends a filename/path to the axAcroPDF object and sends the filename/path to a textbox. Button1加载“打开文件对话框”,将文件名/路径发送到axAcroPDF对象,并将文件名/路径发送到文本框。

What I want with button3 is to realase the loaded pdf file and clear the filename from the textbox. 我想要的button3是重新分配加载的pdf文件并从文本框中清除文件名。 So that the user can reload another pdf file. 这样用户可以重新加载另一个pdf文件。

My attempt is below: 我的尝试如下:

private void button3_Click(object sender, EventArgs e)
        {
            textBox1.Text = String.Empty;
            axAcroPDF1.Dispose();
            axAcroPDF1.setLayoutMode("SinglePage");
            axAcroPDF1.Show();
        }

Initially, I've tried with axAcroPDF1.Hide(); 最初,我尝试使用axAcroPDF1.Hide(); and axAcroPDF1.Dispose(); axAcroPDF1.Dispose();

This hides the axAcroPDF, but I'm unable to reload a new file. 这隐藏了axAcroPDF,但是我无法重新加载新文件。

Any suggestions how I should fix this? 有什么建议我应该解决这个问题吗?

Clearing the AxAcroPDF is as simple as providing a file, that doesn't exist: 清除AxAcroPDF就像提供一个不存在的文件一样简单:

AxAcroPDF1.LoadFile("Empty")

A lot of people are confused the same way, trying to achive this... 很多人都以同样的方式感到困惑,试图做到这一点...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM