Export .sam from InDesign

Follow this procedure to convert an InDesign project that uses ScML styles to a .sam (Scribe abbreviated markup) file as a preliminary step to creating an .scml file, e-book, or Word document.

This procedure is designed for typeset projects created using ScML styles and the Well-Formed Document Workflow.


Install or Update Scribe Tools for InDesign.

Upon installation, set the DTD location through the Set/Reset sam.dtd Location tool.


Prepare InDesign Document

1. Duplicate Files

Duplicate the files. Do not perform this procedure on live files. This procedure will change the INDD files in a fundamental way. Perform the entire procedure on each InDesign file individually.

2. Vet Document

a. Images or Embedded Footnotes

Note whether the file contains images or embedded footnotes.

b. PDF

Compare with the print PDF. There should be no differences caused by reflow (due to missing fonts, for example).

c. Fonts

Check that all fonts are active.

d. Master Page Items

Check for master page items that have been adjusted manually, thus becoming live content. The most common example would be a running head like “Notes to pages ##–##” in back matter. Delete such text boxes before running the tools.


Delete all running heads from master pages to avoid the possibility that they come through in the export.

e. Nested Styles

Select Scribe Tools > Styles > Review Nested Styles. If another character style has been applied on top of a nested style (for example, the i style applied to a GREP number style), resolve this prior to running the rest of the tools. This tool will not reveal text that has a combination of nested, line, or GREP styles applied simultaneously. Resolve any such style constructions prior to exporting content, either by removing the nested style completely or by removing it and reapplying it as a regular style.

This tool will make minor changes to some rarely used style properties, then reverse those changes, and will unbase character styles. Because of this, the file will appear to have unsaved changes after running the tool.

f. Conditional Text

If any text has been hidden using InDesign Conditions (other than the structure condition), the text can be rendered visible for export by the Handle Conditional Text tool.

For this to occur, use either of the following methods:

  • Prefix any condition name with “scr-unhide” (e.g., scr-unhide-sb for a conditional sidebar paragraph).
  • Create a set called “scr-unhide” in which the conditions that should be visible are set to visible.

Note: Any paragraphs using a conditional style must have an ScML style applied in order to map to the DTD during the export process.

Note: All conditions made visible within the scr-unhide set will be made visible by the Handle Conditional Text tool regardless of whether they are marked as visible or invisible before the export to sam process is run.

Export with Scribe Tools

Select Scribe Tools > Prepare for Export > Export XML > Run All - Export XML or Scribe Tools > Prepare for Export > Export XML > Run All - Export XML without Page Indicators depending on whether page numbers should be retained.

After starting “Run All,” the process cannot be stopped. As an alternative, each tool can be run individually. Each tool will ungroup styles if necessary so the remaining commands can work correctly. The tools included in the Scribe Tools Export are as follows:

1. Load DTD

Loads the sam.dtd file so that styles can be recognized and processed.

2. Accept All Changes

Accepts any tracked changes in a document. To ensure correct output, track changes should be addressed and accepted prior to running Export, but this cleans them up to avoid processing errors if they have not.

3. Ungroup Paragraph/Character Styles

Moves any styles from groups into the main style area and deletes the groups. Alerts the user if any styles appear in more than one group. Also available from the Styles Panel menus.

4. Insert Page Indicators

This tool will go backward through the document, adding an invisible InDesign note (similar to the comment feature in Microsoft Word) at the top of each text box. Any existing notes of this type will be deleted prior to processing. Retaining the page numbering in this way will make it easier to link indexes. The tool will also remove anything in the pasteboard so that unwanted content will not get included when mapping styles or anchoring images.

5. Unbase All Styles

Removes the “based on” connections between styles so that changes made to one no longer affect others.

6. Make Nested Styles Local

This tool will localize any nested styles. This will prevent nested, GREP, and line styles from being incorrectly applied as content shifts during the export process.

7. Remove Typesetter Styles

This tool will remove content composed with typesetter-only styles, including tso and rhr. Text composed using rhref character styles will be retained but the style will be removed. Text composed as rhref-i will revert to the underlying character style (i).

8. Remove Table Paragraph Style

Removes a special Hub-added paragraph style that wraps tables for typesetting purposes.

9. Anchor Items

This tool will apply the img tag to image boxes and then anchor each image and unlinked text box to its nearest logical location. Grouped boxes will be anchored as one.

10. Convert Page Indicators to Text

This tool will convert the inserted page indicator notes to literal text. Text in the document will shift, but the page indicators will mark the positions of the original page breaks.

11. Apply Page Style to Indicators

This tool will apply the page character style to the page indicators. Tops of pages will be indicated with the @ symbol. Other items on the page will have the % symbol.

12. Convert Footnotes

This tool will remove InDesign’s automated (dynamic) footnotes and place them at the end of the document. It will apply the fnref character style to the number in the main text and the fnnum character style to the number in the footnote itself.

13. Remove Auto-Generated Table Headers and Footers

This tool will remove repeating table headers and footers that were created using InDesign’s header and footer cell settings.

14. Handle Conditional Text

If conditional text has been used in the document to preserve structure information, this tool will make it visible and part of the main text flow.

This tool will render conditional text visible if the condition follows the “scr-unhide” naming convention.

15. Clean Typesetter Spaces and Breaks

This tool will remove certain discretionary break characters and replace typesetter spaces with standard spaces.

16. Map Styles to Tags

This tool will map document styles to corresponding DTD tags in the Structure pane. The tool will do the following:

  • Map by name.
  • Map styles ending in “-alt” or “-language” according to the base style name (including styles with “-alt” plus any text following that suffix).
  • Map paragraph-character style combos not found in the DTD according to the character style. (For example, figh-i will map to i.) The document must include the associated paragraph style for this mapping to occur.
  • Return a report of unmapped styles.

If anything is changed after the mapping has been done, rerun Map Styles to Tags in order to refresh the structure window. Otherwise, those changes will not apply to the exported XML.

17. Add Linking Attributes

This tool will add the “href” attribute and link information to hyperlinked text that has a url, url-b, url-bi, url-i, xref, xref-b, xref-bi, or xref-i style.

If any links are changed after this step, rerun Add Linking Attributes. Otherwise, those changes will not apply to the exported XML.

18. Export XML

This tool will export the content as InDesign XML and will save it to the same folder as the .indd file. There is nothing to be done to this XML file except to upload it to the Digital Hub for conversion to .sam. The XML file is not valid, nor can it easily be checked for problems. All text review steps should be done in the .sam file.

Convert via Digital Hub

1. Upload XML

Upload the XML file to the Digital Hub from the same machine on which the extraction was done. Extracted XML files can have issues with character encoding when moved from one type of computer to another.

2. Process to .sam

Process the XML file to create a .sam file. Download the .sam file and use it to rearrange text or remove unwanted content as needed.

Review .sam Files

Use the .sam QC Checklist to confirm the quality of the .sam file.

When done, upload the adjusted .sam file to the Digital Hub to produce a .scml file, which can then be converted to ePub or other formats.