How can I generate a PDF from HTML and use CSS @page numbering (via C#)?

I need to generate some PDFs from HTML for the project I'm working on. I've been using EvoPDF heretofore, and it's worked well but now I have a requirement for page numbering.

I suspect (but am waiting for their tech support to verify) that the CSS @page numbering is not supported. This throws a minor wrench in the works as it will make the code ugly because I have to manually apply PDF elements to the page, and it breaks the wrapper I've put around EvoPDF.

I would love to be able to use the CSS @page counter method described here in order to get page numbering. Basically, I want the Chrome "Print to PDF" option called programatically.

It would be awesome if the solution had C# bindings. Less awesome but probably ok if it was a command line call (I'm using Windows).

Answers


@page is not supported in most HTML to PDF conversion engines. A lot of these are running on webkit (like wkhtmltopdf, HTM2PDF, PDFmyURL, PDFcrowd and what not) and none of these support @page yet.

Of course the ones that use the IE rendering engine do not support @page either.

I believe Prince XML is the only one that fully supports @page at the moment, but it's quite expensive.

If you can live with page numbering in the footer/header however, then you can still use the webkit solutions mentioned above, because they all support the header/footer page numbering.


Need Your Help

How to test USPS shippings

asp.net shipping nopcommerce usps

I use NopCommerce web store and work on implementing USPS shippings.