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

Place all pages in pdf into indesign

Participant ,
Jul 30, 2010 Jul 30, 2010

Copy link to clipboard

Copied

I want to place all pages in a pdf file into indesign, I mean need to load all pages in a pdf in single place method and place every pages individually on iterating through pages in indesign.

Note: Manually this can be done by enable "Show import option",which opens preference window in which we can prefer to ALL option under PAGES menu under GENERAL tab while preforming Place pdf.

TOPICS
Scripting

Views

7.9K

Likes

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

Explorer , Mar 03, 2017 Mar 03, 2017

Hello! I encountered this problem myself and came up with a solution that worked for me.

This is how I broke it down:

1: Create a dialog with an edit box where you type the number of pages in the document you wish to import.

2: Prompt the user to select a file to place.

3: Create a for loop that iterates through as many times as there are pages in the placed PDF

4: Import the page number of the PDF on the matching page number on the indesign file by refering to the current value of the counter for b

...

Likes

Translate

Translate
Community Expert ,
Jul 30, 2010 Jul 30, 2010

Copy link to clipboard

Copied

Do a google on "pdf placer zanelli".

Peter

Likes

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
Participant ,
Jul 30, 2010 Jul 30, 2010

Copy link to clipboard

Copied

Peter,

I need to achieve this task through scripting not by means of plugin.

If you provide an example script that would be more helpful.

thanks in advance.

Likes

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
Engaged ,
Jul 31, 2010 Jul 31, 2010

Copy link to clipboard

Copied

You are finding PlaceMultipagePDF.jsx script and here is it for you

//PlaceMultipagePDF.jsx
//An InDesign CS3 JavaScript
//
//Places all of the pages of a multi-page PDF.
//
//For more on InDesign scripting, go to http://www.adobe.com/products/indesign/xml_scripting.html
//or visit the InDesign Scripting User to User forum at http://www.adobeforums.com
//
//Display a standard Open File dialog box.
var myPDFFile = File.openDialog("Choose a PDF File");
if((myPDFFile != "")&&(myPDFFile != null)){
     var myDocument, myPage;
    if(app.documents.length != 0){
        myDocument, myNewDocument = myChooseDocument();
    }
    else{
          myDocument = app.documents.add();
          myNewDocument = false;
    }
    if(myNewDocument == false){
         myPage = myChoosePage(myDocument);
    }
    else{
        myPage = myDocument.pages.item(0);
    }
    myPlacePDF(myDocument, myPage, myPDFFile);
}
function myChooseDocument(){
    var myDocumentNames = new Array;
    myDocumentNames.push("New Document");
    //Get the names of the documents
    for(var myDocumentCounter = 0;myDocumentCounter < app.documents.length; myDocumentCounter++){
        myDocumentNames.push(app.documents.item(myDocumentCounter).name);
    }
    var myChooseDocumentDialog = app.dialogs.add({name:"Choose a Document", canCancel:false});
    with(myChooseDocumentDialog.dialogColumns.add()){
        with(dialogRows.add()){
            with(dialogColumns.add()){
                staticTexts.add({staticLabel:"Place PDF in:"});
            }
            with(dialogColumns.add()){
                var myChooseDocumentDropdown = dropdowns.add({stringList:myDocumentNames, selectedIndex:0});
            }
        }
    }
     myChooseDocumentDialog.show();
    if(myChooseDocumentDropdown.selectedIndex == 0){
        myDocument = app.documents.add();
        myNewDocument = true;
    }
    else{
         myDocument = app.documents.item(myChooseDocumentDropdown.selectedIndex-1);
        myNewDocument = false;
    }
    myChooseDocumentDialog.destroy();
    return myDocument, myNewDocument;
}
function myChoosePage(myDocument){
    var myPageNames = new Array;
    //Get the names of the pages in the document
    for(var myCounter = 0; myCounter < myDocument.pages.length;myCounter++){
        myPageNames.push(myDocument.pages.item(myCounter).name);
    }
    var myChoosePageDialog = app.dialogs.add({name:"Choose a Page", canCancel:false});
    with(myChoosePageDialog.dialogColumns.add()){
        with(dialogRows.add()){
            with(dialogColumns.add()){
                staticTexts.add({staticLabel:"Place PDF on:"});
            }
            with(dialogColumns.add()){
                var myChoosePageDropdown = dropdowns.add({stringList:myPageNames, selectedIndex:0});
            }
        }
    }
    myChoosePageDialog.show();
    var myPage = myDocument.pages.item(myChoosePageDropdown.selectedIndex);
    myChoosePageDialog.destroy();
    return myPage;
}
function myPlacePDF(myDocument, myPage, myPDFFile){
     var myPDFPage;
     app.pdfPlacePreferences.pdfCrop = PDFCrop.cropMedia;
     var myCounter = 1;
     var myBreak = false;
     while(myBreak == false){
          if(myCounter > 1){
               myPage = myDocument.pages.add(LocationOptions.after, myPage);
          }
          app.pdfPlacePreferences.pageNumber = myCounter;
          myPDFPage = myPage.place(File(myPDFFile), [0,0])[0];
          if(myCounter == 1){
               var myFirstPage = myPDFPage.pdfAttributes.pageNumber;
          }
          else{
               if(myPDFPage.pdfAttributes.pageNumber == myFirstPage){
                    myPage.remove();
                    myBreak = true;
               }
          }
          myCounter = myCounter + 1;
     }
}

Shonky

Likes

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
Participant ,
Jul 31, 2010 Jul 31, 2010

Copy link to clipboard

Copied

thanks Shonky

script you provided is works fine. But my requirement is to place in a (trim sized) rectangle box in pages.

while i change the code to my require it throws error.the code i tried out is:

myPDFPage = myPage.rectangles[0].place(File(myPDFFile));

error occurs in the below line:

var myFirstPage = myPDFPage.pdfAttributes.pageNumber;

it shows undefined is not a object.

can you guide where i went wrong with this code.

thanks in advance.

Likes

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
Engaged ,
Jul 31, 2010 Jul 31, 2010

Copy link to clipboard

Copied

if you want place your pdf trim size then change below code:

     app.pdfPlacePreferences.pdfCrop = PDFCrop.CROP_TRIM;

and here is Zanelli's PDF placer which is suggested by Peter. It's really nice script.

Shonky

Likes

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 ,
Jul 31, 2010 Jul 31, 2010

Copy link to clipboard

Copied

> I need to achieve this task through scripting not by means of plugin.

Zanelli's PDF placer is script.

> If you provide an example script that would be more helpful.

If you can be bothered to have a look you'll find you you're looking for.

Peter

Likes

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 24, 2022 Nov 24, 2022

Copy link to clipboard

Copied

LATEST

Images and PDF documents are placed as raster graphics and cannot be edited in InDesign. If you want to edit the placed PDF content, do one of the following before you place them 
 Edit the PDF file in Adobe Acrobat  

Likes

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 ,
Mar 03, 2017 Mar 03, 2017

Copy link to clipboard

Copied

Hello! I encountered this problem myself and came up with a solution that worked for me.

This is how I broke it down:

1: Create a dialog with an edit box where you type the number of pages in the document you wish to import.

2: Prompt the user to select a file to place.

3: Create a for loop that iterates through as many times as there are pages in the placed PDF

4: Import the page number of the PDF on the matching page number on the indesign file by refering to the current value of the counter for both.

Here are some segments of code from my script that may be of use to you:

   

1:with(borderPanels.add()){

                    staticTexts.add({staticLabel: "Page Count:"});

                    var PageCount = integerEditboxes.add({minimumValue: 1, maximumValue: 9999, editValue: 1, minWidth: 50});

                    }

var SelectedPageCount = parseInt(PageCount.editValue);

2: var Art = File.openDialog

3/4: function PlaceFile (Document, Art, SelectedPageCount) {

    //Create a counter from the page count

    var Counter = SelectedPageCount

   

        // Automated Placement

             for (Counter; Counter > 0; Counter --) {

                    app.pdfPlacePreferences.pageNumber = Counter;

                    var placeFile1 = Document.pages.item(Counter + "").place(Art, ["0.5in" ,"0.5in"])[0];

                    //This resets the imported page default to 1 for next time a document is placed

                    app.pdfPlacePreferences.pageNumber = 1;

                 }

            }

I hope this is of use to you!

Likes

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