我正在使用 winnovative html 到 pdf 转换器来创建 pdf 文档。我添加了一个复选框,供用户选择是否要打印或通过电子邮件发送 pdf 文件。
但我无法让 pdf 页面打开打印机对话框。我已经尝试过 PrinterDialog 类,但这没有用,发送一些带有 window.print() 的 javascript 也不起作用。我搜索了互联网,但找不到任何东西。
我的包含 PDF 的页面具有以下代码:
Response.Clear();
Response.ContentType = "application/pdf";
Response.AppendHeader("Content-Disposition", "inline;filename=Offerte.pdf");
Response.BufferOutput = true;
Response.AddHeader("Content-Length", downloadBytes.Length.ToString());
Response.BinaryWrite(downloadBytes); //downloadBytes = the byte array created by winnovative converter
Response.End();
这将在包含我的页面为 PDF 的浏览器中打开 pdf 查看器。从这里用户可以点击pdf查看器/浏览器的打印按钮。但我想让我的页面打开打印机对话框或将字节直接发送到打印机,以最大限度地减少用户必须执行的操作。
有任何想法吗?