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

Need help with a script to export a PDF from pages from multiple InDesign documents

Explorer ,
May 19, 2020 May 19, 2020

Copy link to clipboard

Copied

 

Hello, I am trying to create a script to create a PDF from selected InDesign pages across multiple InDesign documents.

 

For example, I want page 1 to 4, and 7-10 from indd document 1 and page 2-5 and 9-13 from indd document 2, all combined in one PDF.

 

Could someone provide any suggestions on how to accomplish this?   I was looking at document.exportFile, but this method only can be used if all pages are in the same InDesign document.

 

Thank you!

 

 

TOPICS
How to , Import and export , Scripting

Views

1.3K

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 1 Correct answer

Community Expert , May 20, 2020 May 20, 2020

Hi Jorge,

you could provide a custom PDF/X-4 Export preset after you changed and saved an existing one.

From my German InDesign:

 

Default-PDF-X-4-Export-Preset-1.PNG

 

Default-PDF-X-4-Export-Preset-2.PNG

 

Note: To do that your Color Management must not be set to off.

 

See into InDesign's DOM discription how to set page ranges for export with:

app.pdfExportPreferences.pageRange

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#PDFExportPreference.html

 

In your case the value for pageRange is a string that could hold the names of the pages like:

"23-48,
...

Votes

Translate

Translate
Advocate ,
May 19, 2020 May 19, 2020

Copy link to clipboard

Copied

This is currently not possible with InDesign Scripting.

 

But I will give you one Idea. Idea is export PDF with all pages out of a book, and use JAVA to create new PDF out of exported PDF using your page numbers.

You might hit the spot.

You have to take help of different programming language as per current situation.

Or wait until Adobe itself develop this functionality in InDesign.

 

Best

Sunil

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 ,
May 19, 2020 May 19, 2020

Copy link to clipboard

Copied

Hi JG10,

export the pages of the two document to PDF/X-4 with no image downsampling.

Place the PDFs in a new InDesign document and export that to the final PDF.

 

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
Explorer ,
May 20, 2020 May 20, 2020

Copy link to clipboard

Copied

Hi Uwe,

Thank you for the response. Could you expand a little on how to do what you propose?  

I am not sure how to set the no image downsampling when exporting and how to place the PDFs in a new InDesign document programatically.

 

Thank you, 

Jorge

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 ,
May 20, 2020 May 20, 2020

Copy link to clipboard

Copied

Hi Jorge,

you could provide a custom PDF/X-4 Export preset after you changed and saved an existing one.

From my German InDesign:

 

Default-PDF-X-4-Export-Preset-1.PNG

 

Default-PDF-X-4-Export-Preset-2.PNG

 

Note: To do that your Color Management must not be set to off.

 

See into InDesign's DOM discription how to set page ranges for export with:

app.pdfExportPreferences.pageRange

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#PDFExportPreference.html

 

In your case the value for pageRange is a string that could hold the names of the pages like:

"23-48,51-57"

 

or strings that point to the position of pages in your document like that:

"+1-+12,+17-+56"

 

When done you export the document to PDF with e.g.:

app.documents[0].exportFile
( 
ExportFormat.PDF_TYPE , 
myPDFfile , 
false , 
myPDFExportPreset 
);

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Document.html#d1e49241__d1e53606

 

or:

app.documents[0].asynchronousExportFile
( 
ExportFormat.PDF_TYPE , 
myPDFfile , 
false , 
myPDFExportPreset 
);

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Document.html#d1e49241__d1e52263

 

Before you have to define valid variables for myPDFfile and myPDFExportPreset.

See into DOM documentation again:

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#File.html

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#PDFExportPresets.html

 

You will do that for two or more different InDesign documents.

Since you know the number of pages and page sizes in advance you can add a new document with the appropriate page length and page size and then use method place() to place both PDFs, page by page, to the new document.

When done export the whole document to a new PDF with the same or a different PDF Export preset.

 

FWIW: To explain everything in great detail would mean to write that script for you.

I will not do that for free.

 

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
Explorer ,
May 20, 2020 May 20, 2020

Copy link to clipboard

Copied

LATEST

Thank you very much Uwe.  This helps me get started and gives me a good idea of where to look.

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