Hey, dial back the blasphemy there. HTML is not PDF, it's usually made from text in the first place.
I'd guess you could force all text to use a monospace font, with fixed measures and line-height, and limit the width of the page. Then mostly dump the resulting text arrangement into the terminal.
Now, layouts from the various elements and CSS are probably a lot trickier, but snapping all margins and padding to multiples of a symbol's size should go a long way.
It seems that this could even be embedded at different levels in the browser: the layout engine or just the user's JS. (If JS can obtain the exact layout of text lines and elements―likely not, though, especially in forms. Maybe via devtools.)
> Hey, dial back the blasphemy there. HTML is not PDF, it's usually made from text in the first place.
Hey, dial back the blasphemy there. PDF is not an image, it’s usually[0] made from text in the first place.
As someone who has a bunch of experience both creating and parsing PDFs, it’s definitely very doable to extract the text content and render it in a similar way on a terminal. Yes, parsing the PDF format is much more painful than average HTML, but these days there’s libraries commonly available to assist.
[0] unless the PDF is a famous redacted DOJ document, then it’s a poorly scanned collection of image crammed into a PDF container.
Hey, dial back the blasphemy there. HTML is not PDF, it's usually made from text in the first place.
I'd guess you could force all text to use a monospace font, with fixed measures and line-height, and limit the width of the page. Then mostly dump the resulting text arrangement into the terminal.
Now, layouts from the various elements and CSS are probably a lot trickier, but snapping all margins and padding to multiples of a symbol's size should go a long way.
It seems that this could even be embedded at different levels in the browser: the layout engine or just the user's JS. (If JS can obtain the exact layout of text lines and elements―likely not, though, especially in forms. Maybe via devtools.)