Using InCopy for InDesign EPubs

Setting Up the InCopy Document

If your editorial staff has access to InCopy you can set up a seamless workflow for integrating text and graphics into your InDesign documents for ePub.

In contrast to working with InCopy Assignments, this workflow starts on the editorial side. It is ideal for content that is text-heavy and where length of the story is not critical.

To make the process seamless, provide your InCopy users with the same stylesheet that will be used with the final InDesign document. This stylesheet will have paragraph styles “chained” using the next style property for each style involved in styling contiguous paragraphs. This way the user only needs to select the style for the first style in the “chain” and type in the text for the paragraphs. With each paragraph return, styling changes to that defined as the next style in the “chain.”

To make your InCopy users happy, you may want to provide them with a script similar to our sample script InCopySetupWDialog. When this script is run, the user enters the headline, author, and story length in the custom dialog presented. Dropdowns allow for the choice of document preset, stylesheet, column width, and story length.

When the user dismisses the dialog, the script creates the document complete with the styled headline and byline, and placeholder text.

All this is made possible as names for the headline and byline paragraph styles are consistent with those expected by the script. Placeholder text is defined in the label value for each of the other paragraph styles. The first paragraph style for the stylesheet is a single paragraph style in a style group named ProjectStyle. You can see how this comes together in the following code taken from the getChainStylelist AppleScript handler and function of the same name for ExtendScript.

AppleScript

tell application "Adobe InCopy CC"
   set chainstyleList to {}
   set hasNext to false
   tell document 1
      --get the paragraph style group for the first style group
      set baseStyleGroup to paragraph style group "ProjectStyle"
      tell baseStyleGroup
         --get the first paragraph style
         set allStyles to (all paragraph styles) as list
         set thisStyle to item 1 of allStyles
         --add it to the list and check for next style property
         set end of chainstyleList to thisStyle
         if next style of thisStyle is not "[No Paragraph Style]" then
            set hasNext to true
         end if
      end tell
      --with each next style, check to see if it has a next style
      repeat while hasNext is true
         set nextStyle to next style of thisStyle
         if next style of thisStyle is not "[No Paragraph Style]" then
            --make sure that the next style is not set for same style					
            set nextName to name of next style of thisStyle
            if nextName is not equal to name of thisStyle then
               set end of chainstyleList to nextStyle
            else
               set hasNext to false
            end if
         else
            set hasNext to false
         end if
         set thisStyle to nextStyle
      end repeat
   end tell
end tell

ExtendScript

var chainArr = [];
    var hasNext = false;
    var thisStyle, nextParaStyle;
    var baseStyle = docRef.paragraphStyleGroups.itemByName("ProjectStyle");
    var allStyles = baseStyle.allParagraphStyles;
    thisStyle = allStyles[0];
    chainArr.push(thisStyle);
    if (thisStyle.nextStyle != "[No Paragraph Style]") {
        hasNext = true;
    }
    while (hasNext == true) {
        var nextParaStyle = thisStyle.nextStyle;
        if (thisStyle.nextStyle != "[No Paragraph Style]") {
            var nextName = thisStyle.nextStyle.name;
            if (nextName != thisStyle.name) {
                chainArr.push(nextParaStyle);
            } else {
                hasNext = false;
             }
         } else {
             hasNext = false;
         }
     thisStyle = nextParaStyle;
 }

Importing Images

For placing images, may we suggest a script similar to our sample AnchorCenterWCap_IC script. This script is very similar to the AnchorCenterWCap script introduced in an earlier blog. It places the image chosen at the active insertion point. If the description field for the image’s metadata is not empty, the caption is created using this information. It expects a paragraph style named Caption for styling the text.

Save InCopy File

When the story is complete, the InCopy user saves the file to the folder for the project. The InDesign user can then import the story using the PlaceTextFile script introduced in the blog dated August 27.

On Your Own

Create a sample InDesign stylesheet or two for importing styles into your InCopy documents. Place the stylesheets in a folder named Styles in the Presets folder for InCopy. Note that these are InDesign documents (.indd extension). Also, make sure you have at least one document preset set up for InCopy to use for creating the document structure for your files. Watch for our InCopyForEPub scripts folder on our AppleScript and ExtendScript pages. You can use these scripts as an example of how to create your own script to fit your unique way of working.