0

I've got a web page enrolment form that we need to email to our customers. The form has been divided into 2 columns using the column-count css property. Unfortunately, when NReco.PdfGenerator generates the Pdf, these columns are rendered as a single column, breaking the flow of the form.

As an example, using the Online Pdf Generator on the NReco web page and the example for column-count from W3Schools (yes, I know!), we can see only a single column generated.

Does anyone have any idea how to get NReco.PdfGenerator to honour the column-count property, or of another library that can successfully transform some large (9 page) web forms?

Update

Looks like this is an issue with the underlying wkhtmltopdf library (which has now been archived)

Anyone know of a fork of this that is being updated?

John O
  • 893
  • 7
  • 12

1 Answers1

1

As you already noticed wkhtmltopdf is based on QtWebKit 4.8 which is rather old rendering engine and it doesn't support many modern CSS3 things including "column-count".

You may try this workaround to achieve result that is similar to "column-count": https://github.com/wkhtmltopdf/wkhtmltopdf/issues/1872 (not a 100% replacement as it works only for content that fits a single page). Another option can be usage of js plugin that splits content on 'columns' like this one: https://github.com/adamwulf/Columnizer-jQuery-Plugin

Finally, you can consider to use modern headless-Chrome based way to convert HTML pages to PDFs: https://gotenberg.dev/ (its deployment is not so simple as wkhtmltopdf -- it requires a separate docker container to run) and use one of existing .NET clients to access this web API from C# code. If you like NReco.PdfGenerator API simplicity technically it is possible to add 'HtmlToPdfConverter' implementation that will use gotenberg API instead of wkhtmltopdf.

Vitaliy Fedorchenko
  • 8,447
  • 3
  • 37
  • 34