Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Does converting to HTML first and then to PDF help?


This is what I have done for a couple of books I wrote in Markdown (https://deanebarker.net/books/).

Convert to HTML, then use Prince (https://www.princexml.com/) to style and convert to PDF.


Their licenses are pretty expensive. Any good free open source alternatives?


I don't know what the scope of this is, but https://pagedjs.org/ is Javascript that does pagination and page margin styling. It's essentially a polyfill for CSS Paged Media: https://www.w3.org/TR/css-page-3/

Pretty nice to work with, if you can run JS. (The rest is just Puppeteer to print. Though I couldn't use their command line tool, because it force-injects paged.js, and it didn't play well with the Preact components for previewing I had made.)


I've only ever used a free version? I've never paid for it. I think it's free for personal projects? Or at least it was...

Edit: I see it's $495 now. I don't think it was priced when I used it, but it's been 4-5 years.


If it looks correct in a browser, then chromium + playwright.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: