Rendering snapshots¶
-
LC.renderSnapshotToImage(snapshot, options)¶ New in version 0.4.9.
Render the snapshot to a canvas. To turn the result into an image URL, call
toDataURL()on the result.Options
rectA dict
{x, y, width, height}specifying which part of the image to draw, in drawing coordinates (before scaling). Defaults to the bounding box of all shapes. If you don’t specify arectand there are no shapes in the drawing,getImage()will returnundefined.marginA dict
{top, right, bottom, left}defaulting tonull. If the image’s bounds are determined by the shapes’ bounding rect (i.e.rectis not given), this dict determines the amount of space on each side.scaleAmount by which to scale the image output. Shapes will be rendered at full resolution. Defaults to
1.watermarkImageImage to render in the center behind everything, unaffected by erasers.
watermarkScaleScale of the watermark.
-
LC.renderSnapshotToSVG(snapshot, options)¶ New in version 0.4.9.
Render the snapshot to an SVG string that can be inserted into the DOM or downloaded.
Warning
SVG export does not currently support watermarks, scale, or eraser shapes.
Options
rectA dict
{x, y, width, height}specifying which part of the image to draw, in drawing coordinates (before scaling). Defaults to the bounding box of all shapes. If you don’t specify arectand there are no shapes in the drawing,getImage()will returnundefined.marginA dict
{top, right, bottom, left}defaulting tonull. If the image’s bounds are determined by the shapes’ bounding rect (i.e.rectis not given), this dict determines the amount of space on each side.