views:

664

answers:

4

I've got some information I would like to output to a printer, but also as a PDF. I would be great if the PDF and the printing output would look the same. As what I understand, PDF reading and creating is not supported in C#.

I can create PDF's easily with external librarys like iTextSharp, but I don't know how to print them without using a different application, like Adobe Acrobat.

What are my options?

A: 

In WPF there's PDF viewer controls. I'm not sure if you're using WPF, but if you want to view PDF's inside your own app, this could be a solution. Have a look at this.

Tony
This app seems to use Acrobat dll, though I get an error when I try to use it:Retrieving the COM class factory for component with CLSID failed due to the following error: 80040154.Tried with some solution changing platform to X86, but without success.
Dr Mugg
seems some COM class hasn't been registered with the system it seems. Not sure how to resolve :(
Tony
A: 

Sending a PDF directly to a printer requires a library to interpret the PDF,YOu can probably use Acrobat directly, but something like GhostScript will be more efficient.

Mark Redman
I don't want to be forced to install other applications. External dll-files is ok though.
Dr Mugg
+2  A: 

You may consider using a 3rd party PDF printer driver; such as PDFCreator, or CutePDF.

CutePDF has a royalty-free developer version (for purchase) with programmatic access via the Registry.

The only other option that I've come across is using MigraDOC + PDFSharp, but you must author the document via MigraDOC / PDFSharp directly, it can't be a "pre-made" PrintDocument.

David
A: 

Like, you need to use report generator like Crystal, FastReport.net, MS RS.

So - you can create you document in report generator, print it from native report generator format and convert it to PDF. In FastReport you'll receive wysiwyg PDF (as in report). I can not say something about other reporting tools.

Merl