Nava Amo

Nava Amo

  • NA
  • 25
  • 17.3k

How Can I print from winForm to XPS printer without dialog?

Jan 1 2015 3:14 AM
Hello!
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: 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!