Programmatic PDF printing (auto tray selection)

Q: We currently use PDFnet to convert documents to PDF. I noticed that your website also says that it can print PDF documents. Do you support printing to specific trays? Can this be done programmatically so the user doesn’t have to continually select the tray? And most importantly does it require any third party components to be installed?

A: You don’t need any third party components to be installed.

There are multiple ways to print a PDF document using PDFNet (at least 4) and some of them allow you fine grained control over printer. For example, You could use:

  • pdftron.PDF.Print.StartPrintJob()

  • pdftron.PDF.PDFDraw.DrawInRect()

  • pdftron.PDF.Convert.ToXps() then print the XPSPrint API

(http://msdn.microsoft.com/en-us/library/ms742418.aspx)

As a starting point you may want to take a look at PDFPrint sample (http://www.pdftron.com/pdfnet/samplecode.html#PDFPrint).

Q: Thanks for the response, I’ve since had a look at the sample you suggested and got it working with method B, We print on A4 paper though and it looks like the sample is designed for letter. Should I be looking at adjusting the Left,Right,Top,Bottom variables in that sample?

A:

You should be able to print on any paper size (this is controlled via standard .NET or WIN32 API).

Left,Right,Top,Bottom variables in the sample are used to specify the coordinated within the page on which to draw the page.