Copy link to clipboard
Copied
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
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( allGraphic
...
Copy link to clipboard
Copied
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.
—
Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
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 )
Copy link to clipboard
Copied
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...
Copy link to clipboard
Copied
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 )
Copy link to clipboard
Copied
Well... what can I say?! It just worked! 🙂
I used BBEdit to created the JSX file, moved it to the scripts folder, and ran it.
Since the code doesn't include any user-interface it looked as if nothing had happened, but upon checking on a few random images, they were all set as expected.
Since this language (JavaScript) seems like a mixture between C and Swift, with which I have some modest degree of skill, could you point me towards a resource for learning how to write Scripts for InDesign?
Copy link to clipboard
Copied
Hi Inélsòre,
see for example this thread about learning ExtendScript for InDesign:
You may also find others here in the forum or elsewhere on the web.
Regards,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
Highly recommended is Marc Autret's website after you mastered your personal start into ExtendScript:
Regards,
Uwe Laubender
( ACP )