Click here to Skip to main content
15,889,578 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I try to print to XPS printer (it's not my default printer), but the program opens me a dialog.

Can I skip the dialog?

This is the code:
C#
pSettings = new PrinterSettings();
pSettings.PrintFileName = "test.xps";
RawPrinterHelper.SendStringToPrinter(pSettings.PrinterName, toSend);
spcn = new StandardPrintController();
printDocument1.PrinterSettings.PrinterName = "Microsoft XPS Document Writer";
printDocument1.PrintController = spcn;
printDocument1.PrintPage += new PrintPageEventHandler(printDocument1_PrintPage);
printDocument1.Print();

thanks!
Posted
Updated 31-Dec-14 21:41pm
v4
Comments
Kornfeld Eliyahu Peter 1-Jan-15 3:45am    
Your code is unclear...It seems you use System.Drawing.Printing and raw printing side-by-side...You have to improve...
Sriram Bala 1-Jan-15 4:10am    
There is a help link already presnet in Codeproject related to XPS file printing using c#. May be you should try that approach?

URL 1. Print to XPS from Code
nav571 1-Jan-15 5:10am    
but it opens me dialog
Richard MacCutchan 1-Jan-15 5:39am    
Which dialog is opened, and where in your code does it happen?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900