+1 vote
by (130 points)

Hey all — I haven't been able to find any info about anyone else trying to do this, and I have no idea how to do it myself. I'm trying to set up a thing so the player can click a link and physically print the last story passage — like, to an actual printer. Does anyone have any experience doing this? 

My thoughts right now are that I'd have to set it so that it calls up a javascript function when the link is clicked, but other than that, I'm pretty lost. 

Thank you! literally any help would be very appreciated. 

1 Answer

0 votes
by (63.1k points)

You can use window.print(), which will open the browser's print UI for the user.

Try something like this:

Blah blah blah.

(link-repeat: 'Print this page!')[\
    (set: _dummy to print())\
]

Or this:

Blah blah blah.

(link-repeat: 'Print this page!')[\
    <script>print();</script>\
]

This may not work in <iframes> or embedded content, such as on itch.io.

...