TERMtm
TERMtm

Reputation: 1933

HTML rendered inside canvas

I am looking for a workaround way to improvise -moz-element() using -vendor-canvas() to essentially 'snapshot' an element in order to clone it without needing to actually clone the DOM. Are there ways to place actual HTML elements inside a canvas for rendering or reproduction within it? If not, how would you approach a task like this?

Upvotes: 1

Views: 424

Answers (1)

Simon Sarris
Simon Sarris

Reputation: 63872

HTML2Canvas is your best bet really: http://html2canvas.hertzen.com/

This might be a canvas feature in the future. The specification reads:

A future version of the 2D context API may provide a way to render fragments of documents, rendered using CSS, straight to the canvas. This would be provided in preference to a dedicated way of doing multiline layout.

...but not today, and probably not for at least several months. A whole lot more has just been added to the canvas spec recently (independent paths, drawEllipse, currentTransform, resetClip) and hixie likes to add things in batches, first waiting for the major browsers to adopt ~90% of the last batch. So it will be a while.

Upvotes: 1

Related Questions