我需要你的帮助来打印我本地保存的文件,而不使用打印对话框,我尝试了很多情况但未能这样做。一个案例就像;
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();
答案 0 :(得分:0)
这将启动Microsoft Word
并打印test.rtf
,同时取消Print dialog box
。但是,必须完全指定路径。
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);