7 ms·
The article mentions screenshots. I am interested in running the browser as a rendering tool, but ouputing not just a bitmap, but something closer to PDF. The g
by nicklaf 9y ago
The article mentions screenshots. I am interested in running the browser as a rendering tool, but ouputing not just a bitmap, but something closer to PDF. The goal here would be to crawl a bunch of pages and spin up the CPU to run all the needed JavaScript to render things, but to obtain an identical version of the page that runs about as fast viewing a screenshot, but also includes text. An offline "web OCR", if you will.
NeWS, Display PostScript, Quartz all come to mind. I know you can save webpages as PDF documents, but I am thinking of something that is like PDF but closer to HTML-just more closely coupled to what is being displayed, and not whatever arbitrary style or JavaScript abuse the developer decided on.
Even just outputing some neat, canonical HTML based on the state of the page once everything is loaded would be helpful, so that the bitmap could later be combined in some kind of new document format.
- richdougherty 9y agoI'm pretty sure you could write some WebDriver + JavaScript that captures the DOM/text in the page. You might even be able to capture layout information for later reconstruction.
- nicklaf 9y agoThat's useful to know, thank you. Perhaps the solution isn't so complicated.
- kuschku 9y agoWhat you want is SVG. You want an SVG output of the actual, full, page. With text embedded in SVG properly, of course.
- nicklaf 9y agoThat is actually exactly what I want (why didn't I think of it...)! Thank you. In fact, wkhtmltoimage supports svg and does a great job of rendering, say, GitHub or techmeme. It falls over on formatting mathoverflow.net, but I think the same technique could be changed a bit to more closely resemble what actually gets layed out on the page in a running browser instance.