Skip to main content
Inspiring
March 22, 2022
Answered

Object Export Option > Use Existing Image > Apply to all SVGs not working

  • March 22, 2022
  • 3 replies
  • 844 views

Dear all,

I am trying to make InDesign use the SVGs I provided during the EPUB (Fixed Layout) Export process, instead of converting to whatever other option is available, as that will not be good for my needs. 

I right clicked on the first SVG > Object Export Option > Use Existing Image for Graphic Objects > Use SVG as Object Tag and checked the option "Apply to all SVGs". 

I would expect this to work, yet upon exporting, unarchiving, and checking the files inside the EPUB, I noticed that only the 2-3 I had manually done were exported as SVGs, while the others were PNGs. 

Since I have close to 100 SVGs in this document, is there a way to make that "Apply to all SVGs" checkbox actually work as intended, or do I need to perform this manually? 

Thank you

This topic has been closed for replies.
Correct answer Laubender

Hi Inélsòre,

one other thing why this could happen:
The placed SVG is forced to a conversion process because it is affected by transparency.

 

Hm. Well, as far as I can see, for a placed SVG graphic the default is "Embed-Code".

So do you want to change that to "Object-Tags"?

 

If so the following code written in ExtendScript (JavaScript) could help; not extensively tested:

 

var doc = app.documents[0];
var allGraphics = doc.allGraphics;

for( var n=0; n<allGraphics.length; n++ )
{
	if( allGraphics[n].imageTypeName == "SVG" )
	{
		allGraphics[n].parent.objectExportOptions.preserveAppearanceFromLayout = 
		PreserveAppearanceFromLayoutEnum.PRESERVE_APPEARANCE_USE_EXISTING_IMAGE;
		allGraphics[n].useSVGAs = UseSVGAsEnum.OBJECT_TAGS ;
	};
};

 

Regards,
Uwe Laubender

( ACP )

3 replies

Community Expert
March 23, 2022

Hi Inélsòre,

see for example this thread about learning ExtendScript for InDesign:

https://community.adobe.com/t5/indesign-discussions/what-are-some-good-resources-for-learning-extendscript/m-p/11106319#M185050

 

You may also find others here in the forum or elsewhere on the web.

 

Regards,
Uwe Laubender

( ACP )

Community Expert
March 23, 2022

Highly recommended is Marc Autret's website after you mastered your personal start into ExtendScript:

https://www.indiscripts.com/

 

Regards,
Uwe Laubender

( ACP )

 

LaubenderCommunity ExpertCorrect answer
Community Expert
March 23, 2022

Hi Inélsòre,

one other thing why this could happen:
The placed SVG is forced to a conversion process because it is affected by transparency.

 

Hm. Well, as far as I can see, for a placed SVG graphic the default is "Embed-Code".

So do you want to change that to "Object-Tags"?

 

If so the following code written in ExtendScript (JavaScript) could help; not extensively tested:

 

var doc = app.documents[0];
var allGraphics = doc.allGraphics;

for( var n=0; n<allGraphics.length; n++ )
{
	if( allGraphics[n].imageTypeName == "SVG" )
	{
		allGraphics[n].parent.objectExportOptions.preserveAppearanceFromLayout = 
		PreserveAppearanceFromLayoutEnum.PRESERVE_APPEARANCE_USE_EXISTING_IMAGE;
		allGraphics[n].useSVGAs = UseSVGAsEnum.OBJECT_TAGS ;
	};
};

 

Regards,
Uwe Laubender

( ACP )

Inspiring
March 23, 2022

Thanks, I will try is ASAP. Where should I write that code? I tried to look for the right place in the Export EPUB panel, or the Export Object Options, with no luck. 

 

I personally have no idea what the difference between Embed Code and Object Tags is, but the reason I had changed it was because the EPUB generated with the Embed Code was full of errors that Apple Books rejected it. Since Apple's error reports are quite cryptic, I could not ensure that this was the reason, but changing it worked so... 

Community Expert
March 23, 2022

How to save existing code as script file and "install" the script file so that you can use the script from InDesign's Scripts panel see for example:

https://www.indiscripts.com/pages/help#hd0sb2

 

Regards,
Uwe Laubender

( ACP )

James Gifford—NitroPress
Legend
March 22, 2022

As nearly as I can tell, yes, you are going to have to set each SVG to export as-is, instead of being converted.

 

Unlike the reflowable EPUB export, there does not appear to be a global option for image preservation (Object: Use Existing Image). (Although to be fair, a recent discussion showed that it may not be reliable, and setting the individual images to export without converson was necessary.)

 

One of the script wizards here might be able to provide a script that will change all settings in one pass.

 

ID is a bit narrow in its handling of SVG image files.

 

Inspiring
March 22, 2022

Thanks!

The fasted workaround I found was to use an Object style, but even there, I can only select one spread at a time. 

Will be waiting for some wizard to teleport here!