Summary
If you are optimizing InDesign documents to create publications, whether as interactive PDF or eBook (ePUB) format, follow these best practices.
If you want to optimize InDesign documents to create accessible electronic publications, whether as interactive PDF or e-book (ePUB) format, please follow these good practices.
When exporting an electronic publication from InDesign, we will always get dirty code to be corrected later in Adobe Acrobat Pro (PDF/UA) or with Sigil (ePUB). If we don’t check and clean up the source document, a large amount of extra code will be generated. Solving this can take hours of correction.
Already, InDesign and virtually any application generates extra and unnecessary code when exporting. The key is to reduce this extra code, with the help of our human intervention.
In this article we will share some steps to optimize InDesign documents, and solve topics that are basic and indispensable for exporting any type of publication. With these topics, we will be covering those that go beyond an electronic publication, since they are also used for printed versions.
Stages
- Multiple Spaces
- Multiple Returns
- Style Overrides
- Objects on the Pasteboard
- Unused Styles
- Unused Color Swatches
1. Multiple Spaces
Virtually all texts sent by customers have multiple spaces. This affects not only the exported code, but also the reading process carried out by a screen reader such as NVDA , JAWS or VoiceOver.
The most common thing is to find double spaces, but there are also triple, quadruple spaces, etc. Some editors and writers usually use the spaces to align text or simply space the content.
What’s wrong with leaving these spaces in the InDesign document? In the case of an accessible PDF, it will slightly change the reading process by any assistive technology. In the case of an e-book in ePUB format, they will be replaced by a single space and the publication will be perceived with some visual differences with respect to the source file.
How can we erase these extra spaces? Manually, by going through the document and using the cursor next to the delete key. Better yet, we can use the Find/Change menu command, selecting a Query to apply to the entire document. And finally, we can use the script called Cleaning Up Text Imported Into InDesign to clean them in just two clicks.

2. Multiple Returns
Another bad habit that some publishers and even many designers have, is to use multiple returns. Commonly, they usually use them to leave spaces between paragraphs, make a text skip an image frame or table, etc. Wrong!
InDesign allows, from its first version, to add space from the paragraph style options, and also add distances so that the text wraps the image and text frames.
What’s wrong with leaving these extra returns in the document? For the case of an accessible PDF, it will generate empty tags and change the screen reader behavior and even the navigation of the tags. It will also throw errors in the accessibility check that will need to be remediated with Acrobat. In the case of an ePUB, it will export a number of empty tags to be removed with Sigil or any e-book editor.

How do we eliminate these common multiple returns? Like spaces, we can delete them through a combination of steps since we are going to have to adjust some objects as we delete empty returns. For this, it is key to have a reference PDF or duplicate the InDesign document before starting this stage.
To delete them, we will use the Find/Change menu command, selecting a Query to apply to the entire document. If we want to apply it to the entire document in two clicks, we will use the already mentioned script Cleaning Up Text Imported Into InDesign.
3. Style Overrides
Styles allow us to achieve consistency in the format of texts, facilitate global editing and take advantage of certain functions such as tables of contents, cross-references, alphabetical indexes, etc. But the moment we start making modifications to the text instead of modifying the style options, overrides will be generated.
The Paragraph Styles and Character Styles panels has a button in the upper right that highlights where those overrides are located page by page. It is an indispensable option that many of us would like to have available in other applications such as Apple Pages, Google Docs, etc.

What is the drawback of generating overrides when exporting? In an accessible PDF, a large number of tags <Span>
will be generated, which it is then recommended to remove manually from within Acrobat. In the case of an exported ePUB, <span>
tags will also be generated, which we will then have to clean for code optimization.
If we want to know the number of overrides, we need to create a custom Preflight profile to tell us which pages they are on, how many characters are affected, etc.
To remove the overrides, we will have to generate new styles or simply remove them with the lower override cleaning button. We can also use a script called Clear Overrides Throughout Document, but keep in mind that it will change the appearance of the whole document.
4. Objects on the Pasteboard
It is quite common for some designers to generate or leave frames and other objects outside the pages of the document. This space is called Pasteboard.
What is the problem when exporting? If you use the Preflight panel, the objects or frames that are on the Pasteboard will be taken into account and can throw false positives. Also, the export will take longer and even warnings and errors can be generated in InDesign at the end of its export.

If the InDesign document is in its final version, there are no excuses to leave objects on the Pasteboard.
How do we delete them? Selecting them with the Selection tool and then deleting them with the Delete key.
5. Unused Styles
Once the InDesign document is finished or almost ready, it is recommended to remove the unused styles. By styles we mean styles of paragraph, character, object, cell, tables, etc.
It is advisable to avoid accents, eñes, special characters in style names, to avoid errors in accessible PDF and ePUB formats. They can be changed manually or through a script called Rename Styles that with just two clicks, changes the name of styles and samples of the entire document in seconds.
How do you remove unused styles? From the styles panel, choose the Select All Unused command. Then, click on the trash in the panel to delete them.
6. Unused Color Swatches
Exactly the same goes for the Swatches color panel. All unused swatches in the document can be deleted in the same way, with the Select All Unused command. Then click on the trash in the same Swatches panel.
This helps simplify each of the panels leaving only what is used, and also confirm the names of styles and samples for compatibility at the time of export.
Conclusion
The easiest thing will always be to leave everything uncleaned, dirty and unoptimizing. But with a few minutes you can save hours of subsequent corrections. The aforementioned scripts help automate these stages in any design and optimize InDesign documents.
Request a quote
If you want a quote to convert your files into accessible PDF format and/or accessible ePUB, complete the quote request form or send your files along with an explanation of what you need.
Icon: Basith Ibrahim. Photography: Jon Tyson.