C# webBrowser 导航到 pdf 中的另一个页面 [英] C# webBrowser navigate to another page in pdf

查看:29
本文介绍了C# webBrowser 导航到 pdf 中的另一个页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 C# winforms 应用程序,可以在 webbrowser 控件中打开一个 pdf 文件.它可以打开我想要的任何页面,但是如果我想更改页面(转到书签),则网络浏览器将停止工作.我找到了 这篇文章,其中解释了基本上是 Webbrowser.Navigate(url) 仅在 url 更改时触发.如果它不会更改它使用网页的缓存版本."但是我使用 Uri 调用导航,而不是像这样的字符串 url:

I have a C# winforms application that opens a pdf file in a webbrowser control. It opens to whatever page I want just fine however if I want to change page (go to a bookmark) the webbrowser stops working. I found this article which explains "Basically Webbrowser.Navigate(url) ONLY fires if the url changes. If it doesn't change it uses a cached version of the web page." however I am calling navigate with a Uri, not a string url like this:

webBrowser.Navigate(new Uri(url));

我的问题很简单:在网络浏览器中打开文件后,如何导航到同一个 pdf 文件中的另一个页面?

My question is simply: how can I navigate to another page in the same pdf file, after I have opened the file in the web browser?

推荐答案

此代码可能对您有用.

public static void GetAllText(WebBrowser webBrowser,int toPageNum)
{
       webBrowser.Focus();
       for(int i = 0; i < toPageNum; i++)
            SendKeys.Send("{PGDN}");
}

这篇关于C# webBrowser 导航到 pdf 中的另一个页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆