[英]Print File without print dialog box
I need your help to print my locally saved file without using print dialog box , i tried out many cases but failed to do so. 我需要您的帮助才能在不使用“打印”对话框的情况下打印本地保存的文件,但我尝试了很多情况,但未能成功。 one case is like;
一种情况是
var pr = new PrintDocument();
pr.PrintController = new System.Drawing.Printing.StandardPrintController();
pr.PrinterSettings = new PrinterSettings();
pr.PrinterSettings.PrintFileName = "E:\\File.docx";
pr.PrinterSettings.PrinterName = fileName.ToString();
pr.Print();
pr.Dispose();
This will start Microsoft Word
and print the test.rtf
while suppressing the Print dialog box
. 这将启动
Microsoft Word
并在不显示“ Print dialog box
的情况下Print dialog box
test.rtf
。 However, the path must be fully specified. 但是,必须完全指定路径。
var settings = new PrinterSettings();
var startInfo = new ProcessStartInfo();
startInfo.FileName = @"C:\Program Files\Microsoft Office\Office\WINWORD.EXE";
startInfo.Arguments = @"test.rtf /q /n /mFilePrintDefault /mFileExit";
var p = Process.Start(startInfo);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.