Hacker News new | ask | show | jobs
by TimTheTinker 116 days ago
> If you generate PDFs with headless browsers or HTML-to-PDF tools, you've accepted a compromise: heavy dependencies, memory leaks, and "approximate" layout that shifts across environments

Absolutely not true with Prince[0]. It's an HTML/CSS-based typesetter built by the creator of CSS (Håkon Wium Lie [1]) that is lightweight, cross-platform, requires no dependencies, has no memory leaks, is 100% consistent in its output, is fully compliant with the relevant standards, and has a lot of really great print-oriented features (like using CSS to control things like page headers/footers, numbering, etc.). Prince has been used to typeset a lot of different print output types, from posters to books to scientific papers. It's even a viable alternative to LaTex. I've used it in the past, and can attest that it is outstanding.

[0] https://www.princexml.com/

[1] https://en.wikipedia.org/wiki/H%C3%A5kon_Wium_Lie

1 comments

Thanks for the correction. I'm actually not familiar with Prince, so I really can't tell.

To be clear, VMPrint isn't meant to compete with established engines like that. It’s just a genuinely helpful tool I built from scratch for the specific tasks I needed to accomplish because I couldn't find an alternative.

Prince looks powerful, but I have a feeling it probably wouldn't have been the right fit for my use case anyway.

Prince starts at 2k. This is OSS
Weasyprint [0] is OSS and supports CSS Paged media. I’m not actually sure why you’d ever use something like this project (or headless chrome for that matter, maybe you need some automated login as well?) which doesn’t.

print-css.rock [1] has a good overview of available tools and their features.

[0]: https://github.com/Kozea/WeasyPrint

[1]: https://print-css.rocks/

Because CSS is exactly what I wanted to avoid. I just needed predictable pager layout, and I didn't want to wrestle with CSS. Besides, this thing's tiny size allows it to run in a serverless function on the Edge, and that can be useful sometimes.
Why use HTML if you want to avoid CSS? HTML default styles only?
Who said I used HTML? It was impossible to write screenplay/manuscript in HTML and receive industry compliant outputs when printed/converted to PDF.
And Weasyprint does not have browser dependencies either, which is great.

Fun fact: I had to write a routine administrative letter for my parents in another country, I asked Claude to do so in PDF form so I could email it to them they would print it and mail it. The way it did so was to write a Python program using Weasyprint to generate the PDF...

For a personal desktop license, it's $495.

If you need something specific for a hosted service and aren't able to pay the full license fee, I can attest from personal experience that Håkon Wium Lie is very friendly and can probably work something out with you.

What does price have to do with anything.