c# - Print File without print dialog box -
i need print locally saved file without using print dialog box , tried out many cases failed so. 1 case 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 start microsoft word
, print test.rtf
while suppressing print dialog box
. however, path must 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);
Comments
Post a Comment