在 VB.NET 中将内存流渲染到浏览器

发布于 2024-09-05 08:32:01 字数 69 浏览 1 评论 0原文

在VB.NET中,如何将内存流写入浏览器。我的内存流对象具有构建 PDF 文件的数据。现在我希望它在浏览器上呈现。怎么做呢?

In VB.NET, how can I write a memory stream to browser. My memory stream object has data to build a PDF file. Now I want it to be rendered on browser. How to do that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爱她像谁 2024-09-12 08:32:01

您可以尝试类似的操作:

Dim stream As MemoryStream = GetMemoryStream()
Response.Clear()
Response.ContentType = "application/pdf"
Response.AddHeader("Content-Disposition", "attachment; filename=yourfile.pdf")
Response.Write(stream.ToArray())
Response.End()

我还没有测试代码,也不确定 mime 类型,但这应该可以帮助您开始。

You could try something like:

Dim stream As MemoryStream = GetMemoryStream()
Response.Clear()
Response.ContentType = "application/pdf"
Response.AddHeader("Content-Disposition", "attachment; filename=yourfile.pdf")
Response.Write(stream.ToArray())
Response.End()

I have not tested the code nor am I sure of the mime type, but this should get you started.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文