c# - Programmatically print an XPS file to a physical printer -
i have c# winforms application. user uploads .xps file , specifies printer settings (number of copies, paper tray, etc). program needs programmatically print document these settings. is, there can no user interaction print.
i can come close system.printing addjob method. (https://docs.microsoft.com/en-us/dotnet/framework/wpf/advanced/how-to-programmatically-print-xps-files). however, can't define specific settings here, paper source, number of copies, etc.
i prefer use printdocument method can't figure out how printdocument render/print xps document.
i've looked @ resource, https://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument.printpage(v=vs.110).aspx, can't see how can printpageeventhandler render xps document.
any ideas on how proceed? appreciated!
c# .net 4.5
update:
based on below answer, can send printticket when add job, this:
printticket pt = printqueue.defaultprintticket; pt.copycount = 2; // pt.inputbin = [ inputbin enum option ] printqueue.addjob("name", "file", false, pt);
i can't see easy way set inputbin printticket. inputbin enum , doesn't have option setting name of 1 of available bins.
you're on right track addjob
, need version accepts printticket. need create new printticket using user's settings - values set null end using defaults set printqueue.
Comments
Post a Comment