I’m trying to create a silent print function, and I wanted to use the PrintPDF sample as a starting point. However, when I attempt to use the sample, I get the error “Unable to open printer” when calling Printer.StartPrintJob.
I have changed my default printer to a local (virtual) printer to no avail. Can you give me any pointers as to why this may be happening and what can be done about it?
If you are using PDFNet’s sample code to print the document, try changing the following line:
Print.StartPrintJob(pdfdoc, “”, pdfdoc.GetFileName(), “”, pagesToPrint, printerMode);
Print.StartPrintJob(pdfdoc, “Microsoft XPS Document Writer”, pdfdoc.GetFileName(), “”, pagesToPrint, printerMode);
You can change the “Microsoft XPS Document Writer” to the name of the printer you want to use. If you use the above changes, Microsoft XPS Document Writer will prompt you where to save the document,