Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
I want to catch(handle) Pdf from webbrowsercontrol. If I click "print pdf file" it shows file download dialog. How can I catch this pdf stream or downloaded file name.
Posted
Comments
Richard Deeming 19-Jan-16 8:17am    
It's not easy. You need to create a custom version of the WebBrowser control, override the CreateWebBrowserSiteBase method, and hook up your own implementation of the unmanaged IDownloadManager interface[^].

There's a sample on MSDN Code[^] which implements a global download manager in C#.

This question on StackOverflow[^] suggests that it's possible to adapt that sample to work with the WebBrowser control.

But there doesn't seem to be a complete working example. The download links in the SO thread are broken.

You might be able to combine the code from the sample with the information in the SO thread to do what you need.
amagitech 19-Jan-16 8:34am    
I am trying another solution like that.
I will install fiddler core. And I will see all request and responses. In normal fiddler program I saw an stream pdf File.
No I am learning fiddler core from http://weblog.west-wind.com/posts/2014/Jul/29/Using-FiddlerCore-to-capture-HTTP-Requests-with-NET

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