Comment by tom_alexander
7 hours ago
> obviously needs to be a PDF
I've been making my reports in self-contained HTML files[0] and it works out so much better than PDF. It is not constrained by paper sizes, and it lets me add some nifty features. For example, I recently added support for hiding columns in a table using exclusively CSS. The only downside is browsers can render things slightly differently, but for my use cases I don't need pixel-perfect identical rendering.
[0] Images are inlined base64-encoded, CSS/JS embedded with style and script tags. No external assets / no http requests.
You can also use media queries for printing specific styling too so you can remove things that maybe a user doesn't need to print out:
https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Medi...
Being constrained by page sizes is “a feature, not a bug” in most contexts. If I’m calling out numbers on the 3rd line of page 38 of a report, it helps if that’s consistent.
Unless you can embed fonts [into the page itself] you aren’t beating PDF
Not only can you embed the fonts, but you can make it interactive and output a PDF if you really wanted to. The HTML might grow if you embed enough JS, but on the other hand... some PDFs are insanely large.
Not a problem with data: URIs. But then, a report may not need fancy fonts if HTML is acceptable.
You can embed fonts into an HTML page. For example, place an @font-face with the src:url being a base64-encoded blob, in a style element.
The only reason PDFs still have a job is: pixel perfect consistency; the built-in validity stuff (ensuring the document wasn't altered, etc.); or the customer doesn't need the other things, but isn't open to alternatives. Otherwise, PDF is just a major headache.
Also page-level consistency, and generally layouting in a printable format
Even with the same word document opened only in various MS Word versions (web, desktop, etc) you won't get consistent page numbers. And HTML tables work great on screen but don't print very well if they span more than what fits on a single sheet of paper