|
Rank: Member Groups: Member
Joined: 12/3/2013 Posts: 16
|
Good Evening,
i want to know if there is a way to manage pdf view inside WebView of WebBrowser Control. I Cannot find an handler that return the response so i can check content-type and manage pdf as i want (like automatically download in a temp folder and so on..)
Can you help me please???
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Thanks for posting in the forum. That is not yet supported because currently WebView does not load any plug-ins and display PDF inside WebView needs a plug-in (usually Adobe Reader). As such it is not possible to do that now. Sorry about it! However supporting plug-ins is definitely on our list and hopefully we will support it in our next release.
|
|
Rank: Member Groups: Member
Joined: 12/3/2013 Posts: 16
|
Thank you very match for the quick response, i hope the plugin will coming as soon as possible.. but waiting for this functionality, there is no way to get the Response object?? something like page.WebView.OnResponseDone where i can read the mime type, the content type or have access to the PostData and byte[] of the response?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi, I believe there are two possible ways to do this. If you can determine if the response is a PDF from your Url, you can use a custom resource handler: http://www.essentialobjects.com/doc/6/advanced/resource_handler.aspxA custom resource handler allows you to intercept a Url and perform your own logic. So you can completely take over the request from the WebView/WebBrowser control. However if there is no way to tell whether the request will result in a PDF response, then you have to let the WebView to handle the request. I believe in that case the request is handled as a download so you can use BeforeDownload, DownloadUpdate and DownloadCompleted event to monitor the request. The PDF file will be downloaded into a temp file. You can then decide what to do with that file. Hope this helps. Please feel free to let us know if you have any more questions. Thanks!
|
|
Rank: Member Groups: Member
Joined: 12/3/2013 Posts: 16
|
Hi,
unfortunately there is no way to know if it is a pdf request so i can't use the RequestHandler. Either, the BeforeDownload and all method related to download are not called from the WebView when i navigate to a page that has to render a pdf file (you can try searching a "test filetype:pdf" on google and click on some links)... so i think that, at this moment, your component cannot manage this behavior.
It is strange because, using CEF, there are a lot of possibilities (without using plugin) to catch and manage the response... I hope this behavior will be as soon as possible added to this product because i think is a very good product but this limit is very big related to a browser component, don't you think?
Anyway.. thank you so much for the support!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Thank you very much for the feedback. We will look into this and see why the download event are not called, and also to see if there is anyway to add the ability to intercept and manage the response, not just the request. We understand that it is an important feature. We will reply here again when we have an update.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi, We have posted a new build on our download page that added ShouldForceDownload event. You can handle this event to force the WebView always handle PDF as a download: http://www.essentialobjects.com/doc/6/advanced/response_handler.aspxThe event is triggered after all the headers have been received (thus MIME type is known), but the body has not been received yet. If you set ForceDownload of the event argument to true, then the WebView goes directly to download the file instead of trying to display it. You can then use the download events to implement your custom handling logic. Thanks!
|
|
Rank: Member Groups: Member
Joined: 12/3/2013 Posts: 16
|
Thank you very much for this fix!! it works very well and solve my problem!!
|
|