App / Report Builder

I have had some experience converting a very basic HTML table to PDF via https://wkhtmltopdf.org/, which was one of the better utilities I've found.

You mentioned in your earlier thread "that leveraging the CSS in the current web pages may convert readily to PDF". My experience does not bear that out, and my layout was VASTLY simpler that what you've described here.

HTML is simply not a page-based layout engine, and CSS is not up to the task either. Any @print directives you place are at the mercy of the browser's rendering engine to be interpreted correctly. The Webkit-based util I mentioned seems to ignore or misinterpret them entirely. Just dealing with internal printer margins, PDF renderer page margins, and table internal margins was an amazing headache, and I consider myself very well versed in CSS and HTML (although it's been a few years, but the general form hasn't changed much).

If you've seen that meme about "I moved the image 1 mm in Microsoft Word and it generated 4 new pages" you'll understand what I went through.

I also could NOT get the Windows version of wkhtmltopdf to generate properly, it was always scaled down. Ended up using the Mac version which did work correctly. I still don't understand why that was...same command line params on both platforms, still rendered the PDF wrong on Windows, I gave up trying to figure it out.

Please note that there was nothing dynamic about the page size or contents: the layout was fixed, positioning was absolute for most elements, and it still wouldn't align. I was almost literally making millimeter changes with almost a full inch of extra space that would suddenly jump to a new page.

For what you're describing you need, I can't recommend it. Go with SSRS. It handles all the page elements, headers and repetition, word-wrap, etc. for you. HTML does not, CSS does not, and the PDF renderer probably won't either. Even if your current solution works flawlessly in a browser, or even all browsers, you will very likely be very frustrated with the conversion. I can't say for certain that SSRS will render a PDF better, but it will be a lot easier to fix than wrangling HTML + CSS directly.

2 Likes