Skip to main content
This topic has been closed for replies.
Correct answer UDESCO

You can use the following code for Html Canvas documents. Say, you wish to capture the last frame of your animation; just paste the following code in the last frame:

          this.stop();

          var aTag = document.createElement('a');

          aTag.setAttribute('href', canvas.toDataURL("image/png"));

          aTag.innerHTML = "Download Screenshot";

          aTag.download = "YourScreenshot.png";

          document.body.appendChild(aTag);

2 replies

UDESCO
Adobe Employee
UDESCOCorrect answer
Adobe Employee
June 25, 2018

You can use the following code for Html Canvas documents. Say, you wish to capture the last frame of your animation; just paste the following code in the last frame:

          this.stop();

          var aTag = document.createElement('a');

          aTag.setAttribute('href', canvas.toDataURL("image/png"));

          aTag.innerHTML = "Download Screenshot";

          aTag.download = "YourScreenshot.png";

          document.body.appendChild(aTag);

Community Expert
March 24, 2021

It's an old thread, but I've got a question about it. First... this script works like a charm!

I've put the script on a button. Would it be possible to download it directly? Just one click on the button and download?

Or put it in the action script layer while entering the frame and then use my button to download the image? I don't like the "Download Screenshot" text that much.

Legend
June 22, 2018

Save it to where?

inespa
inespaAuthor
Participating Frequently
June 25, 2018

Well, what are my options?

Can I save it to the device's default 'my images' folder or wherever screenshots usually get saved?

Legend
June 25, 2018

inesaguiar  wrote

Can I save it to the device's default 'my images' folder or wherever screenshots usually get saved?

Web pages can't force files into the client's local filesystem. That would be an insane security vulnerability. If you have server-side scripting support it would be possible to save screenshots on the server. For client-side saving, the code posted above will allow the user to choose to download a screenshot.