0

I need to convert html which include css classes based on css file(s).The HTML also has images as background (css class that has background-image as property). It uses css3 properties and models (i.e.- flexbox). I'm just at the begining of my search, but few names came along: wkhtmltopdf Pechkin itextsharp phantom.js HtmlToPDF

I had some experience with iTextSharp but not with a rich html as mentioned.

I'm looking for a tool that can convert that kind of HTML to a PDF. Can be done using .net->C# - (prefered) or node.js, but not PHP. Thanks in advance

Guy E
  • 1,775
  • 2
  • 27
  • 55

1 Answers1

0

I've made some investigation, the most problematic issue was css3 properties (flex box model) which were not converted as it should be to the PDF -see details below. More than this - when using background-image - I set the background-image property with base64 code of the image as the url (there are online converters png <-> base64).

Below are some of the converters I've investigated:

  1. pdfcrowd - the best .net api I've found. Worked well with the flexbox. The problem is that it is not for free for long-term.
  2. HtmlRenderer.PdfSharp - C# converter - seems like not able to parse well the flex-box.
  3. Pechkin is a .NET Wrapper for wkhtmltopdf DLL (command line tool) - also - couldn't parse flex-box well.
  4. html-pdf - node.js package that uses phantomjs - worked well for me with the flex-box model with minor changes.

There are few other wrappers for the phantomjs which should work.

stud3nt
  • 2,056
  • 1
  • 12
  • 21
Guy E
  • 1,775
  • 2
  • 27
  • 55