简体   繁体   English

使用C#打印pdf文件,在代码后面进行编码,然后将值发送给javascript以生成打印弹出窗口

[英]Print pdf file using c#, code behind and send value to javascript to generate print popup

I am working on ac# asp.net project in which, I have to print a PDF file from a directory where there are dozens of files. 我正在ac#asp.net项目中工作,我必须从包含数十个文件的目录中打印PDF文件。 I can pick the file from directory but I am not able to print that file by generating a pop up. 我可以从目录中选择文件,但无法通过弹出窗口来打印该文件。

Does any one knows how to pass that file from back end code to java script so that It can show popup and ask for print? 有谁知道如何将该文件从后端代码传递到Java脚本,以便它可以显示弹出窗口并要求打印吗?

PS:I can not post code here due to PHI issue. PS:由于PHI问题,我无法在此处发布代码。

Thanks in advance. 提前致谢。

open your PDF to window, get that window form Javascript, 打开PDF到窗口,从Javascript获取该窗口,

call javascript function, 调用javascript函数,

OpenPrintPopUP(){
var display_setting="toolbar=no,location=no,directories=no,menubar=no, scrollbars=no,width=650, height=850, left=100, top=25"

var prntWindow = window.open("","",display_setting);
prntWindow.document.write(printContent);
prntWindow.document.close();
prntWindow.focus();
prntWindow.print();

prntWindow.close();
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM