View Full Version : A workflow for generating epub files from InDesign


Man Eating Duck
01-25-2013, 11:07 AM
In a thread over at the Sigil forum (http://www.mobileread.com/forums/showpost.php?p=2394958&postcount=53) I offered to post documentation of my workflow, together with supporting files. I'll post it here since it's somewhat offtopic there, and it might be helpful for people using InDesign as part of their workflow. Note that the instructions are written for people who are comfortable with InDesign and epubs in general. They are also intended for efficient conversion in a production setting, if you make one or two epubs a year they're probably not for you. Our publications are generally academic, this means that there are some stylistic elements that usually aren't encountered in straight fiction books. There are other resources available that might fit you better.

Yes, I'm sure a number of us would find that fascinating! I'm interested that you bring calibre into the workflow at all - I've always found it adds yet another unnecessary layer of stylesheet complexity.Ok, so I just google-translated the instructions (word doc in the zip file, my Norwegian is actually somewhat better than that...). I attached all files necessary for our workflow. There are surely a lot of things that can be improved, and I'm moving out on a limb by doing this at all, but I'll just post them anyway in case they'll be useful to someone. Please go easy on me :)

Please keep a few things in mind:

* I'll try to answer specific questions about this workflow, but I don't really want to address generic epub/InDesign issues in this thread. Others on the forum are a lot more qualified than I am when it comes to generic questions.

* These instructions will almost certainly not be directly useful to anyone but us as they're customised to fit in with the rest of our production flow. There are a lot of people making epubs from indd sources, however, so some of my experiences might be applicable.

* The focus is on making "good enough" epubs that works across devices, as quickly and with as little manual intervention as possible. They are not beautiful, but they're functional. I'm capable of hand-crafting better-looking epubs, but the point is to enable me and my colleagues to easily and quickly generate a working epub from InDesign.

* This workflow has evolved over several years, through different versions of all software involved, and also through increasing skill level on my part. There are surely stale elements, and things that don't really make sense anymore.

* All style names are in Norwegian, but you'll get the gist of it by looking at the InDesign styles and formatting. I won't translate them all, but ask if you're stuck. A google translation of the css with hyphens replaced with spaces might be helpful.

* Criticism and suggestions are welcome. I do, however, suggest that we keep away from the common technical points of contention when discussing epubs, as they're adressed numerous places elsewhere in the forums.

* The zip includes a few binaries in the bin directory for convenience, these are windows-versions of common Unix utilities. They are freely available on the internet, please download your own versions if you don't trust mine (and frankly, you generally shouldn't trust arbitrary binaries provided on a forum).

* The indd and css classes grouped under "fancy" are from an one-off experimental epub with additional stylistic flourishes. It turned out very nice, but required some additional attention, and those classes are not commonly used in our flow.

* The included css file is just an example, which is intended to be easily adjusted according to customer wishes. It should however contain somewhat sane defaults.

* The workflow includes some steps to generate a mobi file from the finished epub, this is not well-tested as we seldom use it. Suggestions are welcome.

A quick summary of the workflow:

* You ideally need a ready-made final indd file for a printed version. All styles in this document are replaced with similar styles in the epub template file. Some formatting is applied, such as page breaks, normalisation of images and bylines. The template file also includes a preflight profile.

* An epub is generated from InDesign and put into calibre. Metadata are maintained and embedded in calibre with the plugin Modify Epub.

* The file is then opened in Sigil, where a few source code replacements are done, the book is splitted into chapters, and TOC is generated.

* The cmd script replaces the css with a custom one, removes font obfuscation, and replaces any existing font files in the epub file due to the fact that we've had problem with the subsetted fonts from InDesign. You can drop all fonts you use in the OEBPS\Fonts directory, only ones already present in the epub will be replaced. The reason why we sometimes embed fonts is that a lot of our books contains special characters which can't be assumed to be present in standard fonts in reading software.

* All these steps can of course be replaced by your own processes. If you try the script, however, the epub must be opened/saved in Sigil in advance, as the zip commands depend on the directory structure employed by Sigil.

* Lastly, validate the epub with Sigil, run it through epubcheck, and test it on all devices/software you have available. We haven't had specific issues, but it's wise to do a "sanity-check" on actual reading devices anyway.

JSWolf
01-26-2013, 12:07 AM
* You ideally need a ready-made final indd file for a printed version. All styles in this document are replaced with similar styles in the epub template file. Some formatting is applied, such as page breaks, normalisation of images and bylines. The template file also includes a preflight profile.

* An epub is generated from InDesign and put into calibre. No calibre conversion is done, but metadata are maintained and embedded in calibre.
u
* The file is then opened in Sigil, where a few source code replacements are done, the book is splitted into chapters, and TOC is generated.

There is a problem with this. By maintaining the metadata with Calibre, you are causing Calibre to convert the ePub in order to insert this metadata. Since you are already using Sigil, just use Sigil to manage the metadata. Then you don't get a Calibre conversion of your ePub which will change the CSS and XML.

exaltedwombat
01-26-2013, 07:32 AM
Most interesting.
Would you please edit my quote in the top message in this thread to correct my mistake where I said "Sigil" but meant "Calibre"? Thank you.

Man Eating Duck
01-26-2013, 11:55 AM
@exaltedwombat: Sure, sorry about that.

There is a problem with this. By maintaining the metadata with Calibre, you are causing Calibre to convert the ePub in order to insert this metadata. Since you are already using Sigil, just use Sigil to manage the metadata. Then you don't get a Calibre conversion of your ePub which will change the CSS and XML.I use the plugin Modify Epub (http://www.mobileread.com/forums/showthread.php?t=154371), which doesn't perform a full calibre conversion. It just updates the epub with whatever metadata is registered in calibre, and leaves it alone otherwise. It was written specifically to avoid calibre conversions.

JSWolf
01-26-2013, 08:33 PM
@exaltedwombat: Sure, sorry about that.

I use the plugin Modify Epub (http://www.mobileread.com/forums/showthread.php?t=154371), which doesn't perform a full calibre conversion. It just updates the epub with whatever metadata is registered in calibre, and leaves it alone otherwise. It was written specifically to avoid calibre conversions.

Then you need to go back and edit you original message to say that you use Modify ePub as it reads like you just use Calibre and to put in the metadata, a conversion is needed. So someone is going to read the original message and mess up their ePub.

Man Eating Duck
01-27-2013, 08:47 AM
There is a problem with this. By maintaining the metadata with Calibre, you are causing Calibre to convert the ePub in order to insert this metadata. Since you are already using Sigil, just use Sigil to manage the metadata. Then you don't get a Calibre conversion of your ePub which will change the CSS and XML.The text you quoted from my post says explicitly that no calibre conversion should take place. This is also explained in the instructions, there are even a screenshot of the options I use with the plugin. I have edited the OP to make it even clearer.