Free Support Forum -

Printing PDF files to printer

I have a need to batch print multiple PDF files in the background from the server.

Is there a way to render PDFs in a Windows service and send to the printer, without having to invoke Adobe Acrobat reader.

Thank you for your help,

Hi Naren,

Aspose.Pdf.Kit for .NET allows you to print PDF files to a printer without any involvement of Adobe Acrobat or Adobe Reader etc. Please see the following topics to help you get started:

Printing PDF files using Printer Settings and Page Settings
Printing to an XPS File and Hiding Print Dialog

This component allows you to send one PDF file to the printer at a time. If you want to send multiple files then please loop through the PDF files and send the files to the printer one by one. You may download the latest version from Aspose.Pdf.Kit for .NET download section and try at your end.

I hope this helps. If you have any further questions, please do let us know.


		<span style="font-family: 'Verdana'; font-size: 8pt;"></span><br><span><br></span>

Hi Shahzad,

Thank you for your help about the printer. This example is great for printing. What if the print fails? Is there an API that I should use to catch and report errors.

Thank you,

Hi Naren,

Aspose.Pdf.Kit for .NET doesn’t provide any special API to catch printing related exceptions. I would recommend you to catch generic Exception objects and find the exception related information in your application. However, if you find that PdfViewer is unable to process some file then please report such issues to us, so we could provide you some resolution for that.

If you find any further questions, please do let us know.

Hi Viktor,

Thank you. Here are couple of samples.

Can we convert an Excel into PDF using Aspose.pdf ? We do not need to generate any custom Excel or PDF, just a flat PDF. Please let me know.


Hi Naren,

I’m afraid, I couldn’t understand your last post. You have shared the Doc files, while you mentioned the thoughts to convert Excel to PDF.

Could you please elaborate your requirement a little bit, so we could guide you accordingly?


I am sorry. I sent the files that I was supposed to send to another thread.

We need to generate PDF files from MS Word (Doc and DocX) formats. These doc files may contain images and tables and also embedded flow charts.
We need to generate PDF files from MS Excel files
We need to print multiple PDF files in the background on the server in a Windows Service program. We do not want to launch MS Word or MS Excel on the server.

What are the components that we need? I have looked at one example of generating PDF from Excel on this forum. However Aspose.Pdf does not have a class called “Excel”.

Excel excel = new Excel();
// or you can call following piece of code to open an Excel file in memory
//excel.Open(excelStream, FileFormatType.Default);
MemoryStream stream = new MemoryStream();
excel.Save(stream, FileFormatType.AsposePdf);
Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();
pdf.BindXML(stream, null);
pdf.Save(“d:\test\abc.pdf”); // you can change this line of code to save the file to stream

Thank you for your help,

Hi Naren,

If you want to convert Excel and Word documents to PDF files and later print those PDF files then you will need multiple components. As far as printing is concerned, you can use Aspose.Pdf.Kit as shared in my previous posts. However, regarding other components, I’m moving this thread to the Aspose.Total forum, so that the related representatives would be able to guide you appropriately.


Hi Naren,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. I'm a representative for Aspose.Words. Using Aspose.Words you can convert any Word documents to PDF. Please see the following link to learn more:

Please let me know in case of any issue. I will be glad to help you.

Best regards,

Can I generate PDF from Excel using Aspose.PDF?


Thanks for your interest in Aspose.Cells.

You can use Aspose.Cells for .NET directly to convert your Excel (xls/xlsx) file into pdf. You do not need any other component for this.

Below is a code example.


//Instantiate the Workbook object

//Open an excel file

Workbook workbook = new Workbook(“f:\test\Book1.xls”);

//Save the document in Pdf format

workbook.Save(“f:\test\outBook1.pdf”, SaveFormat.Pdf);

For further reference, please see this document: Converting to PDF Files