WPF CEFSharp ChromiumWebBrowser-渲染MemoryStream [英] WPF CEFSharp ChromiumWebBrowser - Render MemoryStream

查看:120
本文介绍了WPF CEFSharp ChromiumWebBrowser-渲染MemoryStream的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要能够通过调用Web API从我们的Web服务器检索Pdf,然后在ChromiumWebBrowser中为CEFSharp呈现文档,所有这些都在内存中,而不是在本地保存文件.

I need to be able to retrieve a Pdf from our web server via a call to Web API and then render the document in the ChromiumWebBrowser for CEFSharp, all within memory and not saving the file locally.

现在,我正要在MemoryStream中取回文件,但似乎无法进一步取回.

Right now I'm at the point where I get back the file in a MemoryStream, but can't seem to get any further.

这可能吗?任何示例将不胜感激.

Is this possible? Any examples would be greatly appreciated.

谢谢.

推荐答案

您有两个选择,为自己的自定义方案实现方案处理程序. client://或实现 Resource Handler

You have two options, implement a Scheme Handler for your own custom scheme, e.g. client:// or implement a Resource Handler

https://github.com/cefsharp/CefSharp/blob/cefsharp/41/CefSharp.Example/CefSharpSchemeHandler.cs#L46

如果仅使用静态生成的资源,则可以使用默认的 ResourceHandlerFactory .

You can use the default ResourceHandlerFactory if your using just statically generated resources.

https://github.com/cefsharp/CefSharp/blob/cefsharp/41/CefSharp.Example/CefExample.cs#L98

或实现自己的 IResourceHandlerFactory

https://github.com/cefsharp/CefSharp/blob/cefsharp/41/CefSharp/DefaultResourceHandlerFactory.cs

方案处理程序更复杂,但支持 async 回调. CefSharp 的下一版本将包括对 async 资源处理程序的支持.( -pre 版本应该在本周的某个时候发布)

Scheme Handler is more complicated, supports async callbacks though. Next version of CefSharp will include support for async resource handlers. (-pre release should be out sometime this week)

这篇关于WPF CEFSharp ChromiumWebBrowser-渲染MemoryStream的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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