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

How to Quickly Insert Pages from One InDesign Document into Another

New Here ,
Oct 08, 2024 Oct 08, 2024
Hello

I have two InDesign documents. A first (A) of 300 different pages and a second (B) of 1 page.

I want to insert the second document (B) after each of the 300 pages, for a total of 600 pages. That is: A1-B-A2-B-A3-B-A4-B…. Up to….A299-B-A300-B What would be the quickest method?

THANKS


<Title renamed by MOD>
TOPICS
How to
1.2K
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 08, 2024 Oct 08, 2024

Write a script, or get someone to write a script. There is no built-in feature in InDesign to do it.

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

Create PDFs of each file. Check out PDFsam Basic, a free open-source program. It can do an alternative mix of the pages. 

https://pdfsam.org/

 

David Creamer: Community Expert (ACI and ACE 1995-2023)
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 08, 2024 Oct 08, 2024

Put all INDD files into a book INDB and export from there all you need. 

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
LEGEND ,
Oct 09, 2024 Oct 09, 2024
quote

Put all INDD files into a book INDB and export from there all you need. 


By @Willi Adelberger

 

How this will mix pages from both files? 

 

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

Hi @Eugene Tyson , Think you need pages[i] not pages[0]

 

insertDoc.pages[i].duplicate(LocationOptions.AFTER, mainDoc.pages[addPageLocation]);

 

Also if the docs are facing pages the allow shuffle prefs will matter, and you might need to consider the masterspreads contents.

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
LEGEND ,
Oct 09, 2024 Oct 09, 2024

@rob day

 

But doc "B" is the one page document, and this single page should be inserted after every page in the doc "A"?

 

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

Thanks missed that.

 

If the doc is facing the shuffle prefs still need to be checked, and does B have masterpage items?

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

With a facing page document without setting shuffle prefs I get this before and after:

Screen Shot 20.png

 

Screen Shot 18.png

 

With this:

 

var mainDoc = app.activeDocument; // Assuming this is Document A
//make sure to allow shuffling
mainDoc.spreads.everyItem().allowPageShuffle = true;
mainDoc.documentPreferences.properties = {allowPageShuffle:true};

var insertDoc = app.documents.itemByName("B.indd"); // Open Document B separately

//bring any masterpageitems?
var mpi = insertDoc.pages[0].masterPageItems;
for (var i = 0; i < mpi.length; i++){
    mpi[i].override(insertDoc.pages[0])
};   


var addPageLocation = 0;  
var docLength = mainDoc.pages.length;  // Start with the original length of Document A
var p 
for (var i = 0; i < docLength; i++) {

    // Duplicate the page from Document B to Document A after each page
    p = insertDoc.pages[0].duplicate(LocationOptions.AFTER, mainDoc.pages[addPageLocation]);
    //remove the insert page’s section?
    p.appliedSection.remove()

    // Update the page location to skip over the newly added page from Document B
    addPageLocation += 2;
}


 

 

Screen Shot 19.png

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

Sometimes I think that scripters only know script-based solutions. 😁 I was able to combine two 1000-page documents with an alternative mix using PDFsam Basic in less than a minute.

 

David Creamer: Community Expert (ACI and ACE 1995-2023)
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
LEGEND ,
Oct 09, 2024 Oct 09, 2024

@Dave Creamer of IDEAS

 

Yeah. But it depends on what you need - just print - or edit something afterwards... 

 

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

True enough!

David Creamer: Community Expert (ACI and ACE 1995-2023)
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 09, 2024 Oct 09, 2024

Great you mentioned this. 

 

And I've done something similar in the past but not sure how or remember when or what I used. 

 

I think someone have me a script up use in acrobat. 

 

Since you have this option I thought I'd try offer the way I may have approached it before. 

 

It's a good suggestion, along with the book file. 

 

I think there is many ways to do it. And great we all come together to share experience

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

Try it out on a duplicate set of files - I'm not the best scripter

 

Found a script here that looks like what you want

https://stackoverflow.com/questions/57545582/indesign-script-to-add-a-page-to-every-given-page

 

Haven't tested it properly but I suspect this might work better with a tweak 

var mainDoc = app.activeDocument; // Assuming this is Document A
var insertDoc = app.documents.itemByName("B.indd"); // Open Document B separately

var addPageLocation = 0;  
var docLength = mainDoc.pages.length;  // Start with the original length of Document A

for (var i = 0; i < docLength; i++) {

    // Duplicate the page from Document B to Document A after each page
    insertDoc.pages[0].duplicate(LocationOptions.AFTER, mainDoc.pages[addPageLocation]);

    // Update the page location to skip over the newly added page from Document B
    addPageLocation += 2;
}

 

 

 

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
LEGEND ,
Oct 09, 2024 Oct 09, 2024

@Eugene Tyson

 

It should work - I'm on my phone so can't test your code.

 

But just in case, in situations like this - it's better to iterate backward. 

 

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
Guide ,
Oct 09, 2024 Oct 09, 2024

Correction:

 

    var myPage = insertDoc.pages[0].duplicate(LocationOptions.AFTER, mainDoc.pages[addPageLocation]);
    myPage.appliedSection.remove();

 

(^/)  The Jedi

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
New Here ,
Jan 04, 2025 Jan 04, 2025

Hey Steve, this is WAY after the fact, but maybe this will help someone else. You can select pages from one document and then in the page hamburger, select move pages.  Select the open document that you want to move the pages to and follow the prompt. 

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
LEGEND ,
Jan 04, 2025 Jan 04, 2025
LATEST

@Deborah29490204ubo0

 

I'm sorry, but have you read opening post in full?  

 

Steve wants to mix pages - after each page of the Document A - one and only page from Document B should be inserted.

 

Doing this manually - 300x times - rather isn't a solution... 

 

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