Chrome:打印在版本 98.0.4758.102 中无法运行
我正在尝试使用 chrome 使用的内置功能打印 pdf。
我有一个继承自 Page
的 aspx
,在它的 Page_Load
事件中,我将 pdf 内容作为字符串获取(然后将其转换为字节),并按如下方式设置Response
:
Response.Clear()
Response.ClearContent()
Response.ClearHeaders()
Response.Buffer = bufferOutputStream
Response.BufferOutput = bufferOutputStream
Response.ContentType = "application/pdf"
Response.AddHeader("content-length", pdfBytes.Length.ToString)
Response.AddHeader("content-disposition", "inline; filename=" & fileName & ".pdf")
Response.CacheControl = "no-cache"
Response.Expires = -1
Response.BinaryWrite(pdfBytes)
Response.Flush()
我尝试在控制台的 Top (Extension)
上使用 print();
,但它想要打印窗口的捕获而不是内容pdf。
我尝试了 IE、Edge、Chrome 版本 90、Firefox、Brave、普通版和隐身版,没有任何扩展,清除了缓存/导航历史记录,它们都可以工作。奇怪的是,Brave 使用相同的 Chromium 版本(Chromium 版本 1.35.103:98.0.4758.102(官方构建)(64 位))。
I'm trying to print a pdf using the built in that chrome uses.
I have a aspx
that inherits from Page
, on it's Page_Load
event, I grab the pdf content as string (then convert it to bytes), and set the Response
as follows:
Response.Clear()
Response.ClearContent()
Response.ClearHeaders()
Response.Buffer = bufferOutputStream
Response.BufferOutput = bufferOutputStream
Response.ContentType = "application/pdf"
Response.AddHeader("content-length", pdfBytes.Length.ToString)
Response.AddHeader("content-disposition", "inline; filename=" & fileName & ".pdf")
Response.CacheControl = "no-cache"
Response.Expires = -1
Response.BinaryWrite(pdfBytes)
Response.Flush()
When I press the print button I have the following error:
I tried to use print();
on the Top (Extension)
in the console, but it wants to print a capture of the window instead of the content of the pdf.
I tried IE, Edge, Chrome Version 90, Firefox, Brave, both normal and Incognito, without any extensions and cache/nav history cleared and they work. Strangely enough, Brave uses The same Chromium version (Version 1.35.103 Chromium: 98.0.4758.102 (Official Build) (64-bit)).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论