Export Named Pages

Script for Adobe InDesign
Latest update 11/11/2023, version 8.4

The script determines file names for each page from the content, and exports images or PDFs. The result is uniquely named files of each page.

  • Name by paragraph style or character style
  • Name by image, stacking order or object style
  • Prefix and suffix using variable placeholders
  • Export JPG, PDF (interactive or print), or PNG
  • Save and restore all settings
  • User-configurable localization

Single-user perpetual license
Pay once, no subscription,
use forever

How-to Videos

NOTE: after video production, features have been added in response to user feedback: new variables for incremental letters; variables for image incremental numbers and letters; “images” includes all placed graphics, not only raster images, so now includes vector graphics as well; variables for parent page name and parent page incremental numbers; remove diacritics; include images on parent page; export interactive PDF; PDFs export single page or in groups of any number; include output folder in saved settings; recent folder output list and set default; output spreads; option Alert when done; PDF interactive option Create Acrobat Layers; recent folders options remove and clear all; prefix and suffix allow slash path separator to create subfolders. See instructions below for details.

How to use the script

The interface has five sections: Name from content, Prefix/Suffix, Options, Output, and Settings. Set the desired options and click the OK button to begin. A progress bar is displayed as pages are exported.

Section 1: Name from content

Enable the checkbox to name pages based on content found on each page. Then choose one of the methods:

Paragraph style — for each page, the first line of the first paragraph found on the page that is assigned the selected paragraph style is used to name the exported page.

Character style — for each page, the first instance of text found on the page that is assigned the selected character style is used to name the exported page.

Object style — for each page, the first image found on the page that is assigned the selected object style uses the image file name without extension to name the exported page.

Image name — the file name without extension of the first image found on the page is used to name the exported page. As of version 5.6, “images” includes all placed graphics, not only raster images, so now includes vector graphics as well. In the remaining instructions and interface options, the term “images” refers to placed graphics.

Text link name — placed text that retains a link to the source file (Word, Excel, etc.) uses the source file’s name without extension to name the exported page.

In all cases, “first” refers to the order elements are arranged, first being the highest element in the overall stacking order. This also takes into account layer order. The highest in stacking order, on the highest layer, is considered “first.” Use the option Reverse search (below) to instead search from lowest to highest in stacking order.

Include images on parent page — when enabled, the script also searches for images on the parent page assigned to each page. The stacking order of images found on the parent page is considered below the lowest layer. If parent page images take precedence over images placed on the actual page, use the option below to reverse search order so that lowest are first. Care must be taken when using images on parent pages. Typically a parent page is used for multiple pages, in which case pages would not have unique names and overwrite prior pages. When naming by image on a parent page, either use unique parents for each page, or use other options to ensure each page has a unique name (add page number in suffix, for example).

Reverse search: match lowest element instead of highest — the elements to search through are reversed before searching, so that “first” to match becomes the lowest in stacking order rather than the highest.

Examples of how to use methods

Suppose you have a document of multiple real estate agents and properties for sale. Assuming each page has a photo of the agent, and the image file name is the agent’s name, use the image name method, and each exported page is the agent’s name. If pages have more images than one, arrange as needed to make the desired image either the first or last in the stacking order, and set the options to match. Or perhaps the output name should be the property. Assuming there’s a photo of the property named as desired, use the image name method. Or the same example could use the paragraph style method, if the formatting of the agent or property is unique from other formatting on the page. If not unique, still a character style could be created and assigned. The character style doesn’t have to alter anything about the formatting—it just has exist and be assigned so it may be selected for the naming method, in which case the precise text assigned the style becomes the file name of the exported page.

Section 2: Prefix/Suffix

A prefix and/or suffix may be used in combination with Name from content, or if disabled, the file name of each exported page is strictly the prefix and suffix combined. In this case, ensure variables are used that equate to a unique name for each page, otherwise risk overwriting exported pages during output.

When creating file names from page content, characters illegal in file names are removed. The inputs for Prefix and Suffix also do not allow characters illegal in file names, with one exception: a forward slash. Either prefix or suffix may include the forward slash path separator to create output in subfolders. For example, a prefix "^W/" results in subfolders the page width, into which pages the same width are saved. Or use in the suffix, making the subfolder named by prefix variables and page content, and the file name any variables or static text following the slash. For example, a suffix "/filename" results in all files the same name saved into unique subfolders (provided page content or other variables precede the slash). Other combinations of slash in prefix and suffix can create multiple unique subfolders, each containing a unique file name. The backslash character is not allowed and is unnecessary. Forward slash works as path separator both macOS and Windows.

In each input, enter the desired prefix and suffix. To the right of each input are buttons that open another window with the prefix and suffix inputs repeated, plus a list of variables that may be added to either input.

Button to add variables
Add variables window

^F — the document file name without extension.

^O — the name of the folder where the document is located.

^+ — the absolute page number in the sequence of all pages, without regard for sections and section numbering.

^[] — searches the page for text assigned the character style name that appears within the braces. This allows combining matches to text assigned a paragraph style to one or more instances of text assigned specific character styles. The page is searched for text assigned the character style starting from the highest element and moving down the overall stacking order. The variable resolves to the first instance found or is ignored if no instance of text matching the character style is found. The search also honors the option Reverse search to search starting from the lowest element and moving up the stacking order instead. See the section Name from content (above) for more details.

^# — begins at 1 and increments every page exported.

^@ — begins at 'a' and increments every page exported. Carries after 'z'. For example, a, b, c... aa, ab, ac... etc.

^W — width of the page.

^H — height of the page.

Page width and height can vary for documents with alternate layouts or parent pages of different sizes. These variables insert the size of each page exported, rather than the size defined by Document Setup.

^U — the page size measurement unit, set below.

^X — the page size scale, set below.

^P — page number as InDesign normally labels pages. For simple documents of a single section, the result is identical to the absolute page number. For documents with sections or alternate layouts, this value is a combination of section prefix, alternate layout name, and page number as it appears in the layout.

^S — a combination of section number, an underscore, and the page number within the section. Rather than section prefix, the value is a number, the section’s place in the sequence of sections. Similarly, rather than the absolute page number, the page number is its place in the sequence of pages within the section. In most cases this matches the page number as it appears in the layout.

^I# — for each image used to name a page, begins at 1 and increments each time another page is exported using the same image to name the page.

^I@ — for each image used to name a page, begins at 'a' and increments each time another page is exported using the same image to name the page. Carries after 'z'. For example, a, b, c... aa, ab, ac... etc.

^M — name of parent page assigned to the page, without prefix (A-, B-, etc.).

^M# — for each parent page, begins at 1 and increments each time a page assigned the parent page is exported.

^M@ — for each parent page, begins at 'a' and increments each time a page assigned the parent page is exported. Carries after 'z'. For example, a, b, c... aa, ab, ac... etc.

^D — date as year (four digits), month, and day.

^d — date as year (two digits), month, and day.

^T — time as hours, minutes, and seconds.

^t — time as hours and minutes.

Date and time are calculated when exporting begins so that all pages share the same value, rather than the increasing value of the precise moment each page is exported.

The remainder of the window are options related to the variables.

Page size measurement units — applies to the variables ^W and ^H. And for the variable ^U, the matching abbreviation (in, mm, pt, etc.) is inserted.

Page size scale — for documents not built to actual size. The value entered is a multiplier that alters the result of the variables ^W and ^H.

Numbering minimum digits — for the variables ^+, ^#, ^P, ^I#, ^M#, and ^S, the result is padded with zeros to become at least this number of digits.

Date and time separators — enter a character or characters to appear between year, month, and day of date variables, and hour, minute, and seconds of time variables. Or leave either blank for none. Characters entered must be legal to use in file names.

Section 3: Options

Periods — when enabled, periods within the file name are either removed, converted to a dash, or converted to an underscore. This does not include the period before the extension, which is never removed or replaced.

Spaces — when enabled, spaces within the file name are either removed, converted to a dash, or converted to an underscore.

Letter case — when enabled, the file name is converted to either all lowercase or all uppercase.

Remove diacritics — characters with diacritics, such as accents, are converted to the equivalent basic glyph.

Alert when done — enable and when processing is complete, the alert “Done” is displayed. Disable and the alert does not appear.

Section 4: Output

Folder — the folder to which pages are exported. The default is the folder where the InDesign document is located. Click the button Folder to select another. To the right is a button with three dots that opens another window with more output folder options.

Output folder more options
Output folder window

Here, recent folders are listed. Click to select any in the list, and it becomes the output folder.

To remove a folder, click to select it, then click the button Remove. To remove all folders in the list, click the button Clear all. Removal occurs only if the OK button is clicked. Choose Cancel and folders removed are restored.

It’s also possible to set a folder as the default each time the script runs. Below the list is Default output folder. Click the button Set default, and choose the desired folder. Then whenever the script runs, the output folder is the same. Or leave the default (none), and it’s always where the document is located.

Pages: All or Range — controls whether to export all pages of the document, a single page, or any range or ranges of pages. For a single page or a range, the normal InDesign rules for identifying pages are recognized. Use section and/or alternate layout prefixes combined with the page number as it appears in the layout, or enter the plus sign followed by the absolute page number. Separate the first and last pages of a range with a hyphen, and separate multiple pages or page ranges with a comma.

Pages or Spreads — from the drop-down list, choose to export either Pages or Spreads. When exporting spreads, the rules of how file names are determined remain the same, but elements on either page of the spreads are considered, including stacking order, rather than only elements on a single page.

In groups of (PDF formats only) — PDF output has the option to export pages in groups of any number. Enter '1' for single page PDFs. Enter '2' for front + back in each PDF output, for example, or any other reason to group every 2 pages of the document into a single PDF. Or enter any number of pages desired to create PDFs that each contain the entered number of pages. Once the end of the document is reached, the balance of pages not yet output make up the final PDF, even if not reaching the specified number of pages. When exporting spreads, the value to group applies to spreads rather than pages. In either case, file names based on page content are determined by the first page or spread of the group, and subsequent page content is ignored.

Export PDF single or front+back

Replace existing output files — when enabled, existing output files are replaced. When disabled and a file of the same name exists, an incremental number is added to the file name to prevent overwriting the existing file.

IMPORTANT: when enabled, any pages exported that resolve to the same name as any prior page overwrites all output files of the same name. Ensure the document set up and options selected result in unique names for each page. If in doubt, disable this option and pages that conflict with pages already exported have a version number appended to prevent overwriting.

Format — the file format to which pages are exported. The available choices are JPG, PDF (Interactive), PDF (Print), and PNG. Each format offers different options described next.


Resolution — pixels per inch used to rasterize the pages.

Color Space — choose RGB, CMYK, or Gray.

Quality — choose Maximum, High, Medium, or Low.

Bleed — includes document bleed, if any.

Embed Profile — embeds the current color profile.

PDF (Interactive)

Resolution — pixels per inch for images.

Quality — image quality. Choose Maximum, High, Medium, or Low.

Layers — enable to save each InDesign layer as an Acrobat layer within the PDF.

Tagged — enable to create a tagged PDF.

Display title — choose title to display, either File name or Document title.

PDF (Print)

PDF preset — the PDF preset used to export the pages.

Export in background — when enabled, PDFs are queued to export in the background, and the script ends sooner. When disabled, each PDF page is exported immediately, and the script is active until all PDFs are exported. When exporting a great number of pages, it is best to disable this option.


Resolution — pixels per inch used to rasterize the pages.

Color Space — choose RGB or Gray.

Quality — choose Maximum, High, Medium, or Low.

Bleed — includes document bleed, if any.

Transparent — areas of the page uncolored are transparent.

A note about JPG and PNG: there isn’t an option for anti-alias because the script always enables anti-alias when exporting either image format. I couldn’t imagine a need to disable the option considering that without anti-alias, the result is horrible. But perhaps I could be wrong, and there is a need to disable it. Contact me to share other views on the subject.

Section 5: Settings

The current options may be saved and restored later. Select from the Load drop-down list to choose saved settings, and the current options are updated. Click the Delete button, and the saved settings selected in the Load drop-down list are permanently removed. Click the Save button, provide a name for the settings, and the current options are preserved. If the name already exists, the user may choose to replace the saved settings. Or click the checkbox Replace settings, and choose the settings to replace.

The script provides default saved settings named [Default]. These settings cannot be deleted but may be updated to the current values. Save settings, click the checkbox Replace settings, and choose [Default].

When settings are saved, there is also the option to include Output folder.

Export Named Pages Save settings

Each time the script is launched, the output folder defaults to the location of the InDesign document. To override the default, enable the option to include Output folder. Then when the saved settings are loaded, the output folder is restored to the value set when the settings were saved. This includes the next launch of the script, as the last settings selected are also restored.

Export Pages To Subfolders

The script Export Pages To Subfolders is now obsolete because this script has the capability to achieve the same result.

To output files the same name but different subfolders, set Name from content option to a style, or other method, that matches content on each page the desired folder name. Set Prefix to a forward slash and Suffix to a forward slash followed by the desired document name. Do not include an extension. The script adds that based on the output format chosen.

Export to subfolders example 1

Set output folder to the root folder where the subfolders are saved.

Export to subfolder example 2


By default the script language is US English, which does not require further download or configuration. To have the script interface display other languages, choose from the available languages below. Download and copy the .i18n file to the script folder alongside the script. When launched, the script detects the language file and displays interface text in that language. If your language is not listed, download the English file and translate it. The file is plain text formatted as JSON, containing interface text in English, and a second value for its translation, which for the English file is the identical text. Copy the file and rename it to replace “en” with the relevant code for your language, then edit the file to change each line’s second value to the translation in your language. For more detailed instructions of how to edit and install i18n files, see How to Localize Scripts.

English: export-named-pages-en-i18n.zip


Single-user perpetual license
Pay once, no subscription, use forever

Change log: export-named-pages.txt

For help installing scripts, see How to Install and Use Scripts in Adobe Creative Cloud Applications.

IMPORTANT: scripts are developed for the latest Adobe Creative Cloud applications. Many scripts work in CC 2018 and later, even some as far back as CS6, but may not perform as expected, or run at all, when used in versions prior to 2018. Photoshop features Select Subject and Preserve Details 2.0 definitely fail prior to CC 2018 (version 19) as the features do not exist in earlier versions. For best results use the latest versions of Adobe Creative Cloud applications.

IMPORTANT: by downloading any of the scripts on this page you agree that the software is provided without any warranty, express or implied. USE AT YOUR OWN RISK. Always make backups of important data.

IMPORTANT: fees paid for software products are the purchase of a non-exclusive license to use the software product and do not grant the purchaser any degree of ownership of the software code. Author of the intellectual property and copyright holder William Campbell retains 100% ownership of all code used in all software products regardless of the inspiration for the software product design or functionality.