Click here to Skip to main content
15,884,836 members
Please Sign up or sign in to vote.
1.40/5 (2 votes)
See more:
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.
Posted
Comments
Sergey Alexandrovich Kryukov 31-Dec-15 0:32am    
Why would you assume PDF should be shown? You should not assume the client has anything to show PDF.
Anyway, not enough information.
—SA
souvikcode 31-Dec-15 0:34am    
client not gonna but commercial license of any library. So he has to have adobe,etc. Forget it. Just tell me why the strange behavior is occurring if you can.
Sergey Alexandrovich Kryukov 31-Dec-15 12:54pm    
I did not pay attention that you are embedding the browser control. But I don't know which one you are embedding. Microsoft's? But then you have insufficient control over it (and may be compromised quality). I would strongly suggest to look for WebKit or Gecko... Is Windows 10 the only target OS? (I just don't know the situation with Edge.)

As to "just tell me why the strange behavior...", I think we didn't get enough information to tell that.

—SA
souvikcode 31-Dec-15 13:59pm    
Its solved now. I set "requireAdministrator" in application manifest file.I removed that and converted to "asInvoker".And it works.

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 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/[^]
 
Share this answer
 
Comments
souvikcode 31-Dec-15 8:26am    
But it was working fine two days ago. And not bit issue.I have set all to 32 bit cpu. The same was working well before 2 days. Not only this,it is working if I open program by visual studio. Not working with direct running exe.
webmaster442 31-Dec-15 9:03am    
Then it's your PDF readers issue. The Webbrowser control can't display PDF natively, it calls an aciveX contol. Maybe the system blocks your activeX control for whatever reason. Maybe your Visual Studio is running as Administrator. In this case as an Administrator maybe it allows the execution.
But like I sad previously forget the built in webrowser.
Sergey Alexandrovich Kryukov 31-Dec-15 13:03pm    
After some thinking, voted 5.
The information provided by the inquirer is insufficient, but your speculations look reasonable to me. Generally, it's hard to rely on WebBrowser control's fine behavior, because of limited control of the developer: different versions will be used in different environments. Also note that PDF ActiveX control may or may not be installed at all, the application developer has no control over it. I mentioned it in my comment to the question.
—SA
Its solved now. I set "requireAdministrator" in application manifest file.I removed that and converted to "asInvoker".And it works.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900