views:

1031

answers:

3

Does anyone know how to get a html content, convert it to pdf and save it to database?

I've tried so many ways, but nothing seems to work. In some articles, it's written to use HTMLParse, in others HTMLWorker... sometimes throws an error "document has no pages"... sometimes, it just throws an exception but it didn't specify the error...

Does anyone know a good way to do this?

I'm using C# 3.0, ASP.NET MVC and LinQToSQL.

Thanks in advance and a lot!!

+1  A: 

I don't think itextsharp parses the html properly, you might want to look at another library: Open Source Library or possibly even Tall Components

Jon
A: 

Unfortunately not possible with Itextsharp. Please post your solution here if you find something. I'm also looking for a good .net pdf library

Paco
+1  A: 

For HTML to PDF i tend to look at HTMLDoc. It's an exe and not a library, so it may not be exactly what you are looking for, but it'll probably get you over the hump.

Looking at the iText book, Lowagie says:

"One of the frequent questions on the iText mailing list is, 'Does iText provide HTML2PDF functionality?' The official answer is no; you're advised to use HtmlDoc or ICEBrowser." Page 456.

He then goes on to show an example of HTMLParser, but stresses it's not up to the huge job of parsing and presenting HTML.

Mark Nold