Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
2

SCRIPT: export Page Ranges To Multiple PDFs - fast export workflow

Participant ,
Sep 09, 2024 Sep 09, 2024

Hello Adobe Community,

I'm pleased to share my PDF export script with everyone.

 

"exportPageRangesToPDF.jsx"

https://github.com/MoebiusSt/exportPageRangesToPDF.jsx

 

Description:

This InDesign script (Adobe InDesign CC 19.5 currently) exports page ranges to separate PDFs. It provides a fast way to export multiple page ranges from your InDesign document to individual PDF files and reduces file-naming and handling for you. It's become my standart PDF export routine used daily.

 

See screenshots attached.

exportPageRangesToPDFs_screenshot-1.jpgexportPageRangesToPDFs_screenshot-2.jpg

 

 

 

 

 

 

 

 

 

Version:

v2.02, Date: 2025-02-08

 

Features:

  • Export multiple page ranges to individual PDFs
  • Specify export folder and PDF preset to use
  • Manually input page ranges and labels/identifiers for each range
  • Retrieve a list of page ranges from:
    - Previously exported PDFs in the target directory
    - Active document's sections and section markers
    - Currently viewed section(s) for quick versioned export
  • Handle odd/even page starts in PDF view settings (cover sheet YES/NO)
  • Automatic versioning for exported PDFs (can be overridden)
  • Save settings to a document script label for persistence
  • Multi-Language: English, French, German, Spanish, Russian, and Arabic

 

Usage:
Launch the script from within Adobe InDesign's script panel or with your custom keyboard shortcut. Enter your desired page ranges into its edit text box and click "PDF export". It will export all page ranges to PDFs with the given PDF preset and  work folder you provide in its settings. It has many features designed for convenience.

 

Input Format
Each line in the input text area should follow this format:

Page or PageRange(label)
The label in brackets is optional. Do not use commas.

 

Example Input:
1
5-7(Introduction)
8-15
16
17-20(Chapter 2)

Output File Naming
Exported PDF files will be named according to this schema:

[DocumentName]_pages_[PageRange]_[Label-from-brackets-if-given]_v[Version].pdf

Example Output:
MyDocument_pages_1_v1.pdf
MyDocument_pages_5-7_Introduction_v1.pdf
...
MyDocument_pages_17-20_Chapter 2_v1.pdf

Version Control:
The version number will auto-increment if an existing PDF file with the same name is found (e.g., from _v1 to _v2). To overwrite the last PDF file version and suppress version incrementation, add a minus (-) to the end of a line:


1-
5-7(Introduction)-
17-20

In this example, existing v1 PDFs for pages 1 and 5-7 will be overwritten, while the 17-20 range will increment to the next version.

 

Author and Credits:
Author: Stephan Möbius
Original idea: Jongware
Multi-language L10N function: Marc Autret (equalizer.js, 2012)

 

License:
MIT License – Do whatever you like with it, but whatever you do must also adhere to MIT License.

 

Contributing / Support
stephan dot moebius att gmail dot com

 

Caveats - Who will not benefit from this script:
- The script works EXCLUSIVELY WITH ABSOLUTE PAGE NUMBERING.
- It is not designed or tested for Book files (.indb).
- If section prefixes or unconventional page numbering are used, the script will likely give up quickly. Try it in simple, linearly numbered magazines, brochures, etc.
- Does it run on macOS? The different decoding of file paths was difficult for me. I added debugging for macOS-Users in version 2.02. Please send me the "exportPDF_debug.txt" log-file it creates on your desktop. If it works you can edit the script and disable debugging by changing the line "var DEBUG_MAC = true;" to "var DEBUG_MAC = false;"

 

Best regards,
Stephan

TOPICS
Import and export , Scripting
1.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 19, 2024 Oct 19, 2024

Hi, thanks a lot for sharing, I tried it on version 18.3 on OSX and it shows this alert

Captura de Pantalla 2024-10-19 a la(s) 13.43.47.jpg

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 19, 2024 Oct 19, 2024

@LMatiel

 

Can you export manually? 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 19, 2024 Oct 19, 2024

Hi, yes, without using the script you can make the PDF without any problem.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 19, 2024 Oct 19, 2024

@LMatiel 

 

Your screenshot isn't an error generated by script - it's InDesign's error.

 

Are you exporting manually to exactly the same destination? 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 19, 2024 Oct 19, 2024

It seems that this is it, it does not find the correct destination to save the PDF, it may be that since it was created for Windows there are differences with OSX
The developer himself has the doubt

"Does it run on macOS? I can't test it. – The different decoding of file paths was difficult for me. I'm curious if it works."

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 08, 2025 Feb 08, 2025

Hi LMatiel,

i updated the script and the path handling for MacOS users. Would you please try the new version 2.02 and tell me if it works? It also has debugging routines enabled for MacOS users and will create a log-file "exportPDF_debug.txt" on your desktop with information about the attempted filepaths. Please send me this file.

 

Other changes in v. 2.02

- added a Help-Page with explanations and examples

- added smart handling of locked PDF files with retry-mechanism

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 19, 2024 Oct 19, 2024
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 08, 2025 Feb 08, 2025

Thanks a lot for stepping in while i was away, Robert. I forgot to follow the thread and was not notified on replies: :S. Sorry.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 09, 2025 Feb 09, 2025

Thanks - could come in handy some time - what's the latest version? 

 

Maybe start a Github post or a Github Gist to keep the latest version available / iterations available. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 09, 2025 Feb 09, 2025
LATEST

@Eugene Tyson

 

Link is in the 1st post. 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines