Need to automate printing PDF documents from PowerShell (C# .NET)

Q: Which of your products would most easily allow me to print PDF documents from PowerShell, or C# .NET, or even the command line? (listed in order of preference)

My requirements are:
· Completely automated – no UI
· Ability to specify printer
· Ability to specify pages to print
· Ability to specify paper size
· Ability to specify fit to page scaling
· Ability to specify orientation
· Simplicity

A:

Probably the best option would be that you use PDFNet SDK for .NET. As a starting point, download PDFNet SDK for you version of .NET Framework from:

http://www.pdftron.com/pdfnet/downloads.html

After unzipping the archive open ‘PDFNet/Samples/PDFPrint’ sample ( http://www.pdftron.com/pdfnet/samplecode.html#PDFPrint )

This is a very simple console app that you can tweak to meet all your requirements.

Q:

Thanks, that worked. Unfortunately the printer mode methods have not been able to set tray and other settings on our Canon iR-ADV 6075.

A:

Besides using pdftron.PDF.Print.StartPrintJob() , PDFPrint sample also shows how to use ‘pdftron.PDF.PDFDraw’ for more low-level printing (code sample #2): http://www.pdftron.com/pdfnet/samplecode/PDFPrint.cs

Using PDFDraw you have direct access to all .NET Framework APIs related to printing (e.g. PrintDocument, Settings, etc) so you have more control over print process than with StartPrintJob().