Export Named Pages

Script for Adobe InDesign
Latest update 7/12/2021, version 3.3

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

NEW as of version 3.3: option to remove diacritics.

NEW as of version 3.1: added variables for master page name and master page incremental numbers.

NEW as of version 3.0: added prefix and suffix, each with variable placeholders, and option to disable name from content to use prefix/suffix only.

NEW as of version 2.6: options to transform periods, and for JPG and PNG output, choice to include bleed.

NEW as of version 2.3: added name by image object style.

  • Export pages each with unique name
  • Name by paragraph style or character style
  • Name by image or image object style
  • Prefix and suffix using variable placeholders
  • Export all pages, a single page, or any range or ranges of pages
  • Export JPG, PDF, or PNG
  • Export PDF using any PDF Preset
  • Save and restore all settings
  • User-configurable localization
Export Named Pages screen
Download
Export Named Pages

You decide. Reward the author an
amount the solution is worth to you.

Also see related script Export Pages To Subfolders, this script altered to instead export pages using the same file name, but each page saved to a unique subfolder that is named based on page content.

How-to Videos

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.

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 next option to instead search from lowest to highest in stacking order.

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.

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.

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

^W — width of the page.

^H — height of the page.

Page width and height can vary for documents with alternate layouts or master 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.

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

^N — for each master page, begins at 1 and increments each time a page assigned the master page is exported.

^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, ^N, and ^S, the result is padded with zeros to become at least this number of digits.

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.

Section 4: Output

Folder — the folder to which pages are exported. Default is the folder where the InDesign document is located. Click the button to select another folder.

Pages: All or Range — controls whether to export all pages of the documents, 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.

Replace existing output files — when enabled, existing output files are replaced without user intervention. When disabled, the user is prompted to confirm the replacement of each existing output file.

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

JPG

Resolution — pixels per inch used to rasterize the pages.

Color Space — choose RGB, CMYK, or Gray.

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

Embed Profile — embeds the current color profile.

Bleed — includes document bleed, if any.

PDF

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.

PNG

Resolution — pixels per inch used to rasterize the pages.

Color Space — choose RGB or Gray.

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

Transparent — areas of the page uncolored are transparent.

Bleed — includes document bleed, if any.

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

Each time processing begins, the current options are preserved, and the next time the script is launched, options are restored to the last values used.

Localization

The script provides user-configurable localization. By default the script language is US English, which does not require further download or configuration. For other languages, download the Language Pack and copy the i18n file for the desired language to the script folder alongside the script file. When launched, the script detects the i18n file and the interface displays the language. If the desired language is not present in the language pack, edit the English i18n file to translate to the desired language, and copy the edited i18n file to the script folder alongside the script file. For details of how to edit and install i18n files, read How to Localize Scripts.

Download
Export Named Pages

License details included in download

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

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