Skip to main content
Participant
June 23, 2023
Question

Saving as SVG change Objects ID's

  • June 23, 2023
  • 1 reply
  • 1185 views

Hi,

 

I'm dealing with an issue when saving my artboard to SVG format.

I've a symbol which is composed by more that 100 objects; these objectes are named like obj01, obj02 etc.

when I export tha .ai file into a .svg one (by using File -> Save a Copy...) all the objects ID are changed.

This prevent the proper working of the connected javascript that are needed for animating the graphics.

 

This is an  example of what I found in the output SVG file:

 

<symbol id="Left_Meter" viewBox="-5.2 -19.1 10.3 38.3">
<g id="Meter_00000123429610710706795870000006488014317108039044_">

<line id="obj01_00000168838862971836405580000014345967761908115369_" fill="none" stroke="#00FFFF" stroke-width="0.25" stroke-miterlimit="10" x1="4.9" y1="-17.5" x2="3.6" y2="-19.1"/>

<line id="obj02_00000067928245498127379540000012569225357743473033_" fill="none" stroke="#00FFFF" stroke-width="0.25" stroke-miterlimit="10" x1="4.6" y1="-17.3" x2="3.3" y2="-18.8"/>

 

I'm actually running the most recent verison of AI (27.6.1) and I've no really ideas on what cause this issue. In the recent past I made a number of other graphics and following the same approach I never faced the problem.

 

Have you any ideas ???

Mak

This topic has been closed for replies.

1 reply

Monika Gause
Community Expert
Community Expert
June 23, 2023

Save as produces old code.

Try Export > Export for screens

Mak_TAuthor
Participant
June 23, 2023

Just try but the svg output is unreadable (no indentation).

However trying to find any of the object names (e.g. obj01) nothin has been found.

I've also try to use Export As... function.

in this case the output is more readable and it seem the objects ID are correct, but the output completely lost the references to the .js scripts.

Monika Gause
Community Expert
Community Expert
June 24, 2023

You cannot reliably create interaction in SVG files in Illustrator. If you want to use JavaScript in your SVG, you absolutely want modern SVG code and not the stuff Save as creates.