Copy link to clipboard
Copied
Hello,
I have a question for this forum that is related to new grounds for me.
What would be the sequence of APIs my CS3 plugin should trigger in order to have current document exported as ebook using XHTML / Digital Edition from "Cross Media Export" section? Any pointer and advices to have this task done by SDK code will be very much welcomed indeed.
Best regards
Patrick Perroud
Copy link to clipboard
Copied
Normally we export documents as pdf and eps from our plugins but epub is not available on the same interface.
I have an observation to make, I'm not sure it's of much use.
I've recently been asked if it was possible to use the scripting interface to export an InDesign document as an epub for Digital Editions.
In this case I was working with CS4, but I've found out that although there is an entry in the file menu to Export for Digital editions, in fact it's not part of InDesign and it doesn't appear to be scriptable.
It is implemented in javascript and is in the application Script folder. On my machine that's
C:\Program Files\Adobe\Adobe InDesign CS4 Debug\Scripts\XHTML For Digital Editions
As such it doesn't seem to be possible to drive it from within the plugin either.
I'd love to be corrected on that last point, because that would be an answer to our problem.
Best Regards
Caerwyn Pearce
Copy link to clipboard
Copied
These exports are implemented as scripts, "compiled" to jsxbin. You'd invoke them as script within their engine. This can be either directly where you know the entry functions, refer to source included in the SDK for at least one of the two exports. If you need the other one, a script can walk the menu hierarchy and at least trigger the associated action.
Dirk
Copy link to clipboard
Copied
Thank you Caerwyn and Dirk for your replies.
In conclusion - despite a menu action available in InDesign application - there is actually no SDK APIs to export an InDesign document to epub format: this is bad but far from being a real surprise.
Being mostly a C++ developer, I am used to think "plugin": never got loud and clear that InDesign's menu actions could be also extended by adding compiled JavaScript modules into the Script directory. I could also make use of this actually: is it precisely documented somewhere?
Best regards
Patrick Perroud
Copy link to clipboard
Copied
Launch ESTK ExtendScriptToolkit, it is installed together with InDesign.
Within that application, the help menu has an object model viewer.
There choose Browser: InDesign 5 Object Model.
Search for "Menu" ...
The snippet below should get you going, even though it addresses a different menu item.
Tested in CS4.
The native menu items are localized, the same way as in the SDK, indicated with the "$ID/" prefix.
For ePub dump the actual names from the menu, either with below script or with the slooow script somewhere deep in the examples.
Btw, $.writeln output goes into the "JavaScript Console" panel of ESTK!
(function(){
var m = app.menus.itemByName("$ID/Main").submenus.itemByName("$ID/&File");
$.writeln(m.menuItems.everyItem().name);
var mi = m.menuItems.itemByName("$ID/File Information...");
var a = mi.associatedMenuAction;
a.invoke();
})();
Copy link to clipboard
Copied
Hello Dirk,
I went to ESK 2 to view ID CS3 object model but couldn't find anything related to xhtml export in there...
Looking at this I also seek for my plugin's scripting provider in there - but couldn't find it either.
OK - let move this one level higher: my plugin implements a scripting provider including a suite of events - one of these events exporting to current spread to .epub document...
I can fire every events in this suite using AppleScript - and the suite is shown in the application's AS dictionnary - so far so good.
Now - I need to move this plugin to InDesign Server - which is done - calling its events using JavaScript instead of AppleScript - that later being quite confusing to me for several reasons.
First of all - when I dump all script resources from Test > Scripting and read the kJavaScriptMgrBossIDR50.txt dump file I can see my suite and related object long description: I just don't know how it could show in the dump file but not in ESK 2 DOM view...
My fear being - my scripting provider implementation that works fine for AppleScript could fail to work for Javascript: is this possible?
Or may be it's my poor Javascript/ExtendScript pratice?
There is below a sample AppleScript handler that fires an event implemented by my plugin scripting provider:
tell application "Adobe InDesign CS3"
activate
set result to ExportSpreadAsEPUB { "/Users/Shared/mySpread.epub" }
end tell
What would be required to fire this very same event from a Javascript handler?
Best regards
Patrick Perroud
Copy link to clipboard
Copied
We already discussed that the JS functions defined by scripts are not included. Therefor my suggested trick had nothing to do with ePub, it was about invoking menu actions from within JS. As you now bring up InDesign Server: IDS has no UI and therefor no menu actions, so you either keep it just as license and let InDesign Desktop do the work, or it is really time to file a support case, especially as you're still targeting to CS3!
Now getting off topic: In the OMV you only see the object model equivalent to the VersionedScriptElementInfo resources that describe your (and all the others) script providers. If in that resource you use the kCoreScriptManagerBoss, your script provider will work in all languages. If it does not show, your plugin might not be recognized by IDS - maybe you forgot to enable IDS in the plugin info?
If I had to implement something similar to your method, I'd change at least these points:
Dirk
Find more inspiration, events, and resources on the new Adobe Community
Explore Now