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

Export Multiple Page Ranges to seperate PDFs from 1 export

Community Beginner ,
Dec 08, 2019 Dec 08, 2019

Copy link to clipboard

Copied

Dear Community,

 

I have been using Indesign since CS2 and I have never came across this particular problem before. I am hoping someone here can help me. I have 7 seperate indesign documents each from a data merge. Each document has close to 300 pages. What I need is very simple but for the life of me I cannot figure out how to do it efficiently. I need to export multiple page ranges for each indesign document and have each range be a seperate pdf. Here's an example of what I mean.

 

Indesign Document:

1-2, 4-5, 7-16, 18-19, 21-30, 32-35, 37-38, 40-49, 51-52, 54-57, 59-74, 76-79, 81-82, 84-85, 87-92

 

I need a way to export so that basically the comma means *NEW PDF*. 

 

The only way I found so far to do this is to manually export the ranges 1 at a time which takes literally hours to go through each id file OR I found 1 plugin this morning that may do it called "extract Pages".

 

https://www.id-extras.com/products/extract-pages/

 

There's got to be an easier way right? I shouldn't have to spend $50 to do this seemingly insanely simple export. 

 

Any ideas guys?

 

Thanks!

 

 

 

TOPICS
How to , Import and export , Scripting

Views

6.0K

Translate

Translate

Report

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

correct answers 2 Correct answers

Community Expert , Dec 09, 2019 Dec 09, 2019

(Sorry, didn't mean to leave you hanging. I must be in a different time zone -- my original answer was done right before closing down for the night.)

I've found your bug -- and it's actually toted as a "feature". My Mac had no problems with the script but I get your error on my Windows 'chine as well. Apparently the default location to save in, if no path has been given, is the scripts folder. I didn't notice because my Mac automatically opened the files as they were created and I just glanced a

...

Votes

Translate

Translate
Community Expert , Oct 19, 2024 Oct 19, 2024

The exportFile method needs a file path, which was not included in the code I pasted from jongware’s first post. Maybe this:

 

makeDialog();
var pp, pglist;

function makeDialog(){
    var theDialog = app.dialogs.add({name:"Choose a Preset", canCancel:true});
    with(theDialog.dialogColumns.add()){
        staticTexts.add({staticLabel:"Export Preset:"});
        staticTexts.add({staticLabel:"Page Range:"});
        
    }
    with(theDialog.dialogColumns.add()){
        pp = dropdowns.add({str
...

Votes

Translate

Translate
Explorer ,
Oct 19, 2024 Oct 19, 2024

Copy link to clipboard

Copied

It's a good solution for better use of the script. Thanks a lot for the suggestion!

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

Another good idea, though it might make the list in the scriopts forlder a bit long if there are a lot of presets.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

Old topic, but it anyone is still working on this, I would suggest the a good way to handle @LMatiel 's request would be to implement a dropdown box to select a preset rather than trying to choose each setting, but perhaps that was what they meant.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied


Thanks for the reply, there is another script that contains the dropdown menu with all the pdf settings that are saved in indesign but I can't get it to work in osx
Here

https://community.adobe.com/t5/indesign-discussions/script-export-page-ranges-to-multiple-pdfs-fast-... 

 

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

Sorry, I'm not a scripter so can't help with that. See you posted in the other thread, so perhaps the author will get back to you there.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

Hi @LMatiel , Try this:

 

makeDialog();

var pp, pglist;

function makeDialog(){
    var theDialog = app.dialogs.add({name:"Choose a Preset", canCancel:true});
    with(theDialog.dialogColumns.add()){
        staticTexts.add({staticLabel:"Export Preset:"});
        staticTexts.add({staticLabel:"Page Range:"});
    }
    with(theDialog.dialogColumns.add()){
        pp = dropdowns.add({stringList:app.pdfExportPresets.everyItem().name, selectedIndex:3, minWidth:80});
        pglist = textEditboxes.add({editContents:"", minWidth:350});
    }
    if(theDialog.show() == true){
        pp = app.pdfExportPresets.item(pp.selectedIndex);
        pglist = pglist.editContents.split(',');
        for (i=0; i<pglist.length; i++){
            app.pdfExportPreferences.pageRange = pglist[i];
            app.activeDocument.exportFile(ExportFormat.PDF_TYPE, File('pages_'+pglist[i]+'.pdf'), false, pp);
        }
        theDialog.destroy();
	}
}

 

 

Screen Shot 20.png

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

@rob day Thanks for the reply, I installed the script and ran it, it shows me all the settings to choose from that I need but when I want to generate the PDF it shows me this alert

 

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

@LMatiel

 

Can you post screenshot before you click OK - so we can see Page Range you've entered.

 

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

These are the screenshots of the process

Captura de Pantalla 2024-10-19 a la(s) 18.27.10.jpgCaptura de Pantalla 2024-10-19 a la(s) 18.28.06.jpgCaptura de Pantalla 2024-10-19 a la(s) 18.28.16.jpg







 

 

Votes

Translate

Translate

Report

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
New Here ,
Nov 01, 2024 Nov 01, 2024

Copy link to clipboard

Copied

Hi, I'm learning scripting so very much a newbee. When run this script, the final pdf's that are exported are named the page range value. Is there a way to have the page range be a suffix added to the filename?

Thanks for any help or direction you might be able to give. 

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

The exportFile method needs a file path, which was not included in the code I pasted from jongware’s first post. Maybe this:

 

makeDialog();
var pp, pglist;

function makeDialog(){
    var theDialog = app.dialogs.add({name:"Choose a Preset", canCancel:true});
    with(theDialog.dialogColumns.add()){
        staticTexts.add({staticLabel:"Export Preset:"});
        staticTexts.add({staticLabel:"Page Range:"});
        
    }
    with(theDialog.dialogColumns.add()){
        pp = dropdowns.add({stringList:app.pdfExportPresets.everyItem().name, selectedIndex:3, minWidth:80});
        pglist = textEditboxes.add({editContents:"", minWidth:350});
    }
    if(theDialog.show() == true){
        pp = app.pdfExportPresets.item(pp.selectedIndex);
        pglist = pglist.editContents.split(',');
        var path = app.activeDocument.fullName.path;
        for (i=0; i<pglist.length; i++){
            app.pdfExportPreferences.pageRange = pglist[i];
            app.activeDocument.exportFile(ExportFormat.PDF_TYPE, File(path+'/pages_'+pglist[i]+'.pdf'), false, pp);
        }
        theDialog.destroy();
	}
}

Votes

Translate

Translate

Report

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 20, 2024 Oct 20, 2024

Copy link to clipboard

Copied

@rob day Thank you very much and I apologize that I couldn't test it before, it works perfectly, the script allows you to select the page range to generate the pdfs and the corresponding settings. It saves the file in the same place where the .indd is, it doesn't allow you to choose another location.
It works correctly, thank you very much!!!

Votes

Translate

Translate

Report

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 ,
Nov 01, 2024 Nov 01, 2024

Copy link to clipboard

Copied

LATEST

Change the following line to this: 

app.activeDocument.exportFile(ExportFormat.PDF_TYPE, File('pages_'+ app.activeDocument.name.replace(/\.indd/gi,"") + "_" + pglist[i]+'.pdf'), false, pp);

Votes

Translate

Translate

Report

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 ,
Dec 09, 2019 Dec 09, 2019

Copy link to clipboard

Copied

Jongware said:

…I checked on my Windows machine and indeed it tries to store the files in the Scripts folder, which is inside a "protected folder" (a Microsoft "feature", so not a bug ...). …

 

Was this the Application folder of your Scripts panel?

Then I'd try to store the script in the User folder of the Scripts panel.

 

Regards,
Uwe Laubender

( ACP )

Votes

Translate

Translate

Report

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