EPUB InDesign Scripts

Scripts panel in InDesign CS5.5
  • Sumo

At PePcon 2012, Anne-Marie Concepcion (@amarie) led a session on “Top Scripts and Resources for EPUB.” In #ePrdctn Hour on Twitter June 13 (it happens every Wednesday at 11:00 a.m. EST) one of them, Kris Coppieters’s script for converting InDesign page item geometry into CSS information, was mentioned again, so I figured it would be a good time to share more of them. The links below will take you to a Webpage where you can read about the script and what it does and where you can download the script file.


InDesign Scripts


The Document Object Model of the InDesign CS4 scripting layer provides an obscure property, TextPreference.enableStylePreviewMode, which allows to show “style overrides” as red strikeouts or paragraph vertical bars in normal screen mode (as illustrated above). The script simply toggles between the normal view mode and our special “display style overrides” mode for CS4+ to spot-check a story with visual markup for local overrides.


One of the most popular free scripts for InDesign, preptext.jsx, was written by our own InDesignSecrets contributor Theunis DeJong, aka “Jongware.” Preptext.jsx applies character styles to text with local formatting (bolds, italics, superscripts, and a few others) so you can retain the formatting when you apply your own paragraph styles or when you export to EPUB. The problem is that preptext.jsx sometimes does too good of a job, creating and applying character styles to every instance of bold (or italic, or all-small caps, etc.) text, even if it’s not locally formatted; that is, even if the formatting is part of the paragraph style applied to the text. PerfectPrepText.jsx deconstructs the story temporarily; first removing (he calls it “neutralizing”) the paragraph styles, then runs preptext.jsx (you need to have the preptext.jsx script at the same level as Peter’s somewhere in your InDesign scripts folder), then reasserts the original paragraph styles. The script requires PrepText.jsx (CS4+) at the same level.


This is a plug-in from David Blatner and DTP Tools that costs $59. If you need more oomph, PowerStyles does the same intelligent creation/application of character styles to locally formatted text as PerfectPrepText, plus it has many other useful text styling features. If you haven’t checked out the free trial yet, you really should.

Creates styles based on local formatting and applies to text or objects.

The following styles can be created automatically

  • Basic Character styles (bold, italic and underline)
  • Character Styles
  • Paragraph Styles
  • Object styles


For InDesign CS4 and CS5, this script to “literally” apply character styles to Nested, GREP, & Line styles, otherwise this formatting is ignored on export.

This script (requested by David Blatner) directly applies nested styles. It works on nested, GREP, and line styles. Warning: this script will override any manually applied character styles which conflict with the nested styles!

FindChangeByList (already installed in Scripts panel) can be used to quickly clean up a manuscript for EPUB export.


This is an easy to use panel by Automatication that sells for  $39.

Multi-Find/Change (MFC) is a scripted plug-in for Adobe InDesign and InCopy (CS4/CS5.x/CS6) to manage and execute batches of saved Find/Change queries. MFC is the ideal tool for those who rely (or want to rely) on Find/Change queries to correct and/or format text.


For CS5.5+, this script will automatically apply an ALT tag to images based on their XMP metadata description.

InDesign CS5.5’s new Object Export Options (found in the Object menu) is a treasure trove of features. One of these is the ability to override InDesign’s default tendency to use an image’s name as its ALT tag, and instead use custom information you’ve entered for the image’s XMP metadata, when you export the document to EPUB or HTML. This script lets the user apply the XMP Description metadata to all the images in the active document at once. It also has the ability to choose other kinds of XMP metadata, a way to prevent it from overwriting existing custom ALT tags, and a dialog box at the end that shows a count of how many images it worked on.


For CS5+, this script creates text frame positioning CSS when making Fixed-Layout EPUBs.

The script will create a dummy, non-printing text frame on the pasteboard and fill it with CSS info reflecting the positioning of all the frames on the document pages. You can then copy-paste the CSS info from the InDesign document into your CSS file.

A newer version is now available named ePubCrawler.jsx. It allows you to create the CSS with percentages instead of pixels.


For CS4+, this script allows you to rename placed links using their page number in a Fixed-Layout EPUB.



If you are on a Mac, you can also use Applescripts to automate for some convenient EPUB work.

EPUB Zip/Unzip

to extract and recompress EPUB component files on the Mac instead of using Terminal • These Applescripts were written by Paul Durrant and tweaked by Dan Rodney. You can read the full forum thread on its development at, “ePub Zip for Mac OS X.”

ePub Check1.2 and ePubCheck_3

These are scripts that all you to validate EPUB2.01 and EPUB3.0 files on the Mac OS desktop.

Loading InDesign Scripts

If you are using InDesign, you really should become familiar with the power of InDesign Scripts. The scripts are written in JavaScript (thus the .jsx extension). They are easy to load once you understand how.

  1. Download the script to your computer (make sure to put it in a location that is easy to find).
  2. The scripts are usually downloaded as .zip files, so your will need to open the file and Extract the .jsx file.
  3. Copy the file into the Adobe InDesign Script Panel folder. This folder should be in the InDesign application file. I have InDesign on a PC, and the path to the folder on my laptop is Local Disk (C:) > Program Files (x86) > Adobe > Adobe InDesign CS5.5 > Scripts > Scripts Panel.
  4. Once you have saved the script to the Scripts Panel folder, you access the script in InDesign through the Window menu. Click on Window > Utilities > Scripts > and the Scripts panel will appear.
  5. On the Scripts panel under the Scripts tab there is a folder named Application. Open this folder and the script you added should be visible.
Scripts menu in InDesign CS5.5

Scripts menu in InDesign CS5.5


  1. Double-click the file to run the script on an open InDesign file.


Scripts panel in InDesign CS5.5

Scripts panel in InDesign CS5.5


Do you run other InDesign scripts when creating ePUBs from InDesign? Which ones? Are there other InDesign scripts you use on a regular basis?

8 Responses to “EPUB InDesign Scripts”

  1. Thank you Matthew! I kept meaning to write this up myself but it got away from me.

    I just demo’d a bunch of them at the recent InDesignSecrets Live! 2-day seminar here in NYC, nascent and journeyman-level epub production people were blown away. Thank you for creating one single page I can keep referring people to!

  2. Hi Matthew,

    Great stuff!

    I’ve gotten round to write a manual page for ePubCrawler. The link you mentioned in your post is temporary – it’s linking into my public DropBox folder. This page will be the ‘permanent’ location for downloads of ePubCrawler (version 0.0.4 is now out):




  3. Matthew says:

    I have updated the link for the ePubCrawler download. Thanks for letting us know.

  4. Studio C1C4 says:

    Great stuff!
    Great site.
    Thanks a lot.

  5. RM says:

    Can anyone Please provide TextToNewLayer.jsx?

  6. […] 42 A list of useful scripts for InDesign to EPUB conversion is available at http://epubsecrets.com/epub-indesign-scripts.php. […]

  7. Samir says:

    Algirht alright alright that’s exactly what I needed!