Lurker News

Comments (265) 53 threads

Earlier comments
brightball1 reply#
My question on these is always how it handles multi page documents. Most DOM and CSS approaches to HTML to PDF require it to fully render everything for placement before it can convert.

If you have to render something big, like a 300 page member directory for example, the approach will blow up.

idreyn1 reply#
I used paged.js in production and while it's definitely not fast enough to run during an HTTP request, it can render a 300 page document reasonably quickly, definitely within the 120 second TTL of our worker tasks. It can be quite finicky though and sometimes stalls on things like images that are taller than a single page.
brightball1 reply#
The RAM upper limit is my bigger concern.
frongpik1 reply#
Add to this a pdf to html converter, with a focus on official forms (e.g. irs tax forms), ability to easily edit fields and add signatures (similar to how the free android adobe app does it), and you can charge money for it.
abhinav222 replies#
Thanks - indeed there is likely a market for it. One of the issues is that to get a commercial app, you have to solve for most of the edge cases and make sure it has a good enough UI for the non sophisticated.

I was thinking about doing it, but it would be a lot of work to do right.
By right, I would want it to be the quality of sublime or emacs / vim :) :)

frongpik1 reply#
You'd essentially have a pdf editor that can import a pdf, edit it and export the html back to pdf. Working with official forms is one usecase. Another is an iframe that can preview pdfs without resorting to plugins.
abhinav22#
Indeed - that makes a lot of sense
frongpik#
Actually, there's one more usecase for a html to pdf converter: making a book-style copy of a multipage website. I'm looking right now at a scientific site with content spread over multiple pages and it's tiring to find and click all the links to make sure I don't miss anything.
webwanderings1 reply#
This is cool. Exactly what I was looking for not too long ago (sometimes markdown does not fit all the needs for documentation).

How about images? How do you handle images; their layout, scaling etc?

abhinav22#
Basically you can use CSS to manage their layout - dimensions, positioning, scaling, etc. Should work pretty well

If you want floating images (e.g. text on the left, images on the right), it may be a bit more difficult and not perfectly possible. This guide will help: https://www.pagedjs.org/page-floats/
One tricky part is if you want to have text within images and have them the same size as your main text (eg in MS Word where you can have shapes and text boxes). For that, you can probably get close enough with a simple image load, and more precise by using svg graphics, but it may result in a reasonable amount of complexity to make perfect (if at all).
For charts, use charts.js in my opinion.

GrumpyNl1 reply#
There should be a button on there that converts the site to a pdf.
dredmorbius#
Some sites have this, notably Wikipedia and Wikisource, with the option to save as HTML, PDF, and ePub, generally. Occasionally other formats.

Load more comments