C# – .NET library to print PDF files

cnetpdf

I am after a library which can accept an already created PDF file and send it directly to the printer. I don't want the user to need Adobe Reader or anything else installed, the application will generate a PDF and I want to print it.

Best Answer

Sorry, my first answer (since deleted -- FGITW answer saying just use iTextSharp) assumed it was PDF FAQ #1 when in fact it was PDF FAQ #~5, mea culpa...

There's no system-provided native PDF processing, so outside of using an app such as FoxIt or Acrobat -- which you shouldn't discount too quickly - people who use PDF will have one or the other and will be choosy about which one they prefer as they're not all equal, esp if you get into more advanced features and their associated licensing and monetisation schemes.

Not aware of any specific libraries that address this requirement, though the other question I've linked to above should have a good answer. ... researches; time passes... An answer on the other question says PDFSharp should suit, the sample looks straightforward.

On reflection based on looking at Pdfsharp's FAQ wiki, iTextSharp has similar stuff for generating TIFFs/images as PDFSharp has.

An alternative which may or may not be in scope is to generate and/or convert to e.g., an XPS file, which does have built in printing support (pretty sure .NET 3.5, and possibly earlier have it as a standard component in the Client Profile).

One point that shouldn't be missed in this all is that the Lowagie book (iText In Action) is excellent and if you're going to be doing anything in reading, writing or providing PDF forms, you should have it on your shelf. Similarly, if you do go the FLOSS library route, iText has to be seriously considered.