Cannot Print Using Default Printer

12 views
Skip to first unread message

Vincent Ycasas

unread,
May 28, 2013, 3:06:15 PM5/28/13
to pdfne...@googlegroups.com
Question:
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?

Vincent Ycasas

unread,
May 28, 2013, 3:09:48 PM5/28/13
to pdfne...@googlegroups.com
Answer:
If you are using PDFNet's sample code to print the document, try changing the following line:
Print.StartPrintJob(pdfdoc, "", pdfdoc.GetFileName(), "", pagesToPrint, printerMode);
to 
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, 
Reply all
Reply to author
Forward
0 new messages