Batch-process (convert/export) documents

The script (batch) processes files. It can be used to export InDesign documents to PDF and other formats, to convert QuarkExpress and PageMaker documents to InDesign, to update large numbers of InDesign documents to the latest InDesign version, to downsave documents to previous versions of InDesign (see Downsaving to earlier InDesign versions), and to place Word (and rtf) files either in a single InDesign document or in separate documents.

In addition to converting documents, the script can be used to run another script against all selected documents. Thus, if you select InDesign as the source and the target format, the documents aren't converted, you just run the specified script against all documents. (That script can be JavaScript, compiled AppleScript, or Visual Basic.)


With no documents open, the script displays the dialog shown in the screen shot. At Input folder you enter the location of the files that you want to process; to browse to a folder, click the folder icon. To type a folder name, use the platform-neutral format (/d/test) or any of the platform-specific forms (d:\\test on Windows; note the doubled backslashes). The ten last-used folders are shown in the dropdown.

batch convert and process InDesign PDF INX HTML SWF EPS IDML PageMaker Quark Express Package

After selecting the input folder, its name is entered at Output folder but you can change that either by selecting a folder using the folder icon or by typing its name. To overwrite existing files, tick Overwrite existing files. If you choose not to overwrite existing files, the script adds number suffixes to file names.

Tick Include subfolders to process all subfolders of the selected folder. To keep the converted files in the same folder as the source files, leave the Output folder field empty. If you do specify an output folder and include subfolders, all files are placed together in that output folder.

Tick Ignore errors to ignore errors such as missing fonts and missing links and links that are out-of-date.

Select the source and destination formats in the Source and Target dropdowns. Available options in the source dropdown are InDesign, InDesign (template), INX (CS3 and later), IDML (CS4 and later), PageMaker (up to CC: CS6 is the last InDesign version that supports opening PageMaker files), and QuarkExpress. The output formats are InDesign, InDesign (template), INX (CS3 and 4), IDML (CS4 and later), PDF, interactive PDF, EPS, RTF, XML, JPG, PNG (from CS6), HTML (from CS5.5), packaging (from CS5), and SWF (CC).

Instead of choosing a folder to select files to convert, you can convert any open documents. If any documents are open, 'Input folder', 'Include subfolders', and the source formats can't be selected.

PDF export options/presets

PDF is the only export format that uses presets; presets can be selected in the PDF preset list box. All other formats (except HTML, see next section) use the current application settings. If, for instance, you want to set the export options for any format other than PDF (such as JPG or PNG, but also interactive PDF), open a document, export to the desired format and specify all export options. Close the document. The application is now primed for your settings.

You can specify more than one PDF preset for export to PDF. For example, in the screenshot, above, four presets are selected: _print, archive, and _web. When you select a preset whose name starts with the underscore character, a PDF is created using that preset and the preset's name is added to the output document's name. If the preset name's first character is not an underscore, the preset's name is not added. Thus, if a document named test.indd is exported using the presets shown in the screenshot, these three PDFs will be created: test.pdf, test_print.pdf, and test_web.pdf. In this example, test.pdf was exported using the archive preset: the preset's name was not added because its name doesn't start with an underscore.

Export InDesign documents to PDF as separate pages

The script exports each document page as a separate PDF. The names of PDF files are constructed by combining the InDesign document's name and the number of each page as it appears on the page.

View PDFs after exporting

This performs the same function as the one in InDesign's PDF export dialog: it opens all exported PDFs. This is not a good idea when you export large numbers of documents, but the option lets you override the preset.

Preserve folder structure when packaging

Checked: The folder structure of the selected input folder is duplicated under the selected output folder, so that each packaged document is in its own subfolder. This mimics InDesign's behaviour: a folder is created for each file and named after the InDesign file; the InDesign file is placed in that folder together with the PDF and IDML files (if their inclusion was selected), and if fonts and/or links are included, a subfolder is created for each. Unchecked: All documents are packaged to the same folder (and all links to the same Links folder, and all fonts to the same Document Fonts folder).

The PDF export part of packaging is sensitive to the PDF export presets you select in the PDF panel.

Include JPEG/PNG

To set the export properties of these two formats, prime InDesign: open a document and export it to JPEG and or PNG using the settings you want for all documents. Now when you run the batch processor, the script will use the export properties you applied.

Word and RTF files

Word (both doc and docx) and RTF files can be placed in one or more InDesign documents. Select InDesign as the target format to convert each Word file to a separate InDesign document. To combine all Word documents in a single InDesign document, choose InDesign single document as the target format.

When you place all Word files in a single InDesign document, the files are placed in alphabetical order. File names are printed at the beginning of each Word text so that it's easy to find the beginning of the Word texts. File names are placed between strings of ampersands, as in &&&test.docx&&&.

HTML export options/presets

InDesign doesn't support HTML export presets, but the script can use presets you create yourself. See Creating HTML presets, below.

If you do want to use each document's own HTML export properties, select [None] in the dropdown.

View HTMLs after export

Viewing tons of HTML files slows the script down to a crawl. Whether the exported HTML should be displayed in a browser after export is a setting in the export dialog. Here you can override that setting.

Convert text to outlines

This option is available only if you export to EPS.

Close open documents

This option is available only if any documents were open when you started the script.

Run a script

You can choose to run a script during the export or conversion; this script can be JavaScript, compiled AppleScript, or Visual Basic. The script runs on every document you export. The script you want to run must be in the same folder as the folder where the batch converter is run from.

If you choose InDesign as both source and target format and select a script, you can in effect use the batch processor as a batch script runner.

Important: Make sure that variables and functions defined in your script do not clash with variables and functions in the batch processor. The best way to do this is to place your script in a so-called anonymous function and declare all variables, as follows:

(function () {
   myDoc = app.activeDocument;  	// wrong (undeclared variable myDoc)
   var myDoc = app.activeDocument;	// correct
   // more code

In line 2, myDoc is not declared as a variable and can interfere with a variable of the same name in the batch processor (if it had one). In line 3, myDoc is declared as a variable by adding the word var before it, restricting the scope of myDoc to this particular function. I don't know if this is relevant for AppleScripts and VB scripts.

See Colin Flashman's post on InDesign Secrets for some interesting examples.

Save documents on closing

Check this box if you're running a script during the conversion or export and want to save the changes the script made.

Batch processor preset

The current window's settings are always stored when you press OK to start the script. The file is called batch_convert.txt and lives in your script folder and is read when next you run the script.

In addition, you can save certain window layouts in presets. These presets are not saved automatically, you must do that yourself, using the familiar icon to the right of the dropdown. The next time you run the script, the last-used preset is selected. Presets are stored in your script folder using the file extension batch_preset.

Creating HTML presets

HTML export properties are properties of a document, not, as most other export properties, of the application. Therefore, if you want to batch-export documents to HTML, you have to create your own preset.

InDesign doesn't support HTML export presets, but the script can use presets that you create yourself in a format that the script recognises. Creating those presets is very simple. Before you run the batch processor, do as follows:

  1. Start a new document.
  2. Open the HTML Export dialog and set all options. There's no need to view the HTML after exporting, so you can disable this function in the General tab of the export options. Click OK to export the document so that the export options are set in the document.
  3. Run the script html_save_preset.jsx, which is included in the download. In the script's dialog, enter the name for the preset and click OK:
    Create HTML preset
    If you enter a name that's already in use, the script asks you if you want to replace the preset with that name. This script is a bit cludgy in that if you answer 'No', the script terminates and you'll need to start it again.
  4. You can now delete the HTML file that you exported in step 2.

HTML presets are stored in your scripts folder and use the file type html_preset. They are plain text files.


If the script won't run, please delete the file batch_convert.txt, which lives in the script's folder. (This file is used to store the dialog's settings.) To delete it, open the Scripts panel and make sure that the Display Unsupported File option is checked. Then look for the file in the list; see the screenshot:

remove a script file

Downsaving to earlier InDesign versions

You can downsave documents to a previous version via one or both of the interchange formats INX and IDML. The success of downsaving is variable, it depends on the features present in a document. Features introduced in, say, CS5 naturally do not survive when you save a document down to an earlier version.

Before you downsave, consider the Indesign versions. Often it will be a multi-step operation because of a change in the interchange format.

CS3: reads and writes INX

CS4: reads and writes INX and IDML

CS5 and later: read INX, read and write IDML

If you want to downsave, say, CS6 to CS3, you need to export the CS6 file to IDML, then open CS4 and convert IDML to INX.

From CS6, InDesign natively supports downsaving.

Version history

4 Sept. 2016: Added inclusion of JPEG and PNG as an option in packaging.

4 Sept. 2016: Fixed a problem with restoring the dialog settings from the previous session.

4 Sept. 2016: When you select Word as the source type, the target list now includes the item 'InDesign single document'. Therefore it's now possible to convert each Word (or rtf) file to a separate Indesign file, or place them all in a single InDesign document.

21 Aug. 2016: The PDF preset dropdown is now a multi-select list box. This means that it's now possible to produce several PDFs from a single InDesign document using multiple PDF presets. See PDF presets for details.

21 Aug. 2016: Added 'Word' as a source format. You can now convert folderfuls of rtf, doc, and docx files to InDesign. Each Word file is converted to a separate InDesign file.

19 Oct. 2015: PageMaker support was dropped in InDesign CC, so from CC the PageMaker option doesn't appear in the Source dropdown.

11 Sept. 2015: Added a cautionary note on running scripts inside the batch processor (the script is unchanged). See here.

23 July 2015: 'Run a script' now supports AppleScript and Visual Basic scripts in addition to JavaScripts. AppleScripts must be compiled to .scpt files.

25 March 2015: Single-page PDFs were exported to the wrong folder – fixed.

24 March 2015: Added single-page export for PDF.

10 Feb. 2015: There was a problem displaying the names of some files. Fixed by replacing the message window with a progress bar.

15 Oct. 2014: Fixed the behaviour of the 'Preserve folder structure' option; see the text for details.

12 Oct. 2014: Added various packaging options.

12 Sept. 2014: The script now ignores folders and files whose names start with a dot.

28 November 2013: (1) Added a checkbox so you can choose to overwrite existing files. If the box is not ticked, numbered suffixes are added to file names. (2) Added presets, so now you can store and retrieve different window configurations.

10 August 2013: INX files can be read by all InDesign versions, not just up to CS4. Fixed.

5 July 2013: Added support for SWF export (introduced in CC).

24 March 2013: Added support for HTML export presets; see Creating HTML presets.

14 February 2013: There were reports of problems with exporting to EPS/Convert to outlines enabled. Fixed.

27 November 2012: (1) Added interactive PDF as an export format. (2) Added the option to disable the tooltips.

22 November 2012: Added the option to preserve folder structure when packaging documents. See the text for details.

20 November 2012: CS4 appears not to like the dropdown for the folders. For CS4 the script therefore reverts to the last used folder only. In later CS versions and in CC the dropdown works fine.

9 November 2012: (1) Added tooltips to several dialog items to clarify their purpose. (2) The Input folder field now incorporates a dropdown with the last ten folders used. The output folder continues to display only the last-used folder.

27 June 2012: Added HTML (available from CS5.5).

23 April 2012: Added PNG as an export format (from CS6).

20 February 2012: Fixed a bug that caused an undefined error.

1 November 2011: Rewrote the interface. Documents can now be saved after running a script.

31 October 2011: Added an option to run a script before a file is exported or converted. See text for details.

25 January 2011: Fixed problem with error reporting.

13 January 2011: Added QuarkXPress as a source document type.

1 January 2011: Added packaging.

29 December 2010: Fixed problem with unrecognised format error; PDF View preference wasn't restored: fixed.

2 December 2010: PageMaker conversion now recognises the PMD, PM6, and P65 file extensions: pick PageMaker and all files with any of these extensions are converted.

30 November 2010: added PageMaker conversion.

Sometime in 2003: First posted.

Useful script? Saved you lots of time?

Consider making a donation. To make a donation, please press the button below. This is Paypal's payment system; you don't need a Paypal account to use it: you can use several types/brands of credit and debit card.

Peter Kahrel's paypal account

Download script

Back to script index

Installing and running scripts

Questions, comments? Get in touch