Live data from Hacker News

Show HN: Generate pdf with gitbook or mdbook url

github.com

31–40 of 45 posts

Re: Show HN: Generate pdf with gitbook or mdbook url

#31

Just recently I was tasked to convert some huge html pages (with lots of small entries) into a pdf file. The requirements are "fully automated solution" and "pdf must look the same as the page when viewed in a browser". Probably takes less than five minutes, right? I thought the same. Wrong. Chrome/Chromium crashes due to hard coded memory limit in V8. Firefox has no command line option for printing pdfs. No other li…

In 2014 we used wkhtmltopdf[0] to generate PDF copies of Cloudfoundry docs for every version every release, and maybe that's what I'd reach for now. Not sure if Qt WebKit has similar limits as Chromium.

Not that you asked, but I am sitting here silently judging whoever let those pages get that large. Enough html to cap out RAM? Chesterton's Fence dictates that I presume your upstream's hands were tied, but wowee!

0. https://wkhtmltopdf.org/

Re: Show HN: Generate pdf with gitbook or mdbook url

#32

Just recently I was tasked to convert some huge html pages (with lots of small entries) into a pdf file. The requirements are "fully automated solution" and "pdf must look the same as the page when viewed in a browser". Probably takes less than five minutes, right? I thought the same. Wrong. Chrome/Chromium crashes due to hard coded memory limit in V8. Firefox has no command line option for printing pdfs. No other li…

Just because Firefox doesn't have a command line option to print to pdf doesn't mean it's not automatable; you could (have) automate(d) Firefox’s UI instead

Re: Show HN: Generate pdf with gitbook or mdbook url

#33
post #7

Earlier quoted context omitted.

Word offers content immutability with its read-only mode, not sure how much layout change there is, though how much pixel perfection do you need in legal processes that are mostly pure text?

If you have a 300-page legal document, and other sources reference passages, e.g., a paragraph on page 234. It would be unreliable if over the years or depending on the viewer it moves to another page.

Isn't the solution to that not to fix your document’s pixels, but rather to have auto updating references (a la LaTeX)?

Re: Show HN: Generate pdf with gitbook or mdbook url

#35
post #14

Earlier quoted context omitted.

Sometimes vital images disappear and the layout gets messed up. I haven't had that happen to me with a pdf.

Though keep in mind that a given PDF might not embed the font that it uses (the PDF creator might not even have the legal right to embed whatever font they're using), so opening a PDF on other machines can cause them to be messed up if those machines don't have the correct fonts installed. If you want literally pixel-perfect layout, you need to use a raster image format like PNG.

PDF is a container. You can put TIFF images, one per page, into the file

Re: Show HN: Generate pdf with gitbook or mdbook url

#36

I developed KeenWrite[0] with similar ideas to mdbook: typeset Markdown documents into PDF. Technically, this happens in three stages. First, the Markdown is converted to XHTML. Second, the XHTML is converted to TeX commands. Third, the ConTeXt typesetting system produces a PDF file. Both the GUI and CLI can export to PDF.[1] (This means that XHTML also can be converted to PDF.) Like mdbook, the themes are isolated.…

It’s my fear that markdown will eventually become as convoluted as SGML but with simpler syntax

Re: Show HN: Generate pdf with gitbook or mdbook url

#37
post #25

Just recently I was tasked to convert some huge html pages (with lots of small entries) into a pdf file. The requirements are "fully automated solution" and "pdf must look the same as the page when viewed in a browser". Probably takes less than five minutes, right? I thought the same. Wrong. Chrome/Chromium crashes due to hard coded memory limit in V8. Firefox has no command line option for printing pdfs. No other li…

Have you considered Playwright? It offers very straightforward APIs to do exactly this.

This is the way. Firefox may not have a CLI arg for saving PDFs, but they expose it through DevTools API and it can be automated with Playwright, Selenium (or plain http requests) etc

Re: Show HN: Generate pdf with gitbook or mdbook url

#38
post #13
post #8

Earlier quoted context omitted.

I look at PDF like a virtual sheet of paper. Once you "print" to it, abandon any hope of getting things back out. This sounds like a bad thing, but we need some kind of way to say "this is the final presentation no matter what".

Which is bothersome when you disagree about not needing to extract data or modify.

PDF probably some some feature that let's you embed machine-readable data (or the original file in its entirety)

Reminds me of how Adobe Illustrator files were also pdf files and you could view them as PDFs when you rename the extension to .pdf. (this might also apply to Photoshop .psd files)

Re: Show HN: Generate pdf with gitbook or mdbook url

#39
post #31

Just recently I was tasked to convert some huge html pages (with lots of small entries) into a pdf file. The requirements are "fully automated solution" and "pdf must look the same as the page when viewed in a browser". Probably takes less than five minutes, right? I thought the same. Wrong. Chrome/Chromium crashes due to hard coded memory limit in V8. Firefox has no command line option for printing pdfs. No other li…

In 2014 we used wkhtmltopdf[0] to generate PDF copies of Cloudfoundry docs for every version every release, and maybe that's what I'd reach for now. Not sure if Qt WebKit has similar limits as Chromium. Not that you asked, but I am sitting here silently judging whoever let those pages get that large. Enough html to cap out RAM? Chesterton's Fence dictates that I presume your upstream's hands were tied, but wowee! 0.…

Thanks for the suggestion. Yes I've tried wkhtmltopdf. It works, but unfortunately it doesn't interpret the CSS correctly. So the end result looks very different from the actual webpage.

Re: Show HN: Generate pdf with gitbook or mdbook url

#40
post #30

Just recently I was tasked to convert some huge html pages (with lots of small entries) into a pdf file. The requirements are "fully automated solution" and "pdf must look the same as the page when viewed in a browser". Probably takes less than five minutes, right? I thought the same. Wrong. Chrome/Chromium crashes due to hard coded memory limit in V8. Firefox has no command line option for printing pdfs. No other li…

I use PrinceXML for converting long HTML into PDFs and haven’t had trouble with large documents, though I don’t know if we’re in the same ballpark in terms of file size or element count. It’s expensive but is a one-time purchase (and I think it’s free to use personally and to evaluate). You can also use it indirectly through DocRaptor (basically a PrinceXML SaaS with an API), though I’ve never tried it.

The overall size is not that big. The problem is that the html contains lots of small s. But yeah I didn't bother trying any paid services. I probably should have.
Post reply on HN