views:

2442

answers:

5

Are there any free libraries that would "print" to a PDF without actually having to install a PDF printer on the system. I want something that can be completely self contained in my application. The reason I say I want it to "print" is that I've tried and tried to find a solution for directly converting from HTML with CSS to PDF, but it does't seem very possible. So I want to use the System.Windows.Forms.WebBrowser control to render the page first and then output that rendering to PDF. I just don't want the user to be required to install a PDFPrinter.

+1  A: 

Does it have to be free? Last time I looked at ABCpdf it looked quite good, and claims to support css (here).

HTMLDOC should support css at some point, but last time I checked the css stuff was still in beta. And has been for "some time"; I've given up waiting... It isn't .NET, but you can use Process to invoke it.

Marc Gravell
+2  A: 

PDFsharp

Dmitri Nesteruk
Could you be more specific? Have you actually done this before...that is a very extensive library... an example of outputting from the WebBrowser control to a PDF would be nice.
Adam Haile
I've used the low-level features of PDFsharp, i.e., printing a line of text at specific x-y co-ordinates. I have no idea about being able to print from a WebBrowser.
Dmitri Nesteruk
sharpPdf is straight forward to use...
Mitch Wheat
A: 

http://www.html-to-pdf.net/ - This isn't free but its preety cheap and effective. I am using it now to convert HTML with CSS to PDF. Essentially we display the page to the user and then with a click of a button they can download a PDF of the page.

JoshBerke
A: 

SharpPDF

Mitch Wheat
A: 

http://itextsharp.sourceforge.net/ is really excellent. You can see how to use it in the repository at stochfit.sourceforge.net

Steve