120 points · by tilt · 15y ago · 28 comments
This is truly inspiring.
I'm interested to look through the source and see how this was implemented. There are many things that are really tricky to handle using the computedStyle way of rendering HTML. Just to name a few:
* Form elements
* Dotted, dashed, rounded borders
* Gradients
* Text with word-wrap: break-word applied (for some reason measuring each character does not work properly here).
* CSS Outlines can be tricky, though I have gotten that to work pretty well in my implementation using getClientRects().
* Overflows / scrolls with fixed width or height divs (and nested ones)
* Iframes
For basic text and images (such as http://bgrins.github.com/DrawWindow/tests/basic.html) it holds up pretty well.
For IE<9 the Flash option won't have to be the only option either, a server could be rendering the elements gathered from the users browser (in other words a canvas proxy for the canvas renderer).
In terms of my script, the aim is to try and get the compatibility down to FF3, IE6 (with non-canvas support through flashcanvas or server canvas), Opera (haven't looked much yet how old version would be able to support it), and Chrome.
I threw together a hybrid of client side DOM and url2png's distributed webpage rendering farm. This proof of concept should be enough to kickstart a team needing this functionality today. Best of both worlds in my (biased) opinion.
Is the size of the image adjustable? I'm developing an online text editor and this would be a great tool to display some kind of "page preview".
http://stackoverflow.com/questions/4912092/using-html5-canva...
http://stackoverflow.com/questions/4912092/using-html5-canva...
Also modifying the DOM preserves when hitting Send Feedback.
Kevin Rose was right, if someone can build that as a service, they would do quite well.
page.render(path_to_output);
I think it can save in PDF, GIF and PNG formats (it checks the extension on the filename to determine format)