gpt4 book ai didi

c# - 如何显示流返回的 pdf(在 JsonResult 中)?

转载 作者:行者123 更新时间:2023-12-01 08:18:07 25 4
gpt4 key购买 nike

我有一个 pdf,通过 GetTestReport 操作以 json 结果流返回:

return this.Json(pdfInBytes);

在我看来:

$.post('@Url.Action("GetTestReport", "Reports")', function(data) {
// What have i put here?
});

如何在整个页面或特定 div 中显示 pdf?

最佳答案

PDF 无法嵌入到文档中,它本身就是文档,并且您不能将其放入 JSON 结果中,您需要将其 URL 放入 JSON 中。

然后您仍然可以将其放置在 iFrame 中(它将成为源 src)。或者您可以执行 window.open('you_pdf_url.pdf'); 将其显示在新选项卡中。

关于c# - 如何显示流返回的 pdf(在 JsonResult 中)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9199497/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com