Print SVG from within Snap!?

We're working on a project in which students generate the outline for a house, print the outline, and then use scissors to cut out the design and fold it up into a three-dimensional object. There's an example in the image below:

Net for House

One of our colleagues, Elaine Wolfe, is using TurtleStitch to generate similar outlines for houses. We think that Snap! could potentially be a good tool for our project.

While we could export the SVG files generated in this manner and then use a tool such as Inkscape to print the files, it would be convenient if the files could be printed directly from Snap!

Is there a convenient way to print SVG vectors directly from Snap! or would it be better to use an external tool such as Inkscape for this?

P.S. In addition to cutting out the printed outlines with scissors, some of the students use digital die cutters such as the Silhouette Portrait to cut out the outlines. This requires use of the vector file; a ".jpg" image won't work for this purpose.

You might need to download the file from Snap!, open it in your browser, then right-click » Print to print the image. :slight_smile:

That's a good suggestion. In Windows 10, this is what appears:


It's kind of a faux pas (requires JS) but there is a part of the old project, the HTML dialog viewer.
Used this way, it renders an SVG preview
HTMLDialog script pic
and start printing when clicked.
Esc to close.

@dardoro I see that your HTML: dialog viewer can be used to print on the screen of the computer. Can that output be sent to a physical printer?

We would like to print the 2D outline of a house onto card stock so that it can be cut out, folded up, and transformed into a three-dimensional physical object.


The best thing to do would probably search up how to print an svg in javascript. I'm searching it up now to see if I can find something.

We could always export the SVG file to the desktop and then print it with another program such as InkScape. But we thought it might be nice to do it all from within Snap! if there's a straightforward way to accomplish this.

Ohhh, I see you found the whole project...

If you try to render SVG
<svg onclick="window.print(this)"...
only the dialog box content is rendered for print with Chrome@Windows.
Does it work on your system?

Wait a moment...
I supposed you explicitly build an SVG text, but you create an image on Stage with pen and export "pen vectors"? So you want to "close the loop"?

untitled script pic - 2024-03-12T210827.779