@mocanvas/mocanvas · function
declare function printSelection(editor: Editor, ids?: readonly ShapeId[]): booleanPrint the drawing: the selection if there is one, otherwise the page.
Not window.print(). The editor is a component on somebody's page, and the
host window's print view is that whole page — headers, navigation, the
article the canvas is embedded in, and a canvas element that a print
stylesheet cannot usefully lay out. What the user asked to print is the
drawing, so the drawing is what is rendered: the same SVG the exporter
produces, alone in a hidden same-origin frame that is printed and then
thrown away.
Returns false when there was nothing to print or no DOM to print it in;
the menu item disables itself on the same condition, so this is the
belt-and-braces case rather than the normal one.
mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.