0

I want to convert a simple HTML table into PDF in the memory (not file system) like this:

string pdfContent = "<table>...</table>";
byte[] pdf = WantedComponent.CreatePDF(pdfContent);

My HTML table has simple text without any formatting.

Xaqron
  • 29,931
  • 42
  • 140
  • 205

1 Answers1

2

You can try iTextSharp. It can render simple HTML as a PDF. I've tried using it but ran into some issues with tables with colspans, but if your HTML table is very simple it might work for you.

http://sourceforge.net/projects/itextsharp/

Also, see the answer to this question for some sample code on how to convert HTML to PDF.

Community
  • 1
  • 1
rsbarro
  • 27,021
  • 9
  • 71
  • 75
  • iTextSharp is NOT free. It's open-sourced under AGPL license. – Bobrovsky Mar 26 '11 at 15:44
  • 1
    @Bobrovsky Good point, sorry about that. I updated my answer. – rsbarro Mar 26 '11 at 16:23
  • Err... *GPL is the very definition of Free. It's not free-as-in-beer-for-closed-source-use, no. – Mark Storer Mar 28 '11 at 17:15
  • @Mark Storer I think that BSD is the very definition of Free. Other people may think other way. So let's not start another holy war. – Bobrovsky Mar 29 '11 at 09:53
  • 1
    Agreed. The various GPLs impose "viral" restrictions, BSD does not. Overloading can work great for functions, but can really fall down in something as imprecise as English: Free – Mark Storer Mar 29 '11 at 19:45