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

Is it possible to set "responsive off" when exporting SVG of illustrator CC series with javascript?

Explorer ,
Dec 12, 2021 Dec 12, 2021

Copy link to clipboard

Copied

Hello All!

 

I'm an engineer writing a javascript program. I'm Japanese, but I'm not good at English, so I use google translate.

 

In older versions of illustrator, there was no control of responsive settings when controlling SVG output with javascript. However, in the CC series version, you can switch the responsive setting when manually outputting SVG. Can this be controlled from javascript?

 

My problem is that I can't turn off the responsive setting when I want to turn it off when outputting SVG.

 

However, as far as I know, there should be no commands that can manipulate responsive settings.

 

可能であれば、javascriptのソースコードの再編集だけで完了させたいが、難しい為、解決方法を探しています。

TOPICS
Feature request , Import and export , Scripting , Tools

Views

1.2K

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

correct answers 2 Correct answers

Community Expert , Jan 19, 2022 Jan 19, 2022

Votes

Translate

Translate
Explorer , Jan 19, 2022 Jan 19, 2022

Thank you CarlosCanto.

 

Thanks to you, the problem has been solved.

The bottom line is that the functions used inside the script were outdated, not the application preferences.

 

I have already found the location of the configuration file you provided.

However, after changing the settings in this file, restarting the PC did not solve the problem. illustrator may not have read this preference file correctly.

 

Then I referred to the other agenda reports you presented. There was a correct answer in the f

...

Votes

Translate

Translate
Adobe
Explorer ,
Dec 12, 2021 Dec 12, 2021

Copy link to clipboard

Copied

(Sorry, I accidentally posted a Japanese text, so I will write a translation.)

 

If possible, I would like to complete it by just re-editing the javascript source code, but it is difficult, so I am looking for a solution.

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
Community Expert ,
Dec 13, 2021 Dec 13, 2021

Copy link to clipboard

Copied

there's a preference setting you can turn on/off

 

// turn off Responsive SVG preference

// https://community.adobe.com/t5/illustrator-discussions/is-it-possible-to-set-quot-responsive-off-quot-when-exporting-svg-of-illustrator-cc-series-with/td-p/12589330

app.preferences.setBooleanPreference ("plugin/svgOptionDlg/O_ResponsiveSVG", false);

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
Explorer ,
Dec 13, 2021 Dec 13, 2021

Copy link to clipboard

Copied

The reply was delayed. I'm sorry.
I'll try that code right away!

Thank you very much!

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 ,
Dec 21, 2021 Dec 21, 2021

Copy link to clipboard

Copied

Am I missing something on where to put that code.
I have tried placing this code in multiple places in my code and it isnt working as I am not getting a height and width in the svg code.
I bascially I just need to loop over a folder of AI files and convert them to SVGz and this is the only thing I cant do progomatically, everything else is in exportOptionSVG except the ability to turn off responsivness.

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
Explorer ,
Jan 18, 2022 Jan 18, 2022

Copy link to clipboard

Copied

Dear CarlosCanto,

Dear defaultr2l7hvkudx22,

 

Sorry for the late contact!

 

Thank you for lending me your wisdom.

But as defaultr2l7hvkudx22 says, I couldn't control this issue from within the source code.

 

My purpose is to have a large number of .ai files automatically converted to SVG as well.

I only know that the only solution to this problem is to use CS4 illustrator.

 

CS4 does not have an item to control responsive ON / OFF in the SVG export settings.

Due to this disadvantage, the artboard size will be set automatically when converting all files to SVG.

This is a merit of CS4.

 

After all, should we judge that responsive control in the CC series is currently impossible?

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
Explorer ,
Jan 18, 2022 Jan 18, 2022

Copy link to clipboard

Copied

postscript,

 

My current environment is illustrator2021 (build 25.1-64bit) Japanese version.

 

However, when I browse the script development sessions that are not related to this case, it seems that I can control the environment settings using "app.preferences.setBooleanPreference ()".

 

They are sessions about build 25.3.1 and above. If I update the application, it may be possible to resolve this issue.

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
Explorer ,
Jan 18, 2022 Jan 18, 2022

Copy link to clipboard

Copied

I have tried 2021 (build 25.4.x). The result is a failure.And tried 2022 but it failed.

 

It's not a solution, but once you manually set the export settings and export.

 

After that, when the script was executed, responsive OFF was inherited and all processing was completed.

 

However, this method requires one wasted manual effort to turn off responsiveness each time.

 

This is contrary to the concept of automatic processing by the program, as it can lead to mistakes.

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
Community Expert ,
Jan 19, 2022 Jan 19, 2022

Copy link to clipboard

Copied

ok, then the problem might be related to localized language.

 

open the preferences file, on Windows it is located here

"C:\Users\canto\AppData\Roaming\Adobe\Adobe Illustrator 26 Settings\en_US\x64\Adobe Illustrator Prefs"

 

and search for the Responsive key, it might be in Japanese in your system

 

/plugin {

.

.

.
/svgOptionDlg {
/O_ResponsiveSVG 1
/O_IncludeUnusedStyles 0
/O_UseSVGTextOnPath 1
/O_DisbleAutoKerning 1

 

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
Community Expert ,
Jan 19, 2022 Jan 19, 2022

Copy link to clipboard

Copied

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
Explorer ,
Jan 19, 2022 Jan 19, 2022

Copy link to clipboard

Copied

Thank you CarlosCanto.

 

Thanks to you, the problem has been solved.

The bottom line is that the functions used inside the script were outdated, not the application preferences.

 

I have already found the location of the configuration file you provided.

However, after changing the settings in this file, restarting the PC did not solve the problem. illustrator may not have read this preference file correctly.

 

Then I referred to the other agenda reports you presented. There was a correct answer in the first report.

 

The settings I was using to export SVG are

 

// Save as SVG
sourceDoc.exportFile(targetFile, ExportType.SVG, this.getMyOptionsSVG());

 

//***SVG Option

function getMyOptionsSVG(){
var options = new ExportOptionsSVG();
options.DTD = SVGDTDVersion.SVG1_1;

options.cssProperties = SVGCSSPropertyLocation.PRESENTATIONATTRIBUTES;
return options;
}

 

However, this function has been available since the days of CS4.

A new function was implemented. In order to correspond to that function, the following modifications have been made.

 

// Save as SVG
sourceDoc.exportFile(targetFile, ExportType.WOSVG, this.getMyOptionsSVG());

 

//***SVG Option

function getMyOptionsSVG(){
var options = new ExportOptionsWebOptimizedSVG();
options.DTD = SVGDTDVersion.SVG1_1;

options.cssProperties = SVGCSSPropertyLocation.PRESENTATIONATTRIBUTES;

options.svgResponsive = false;
return options;
}

 

I woke up from this nightmare.

Thank you for your cooperation.

 

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
Community Expert ,
Mar 30, 2022 Mar 30, 2022

Copy link to clipboard

Copied

Carlos, thank you very much!

That saved my day ( and my sanity as well ) .

 

Additionally:

We should always know what the user checked the last time when saving as SVG so that we can revert to the user's setting after our code is executed. That would be possible with getBooleanPreference() on the preferences of the application:

 

var currentStateOfResponsiveProperty = 
app.preferences.getBooleanPreference( "plugin/svgOptionDlg/O_ResponsiveSVG" );

 

Thanks a lot!

Uwe Laubender

( ACP )

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
Community Expert ,
Mar 30, 2022 Mar 30, 2022

Copy link to clipboard

Copied

LATEST

Glad to help Uwe!

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