Skip to main content
Solved

Export and Save as SVG File


Khagwal

I am trying to export and save an SVG file.

I have tried exportAsync in following code which is returning svg code, but how i can save it as svg file.

let node = figma.currentPage.selection[0];
node.exportAsync({format: 'SVG'}).then(res => console.log(String.fromCharCode.apply(null, res))).catch(err => console.error(err));

figma.closePlugin();

Please help 🙂

Best answer by Khagwal

To export SVGs or PDFs, You can simply post message to UI’s window and save a respective SVG or PDF file using Blob. Hope this helps 🙌

View original
This topic has been closed for replies.

3 replies

Matt_Turnbull

Hey man, this might help you:

GitHub

Khagwal
  • Author
  • 1 reply
  • Answer
  • February 25, 2022

To export SVGs or PDFs, You can simply post message to UI’s window and save a respective SVG or PDF file using Blob. Hope this helps 🙌


Hi,
I’m actually trying to do the same thing but I just need image and getting this error

Argument of type 'Uint8Array' is not assignable to parameter of type 'number[]'.
  Type 'Uint8Array' is missing the following properties from type 'number[]': pop, push, concat, shift, and 5 more.ts(2345)

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings