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, and to downsave documents to previous versions of InDesign (see Downsaving to earlier InDesign versions).

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 also convert the currently open documents. If any documents are open, "Input folder", "Include subfolders", and the source formats can't be selected.

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).

PDF export options/presets

PDF is the only export format that uses presets; a preset can be selected in the bottom panel. 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.

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.

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

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