Skip to main content
kelseyc19724948
Participant
May 21, 2020
Pregunta

Export to PDF by Section

  • May 21, 2020
  • 4 respuestas
  • 4122 visualizaciones

I have a long pdf with many sections. Is it possible to automatically export all of the sections (with the section name as the document name) as seperate pdfs?

Or do I just manually have to export by page range for each pdf?

Este tema ha sido cerrado para respuestas.

4 respuestas

Denis Senatsky
Participating Frequently
June 17, 2022
// Export Sections As PDF
// v.2 (27-05-2022)

var doc = app.activeDocument;
var myPDFExportPreset = "2540_150_CPL"; // Change your PDF preset name
var myPrefix = "Pages_"; // Change prefix to your files)


var path = app.activeDocument.fullName.path;
var mySecFirstPage = [];
var mySecLastPage = [];
for (i = 0; i < app.activeDocument.sections.length; i++) {
    mySecFirstPage[i] = doc.sections[i].pageNumberStart;
    mySecLastPage[i] = mySecFirstPage[i] + doc.sections[i].length - 1;
};
mySecFirstPage.sort(function(a, b) {return a - b});
mySecLastPage.sort(function(a, b) {return a - b});
for (i = 0; i < mySecFirstPage.length; i++) {
    app.pdfExportPreferences.pageRange = mySecFirstPage[i] + "-" + mySecLastPage[i];
    mySecFirstPage[i] = ("000" + mySecFirstPage[i]).slice(-3);
    mySecLastPage[i] = ("000" + mySecLastPage[i]).slice(-3);
    app.activeDocument.exportFile(ExportFormat.PDF_TYPE, File(path + "/" + myPrefix + mySecFirstPage[i] + "-" + mySecLastPage[i] + ".pdf"), false, app.pdfExportPresets.item(myPDFExportPreset));
};
Participant
September 28, 2022

Im getting an error using that. (30477) Invalid value for parameter "using" in method "export File"

Denis Senatsky
Participating Frequently
August 21, 2023

You need to change "2540_150_CPL" with actually existing PDF preset name.

var myPDFExportPreset = "2540_150_CPL"; // Change your PDF preset name

 

Ashutosh_Mishra
Inspiring
May 22, 2020

Hi Kelsey,

 

Thanks for reaching out. In addition to the great suggestions given earlier, I'd also request checking out the community discussion at https://community.adobe.com/t5/indesign/sections-how-to-export-sections-into-individual-pdf/td-p/10150414?page=1
Hope it helps.

 

Regards,

Ashutosh

TᴀW
Legend
May 21, 2020

If you do need to export all sections to PDF, with the section-marker name as the file name, check out my (not free) https://www.id-extras.com/products/extract-pages/

id-extras.com | InDesign tools & scripts for typesetters, form designers, and translators
Barb Binder
Community Expert
Community Expert
May 21, 2020

Hi again, Kelsey:

 

This is the InDesign forum, but you are starting with "I have a long PDF..." so are you trying to break up the PDF or the InDesign document into separate PDFs? 

 

Again, in InDesign, sections allow you to change the numbering system, and the Section Prefix is just an organizational tool in the Pages panel. It doesn't do anything but help you tell what section you are in, at a glance. Most people don't use them.

 

Options for you include:

  • Divide the long InDesign file into a multi-chapter book, export the chapters/sections as separate PDFs;
  • Export the page ranges as you said; or
  • If you are using Bookmarks in InDesign (part of the TOC feature), Adobe Acrobat (not Reader) has a feature that allows you to split a PDF by top-level bookmarks.

 

~Barb

~Barb at Rocky Mountain Training
kelseyc19724948
Participant
May 22, 2020

My apologies, I meant I have a long indesign doc that I am trying to separate into 30 PDFs. It was originally going to be 1 PDF, but my team would now like them separated. So I'm trying to see if there's a way to automate the process.