We have large IBM Infoprint printers. I need to read a bunch of PDF files off a database, merge them together, and send it to one of these printers. I need to be able to specify many options such as what tray to use, with/without staple, etc. All of these options can be manually set when I try to print something off my computer (via the advanced print driver preferences), so I am certain that these can also be set programmatically. How can I do this in .NET (Visual Basic)?
You'll want to examine the System.Drawing.Printing
namespace. Specifically, the settings you're looking for will be in the PrinterSettings
class. A primer on GDI printing in .NET is a little out of the scope of this site, but many are available on the web. I'm hesitant to post a link to a particular article, since many examples are lacking in both depth and best-practices adherance. I'll do some additional looking and see if I can find one that's a good starting point.
Edit
Most common printer settings (duplex, color, etc.) are implemented in the PrinterSettings
and PageSettings
classes. For "extra" information that isn't part of the standard Windows printing API, you'll have to use a DEVMODE
structure. For more information (and a blog that appears to be doing exactly what you want to do), check out this article.
You can use iTextSharp to stitch PDF files together (http://itextsharp.sourceforge.net/) And you can use GhostScript (http://www.ghostscript.com/) to send PDF files directly to a Named Printer.