PDF Export Single Pages

JavaScript for Adobe InDesign
Latest update 9/26/2018

Export an InDesign document to single-page PDFs using a selected PDF Preset.

  • Page labels at the beginning or end of output file names
  • Absolute (document) numbering or by section
  • Set minimum digits to prefix section and page labels
  • Preview output file name before proceeding
  • Export all pages, a single page, or any range or ranges of pages
  • Export using any defined PDF Preset
  • Save and restore all settings
PDF Export Single Pages screen 1
Download
PDF Export Single Pages

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

Instructions for use

The interface has four sections: File naming, Preview, Output, and Settings. Set desired options then click OK button to begin. A progress bar is displayed as pages are exported.

Section 1: File naming

Base name — defaults to the InDesign document name minus file extension and may be revised to any value provided it is a valid file name. Do not include extension; “.pdf” is added to the base name and unique label for each page exported. For saved settings that include base name, the value from the settings is used rather than the default. Use the Reset button to restore the default.

Reset — restores base name to default (document name minus extension).

Page label at — the choice to begin the file name with the label, or end the file name with the label.

Separator — any characters to insert between the base name, the section label, and the page label. Default is a single underscore.

Numbering: Document — pages are labeled by their sequence in the document (absolute numbering). Sections and how page numbers appear in the layout are ignored. The first page of the document is always labeled 1, the second is always labeled 2, etc., until reaching the last physical page of the document. For example, “basename_001.pdf” (first page of the document).

Numbering: Sections — pages are labeled by section and page number as it appears in the layout. For example, “basename_01_001.pdf” (section 1, page 1). Section labels are not the textual prefix assigned to sections of the document, rather Arabic numerals representing their sequence in the document, beginning at Number sections starting at (see below for more details). Page labels are Arabic numerals equivalent to the page number as it appears in the layout. For example, page “8” is labeled 8, as well as page “viii” is labeled 8. When a new section begins, the section label is incremented, for example, “basename_02_001.pdf” (section 2, page 1). And so on.

Whether numbering by document or by section, the goal is to produce single-page PDFs that sort naturally in the intended order. Otherwise, when flowing pages into a prepress workflow, the operator has to manually position pages in the run list, which is prone to error. The added benefit of section numbering is that page labels match the page numbers as they appear in the layout, which also reduces confusion and the potential for error.

Minimum digits — controls how section and page labels are prefixed with zeros to become a minimum number of digits. This prevents the erroneous file sorting behavior still present in some systems, in which 10 precedes 2 because 1 precedes 2, even though 10 is greater in value. By adding a prefix of zeros, the same example instead becomes 002 and 010, which sort correctly in any file system.

Minimum digits for sections and pages may be adjusted to any value provided it is no less than the document requires. For example, if a document contains 100 pages, it is not possible to set the minimum digits for pages to less than 3. The same applies to section labels.

Include section label — when the document contains multiple sections or alternate layouts, and those sections or layouts share duplicate page numbers, a section label is required. Otherwise output of pages of the same number would overwrite each other. In this case, Include section label is forced on (checked but disabled so that it may not be unchecked). The choice to disable is available only when the document contains a single section and no alternate layouts, or all page numbers are unique.

The option to exclude a section label is useful when a project is broken into separate documents, each a single section, but each is a unique range of page numbers. Once all combined, the project becomes a continuous page range, making section labels unnecessary. In such a case, there is no harm in having a section label, but it is excess and may not be desired.

IMPORTANT: the script has no means to know if multiple documents from a single project have overlapping page ranges. Ignoring this could lead to overwriting pages that mistakenly share the same number, regardless of including a section label or not. For such a project, first ensure each document uses a unique page range that makes sense once combined — no pages with the same number, and no gaps in the page number sequence.

Number sections starting at — the number applied to the document’s initial section, which is then incremented each section that follows.

Section 2: Preview

An example output file name based on the current choices. As options change, the preview will update to show a new example. The example represents the first page of the inDesign document. The value set for pages to output, whether all or a range, is not reflected in the preview.

Section 3: Output

Folder — the folder to which PDF pages are exported. Default is the folder where the InDesign document is located, unless saved settings are loaded that include a specific output 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.

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

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.

Section 4: Settings

The current options may be saved and restored later. Select from the Load drop-down list to choose saved settings, which then updates the current options. 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.

When settings are saved, there is also the choice to include Base name and/or Output folder.

PDF Export Single Pages screeen 2

If the saved settings are for a project that always uses a particular base name and/or always outputs to a particular folder, either or both of these choices may be enabled and the values are preserved. If omitted, when the saved settings are loaded, the base name and/or output folder remain the default value.

The script provides default saved settings named [Default]. These settings cannot be deleted but may be updated to any desired values by saving settings and providing the name [Default], which then overwrites the default settings.

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. IMPORTANT NOTE: because of the script functionality to retain Base name and/or Output folder, these values from the last settings used may not be desired. To restore base name to default, click the Reset button right of the base name input field. To override the output folder, manually select the desired folder. You may also change both values by selecting other saved settings. As well, the built-in [Default] settings restores the default base name and output folder.

The functionality to save settings requires a file to store the settings, which coexists in the script folder alongside the script file itself. It has the same name as the script but a different extension, “json”. The file may or may not be visible depending on the InDesign Scripts Panel option Display unsupported files. Normally only script files are visible, but when this option is enabled in the Script Panel fly-out menu, all files are visible.

Download
PDF Export Single Pages

CHANGE LOG

Version 18.9.26

  1. Miscellaneous syntax.

Version 18.9.22

  1. Fix flaw, delete setting confirmation removes setting from UI when responding 'no.'

Version 18.8.19

  1. Add check for overset text.
  2. Add check for missing or modified links.

Version 18.7.18

  1. Miscellaneous syntax.
  2. Revise settings object.
  3. Remove obsolete function settings restoreLast.
  4. Add function configureUi.
  5. Update progress function.
  6. Wrap work in process function, wrapped in try/catch.

Version 18.5.30

  1. Retain last used base name and output folder if document name hasn't changed.

Version 18.5.15

  1. Remove close button from progress bar.
  2. Catch processing errors and alert user.

Version 18.5.7

  1. Fix [Default] not resetting output folder.

Version 18.4.29

  1. Disable delete settings button when initial [Default] settings are created and no other settings yet exist.
  2. Export PDFs synchronously instead of asynchronously because changes in OS High Sierra seriously degrade background exporting performance.
  3. Because removal of background exporting, add a progress bar.
  4. Fix unhandled exception when saved output folder no longer exists.

Version 17.10.18

  1. Add reset button to restore default base name.
  2. Create saved settings [Default] if it does not exist, and saved settings file if it does not exist.
  3. Disable delete settings button if none are selected or [Default] is selected.
  4. Allow disabling Use section label when all page numbers are unique, even when multiple sections/layouts exist.
  5. Page label minimum digits limited to number of digits of highest page label rather than number of digits of total document pages.

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.