Skip to main content
Known Participant
October 11, 2023
Question

Export to SVG via Export API is creating larger files than Export via the UI

  • October 11, 2023
  • 0 replies
  • 118 views

I am calling Illustrator from another app to export .ai files to .svg. I am getting SVG files that can be three times the size of the file if I export using Illustrator's Export As command in the user interface.

 

Illustrator.ExportOptionsSVG svgOptions = new Illustrator.ExportOptionsSVG();

svgOptions.CSSProperties = Illustrator.AiSVGCSSPropertyLocation.aiPresentationAttributes;
svgOptions.ArtboardRange = strArtboardName;
svgOptions.DocumentEncoding = Illustrator.AiSVGDocumentEncoding.aiUTF8;
svgOptions.EmbedRasterImages = false;// Rasters? Rasters? We don't need no stinkin' rasters.
svgOptions.FontType = AiSVGFontType.aiSVGFont;

svgOptions.FontSubsetting = Illustrator.AiSVGFontSubsetting.aiGlyphsUsed;

theDoc.Export(theNewFile, Illustrator.AiExportType.aiSVG, svgOptions);

 

I have tried all the DTD options and all the CSSProperties options but the files still are much larger. Some options may result in maybe ten KB different. But, I'm exporting a file that is >600kb via the api when it is just over 200kb using the user interface.

Here is a .ai file and linked png.

https://drive.google.com/open?id=1-75oG63LVDuMOLfBOQ014s35RYw3khel&usp=drive_fs

https://drive.google.com/open?id=1KESO2TdHdZLy9lhF3727p40-AOyI3sAt&usp=drive_fs

 

Here is the files exported via the API and UI.

https://drive.google.com/open?id=1-78WGnfGyJoAlOhBwecH7H9pdOyaWA3U&usp=drive_fs

https://drive.google.com/open?id=1-2hzhwgKAfBJ5f3xs0bdjDcjsvKJ5ao-&usp=drive_fs

 

The artboard name for the above file is "Artboard 3". Leaving it empty ("use all arboards") makes no difference either. I'm trying to figure out how to use the API to get the same result as exporting via the user interface.

This topic has been closed for replies.