0

我需要您的帮助才能在不使用打印对话框的情况下打印本地保存的文件,我尝试了很多情况但都失败了。一种情况是这样的;

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();
4

1 回答 1

0

这将在Microsoft Word抑制. 但是,必须完全指定路径。test.rtfPrint 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);
于 2013-05-15T10:23:31.957 回答