• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Export current project as SVG with CEP

New Here ,
Jan 18, 2020 Jan 18, 2020

Copy link to clipboard

Copied

Is there a way to export current project as svg in Illustrator with CEP panel using js or jsx ?

TOPICS
Import and export , Scripting , Third party plugins

Views

665

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Enthusiast ,
Jan 18, 2020 Jan 18, 2020

Copy link to clipboard

Copied

Hi, what do you mean by "Project"? The active document with one artboard, or all artboards, etc?

You can run an evalScript call in JS on a JSX function like this:

function exportFileToSVG(path) {

  // Replace current file extension with .svg
  var name = app.activeDocument.name.replace(/\.[\w]*/, ".svg");

  // Then export file (active artboard) of the activeDocument
  app.activeDocument.exportFile(
    new File(path + name),
    ExportType.WOSVG,
    new ExportOptionsWebOptimizedSVG()
  );
}



Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 19, 2020 Jan 19, 2020

Copy link to clipboard

Copied

LATEST

I mean current file or active layer (selected layer) If I have a list with many layers I want to save all selected layers like individual file with svg extension but I don't know if in Illustrator exists some events like in photoshop to listen at mouse event to check if exists some selected layers and also export it like svg.

Or another case wich is the best practice for me is to extract the svg content from selected layer with jsx and transport it back to js file without saving all files like svg on disk.

You snippet works very well, thank you.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines