在webbrowser控件中打开pdf [英] opening pdf in webbrowser control

查看:262
本文介绍了在webbrowser控件中打开pdf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在winform的webbrowser控件中,我想显示pdf。当我在visual studio 2015中运行应用程序时它工作正常。现在生成了exe。当我双击exe来运行应用程序时,一切正常,Web浏览器正在打开,但是pdf没有显示。我面临的一个奇怪的问题。我不知道它是什么。

我的操作系统是Windows 10.不仅如此,它在几天前使用exe(双击直接打开)。但现在不行。和我朋友的机器一样,以前工作,现在不工作。

所以它不是os问题。

In my webbrowser control of winform I want to display pdf. It is working fine when I run the application in visual studio 2015. Now exe is generated. When I double click exe to run the application,all is fine,web browser is opening,but pdf is not being shown. What a strange problem I'm facing. I don't have idea what is it.
My os is windows 10. Not only this,it was working with exe(double clicking to open directly) some days before. But not working now. Same as in my friend's machine,working before,not working now.
So its not os problem.

推荐答案

64位问题可能吗?在调试中通常会设置Prefer 32 bit标志,但是对于发布版本它可能没有设置。

无论如何,你不能使用内置的Web浏览器控件。这是非常过时的。更好的选择是使用Awesomium,任何团队都可以免费获得
64 bit issue maybe ? In debug usually the "Prefer 32 bit" flag is set, but maybe for release build it's not set.
Anyway you souldn't use the built in Web browser control. It's extremely outdated. A better choice would be to use Awesomium, which is free for any team making less than


100K的收入,并且可以在任何教育或非商业应用程序中免费使用。它可以显示没有插件和PDF的PDF。它基于谷歌Chrome引擎。另一种选择是OpenWebKitSharp。

Links&关于该主题的更多资源:

C#:WebBrowser vs Gecko vs Awesomium v​​s OpenWebKitSharp:选择什么以及如何使用 [ ^ ]

https://code.google.com/p/open-webkit-sharp/ [ ^ ]

www。 awesomium.com/ [ ^ ]
100K revenue and free to use in any educational or non-commercial apps. It can display PDF without plugins & it's based on the Google Chrome engine. Another option would be OpenWebKitSharp.
Links & more resources on the topic:
C#: WebBrowser vs Gecko vs Awesomium vs OpenWebKitSharp: What To Choose And How to Use[^]
https://code.google.com/p/open-webkit-sharp/[^]
www.awesomium.com/[^]

现在解决了。我在应用程序清单文件中设置了requireAdministrator。我将其删除并转换为asInvoker。它可以工作。
Its solved now. I set "requireAdministrator" in application manifest file.I removed that and converted to "asInvoker".And it works.


这篇关于在webbrowser控件中打开pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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