We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Sending PDF to different printers

The application I am writing will be automatically printing out documents of different types. I have a user requirement to be able to specify (In something like a prefrences file) that doc type 1 goes to printer x and doc type 2 goes to printer y. All I can currently do is print to the default printer, how do I programatically select which printer to print to (This application will run on a server and the user will have no access to it, it will automatically print out the documents daily on a schedule). My intention is to have 2 or more printers installed on the server and the application will determine after creating the document which printer to send it to.

If I put in this:

//pgs.PrinterSettings.PrinterName = @"\\Printserver\PrinterName";

It still prints to the default printer!

Can somebody help me???

I have found another article with a link to this: http://www.aspose.com/documentation/.net-components/aspose.pdf.kit-for-.net/aspose.pdf.kit.pdfviewer.printdocumentwithsettings_overloads.html

But I cant log on to the site to view the file!


Thanks for contacting support and sorry for the delayed response.

I am working over this query and will get back to you soon.


Just wondered if there was any update on this?


Thanks for your patience and sorry for the delayed response.

In order to specify the printer to which you need to print the document, please pass the name of printer to PrinterName property of PrinterSettings class. ps.PrinterName = “ActMask Virtual Printer”;

I have tested the scenario where Microsoft XPS Document Writer is set a default printer over my machine and I have specified the Printer name as ActMask Virtual Printer and as per my observations, the file is properly being printed using the printer I have specified. As per your requirement, you can instantiate new PdfViewer and PrinterSettings and specify the printer to which you need to print the documents.


We used to have Aspose.Pdf.Kit for .NET as a separate product but in July-2011, Aspose.Pdf.Kit for .NET was merged into Aspose.Pdf for .NET. So the above specified link is related to old documentation of Aspose.Pdf.Kit for .NET which is removed. Please visit the following link to get the required information about overlaod methods of PrintDocumentWithSettings. PrintDocumentWithSettings

We are sorry for this inconvenience.

Yep, finally got it to work - I was sending the print to the printer name as it was shown in control panel. If I send it to \\severname\printername then it comes out with no error! However...... The Aspose Viewer seems to hang for about a minute before printing each time it is called. If I take out the line in PrinterSettings then it prints out very fast (less than a second) - why is the Viewer hanging for this amount of time when a printer is specified?

viewer.PrintDocumentWithSettings(pgs, ps);


Thanks for sharing the details.

I have tested the scenario where I have specified local printer installed over my machine and I have used PrintDocumentWithSettings(…) method to print the document and as per my observations, the printing is performed in less than 5 seconds. I think the taken in your case might be due to the fact that PdfViewer searches for printers specified in code and when you do not specify the printer name, the printer set a default on system is used and application does not have to find the printer.