Skip to main content
Participant
August 27, 2018
Answered

indesign placemultipagepdf script only adds pdfs to the end of the document

  • August 27, 2018
  • 4 replies
  • 9759 views

Hello,

I recently updated my InDesign to the newest version, and now, the place multi-page pdf script will only place the pdfs at the end of my indesign file as opposed to on the page i select it to import onto. How do i fix this?

4 replies

Community Expert
October 11, 2023

Good news, the bug we posted has been acted upon by Adobe and is reported to be fixed in the latest version of InDesign.

-Manan

-Manan
Srishti Bali
Community Manager
Community Manager
September 7, 2018

Hi there,

I would like to know if the steps suggested above worked for you, or the issue still persists.

Kindly update the discussion if you need further assistance with it.

Thanks,

Srishti

DACK70Author
Participant
October 18, 2018

Hi,

I found the error! I had been using the VBScript multipage pdf tool instead of the Javascript multipage pdf tool.

I have been having another issue though with Indesign having sticky key problems. If i highlight a word in my file and try to type to replace it it's not typing my first letters. Do you know how to fix this?

Robert at ID-Tasker
Legend
August 23, 2023

Hi @ajabon grinsmith,

How about opening a new post? We have many scripters on the forum(little less who use vbs), someone can check it out and maybe provide a fix. Maybe @Robert at ID-Tasker can help here.

-Manan


OK, here is the fixed code.

 

I've added an extra bonus - now it's possible to place every SECOND page - so you can place your PDF only on LEFT or only on RIGHT pages of the spread - if it's two page spread.

Otherwise, it will just place every second page.

 

 

 

Rem PlaceMultipagePDF.vbs
Rem An InDesign script
Rem
Rem Places all of the pages of a multi-page PDF.
Rem
Rem Modified by Robert Tkaczyk
Rem on 2023-08-23
Rem
Rem fixed bug with wrong starting page
Rem added option to place every 2nd page
Rem

Dim myStep

myStep = true

main
Function main()
	Set myInDesign = CreateObject("InDesign.Application.2023")
	Rem Set the user interaction level to allow the display of dialog boxes and alerts.
	myInDesign.ScriptPreferences.UserInteractionLevel = idUserInteractionLevels.idInteractWithAll
	Rem Use JavaScript to display a standard Open File dialog box.
	myJavaScript = "myPDFFile = File.openDialog(""Choose a PDF File"");if(myPDFFile != null){myFileName = myPDFFile.fsName}else{myFileName = """"};"
	myFileName = myInDesign.DoScript(myJavaScript, idScriptLanguage.idJavascript)
	If myFileName <> "" Then
	    myNewDocument = True
	    If myInDesign.Documents.Count <> 0 Then
	        Set myDocument = myChooseDocument(myInDesign, myNewDocument)
	    Else
	        Set myDocument = myInDesign.Documents.Add
	    End If
	    If myNewDocument = False Then
	        Set myPage = myChoosePage(myInDesign, myDocument)
	    Else
	        Set myPage = myDocument.Pages.Item(1)
	    End If
	    myPlacePDF myInDesign, myDocument, myPage, myFileName
	End If
End function
Function myChooseDocument(myInDesign, myNewDocument)
    ReDim myDocumentNames(0)
    myDocumentNames(0) = "New Document"
    Rem Get the names of the documents
    For myDocumentCounter = 1 To myInDesign.Documents.Count
        ReDim Preserve myDocumentNames(UBound(myDocumentNames) + 1)
        myDocumentNames(myDocumentCounter) = myInDesign.Documents.Item(myDocumentCounter).Name
    Next
    Set myChooseDocumentDialog = myInDesign.Dialogs.Add
    myChooseDocumentDialog.Name = "Choose a Document"
    myChooseDocumentDialog.CanCancel = False
    With myChooseDocumentDialog.DialogColumns.Add
        With .DialogRows.Add
            With .DialogColumns.Add
                With .StaticTexts.Add
                    .StaticLabel = "Place PDF in:"
                End With
            End With
            With .DialogColumns.Add
                Set myChooseDocumentDropdown = .Dropdowns.Add
                myChooseDocumentDropdown.StringList = myDocumentNames
                myChooseDocumentDropdown.SelectedIndex = 0
            End With
        End With
        With .DialogRows.Add
            With .DialogColumns.Add
                Set myStepChkBox = .CheckboxControls.Add
                myStepChkBox.CheckedState = True
                myStepChkBox.StaticLabel = "If CHECKED - will place page-by-page / If UNchecked - will place every SECOND page"
            End With
        End With
    End With
    myChooseDocumentDialog.Show
    If myChooseDocumentDropdown.SelectedIndex = 0 Then
        Set myDocument = myInDesign.Documents.Add
    Else
        Set myDocument = myInDesign.Documents.Item(myChooseDocumentDropdown.SelectedIndex)
        myNewDocument = False
    End If
    myStep = myStepChkBox.CheckedState 
    myChooseDocumentDialog.Destroy
    Set myChooseDocument = myDocument
End Function
Function myChoosePage(myInDesign, myDocument)
    ReDim myPageNames(0)
    Rem Get the names of the pages in the document
    For myCounter = 1 To myDocument.Pages.Count
        If Not (IsEmpty(myPageNames(0))) Then
            ReDim Preserve myPageNames(UBound(myPageNames) + 1)
        End If
        myPageNames(myCounter - 1) = myDocument.Pages.Item(myCounter).Name
    Next
    Set myChoosePageDialog = myInDesign.Dialogs.Add
    myChoosePageDialog.Name = "Choose a Page"
    myChoosePageDialog.CanCancel = False
    With myChoosePageDialog.DialogColumns.Add
        With .DialogRows.Add
            With .DialogColumns.Add
                With .StaticTexts.Add
                    .StaticLabel = "Place PDF on:"
                End With
            End With
            With .DialogColumns.Add
                Set myChoosePageDropdown = .Dropdowns.Add
                myChoosePageDropdown.StringList = myPageNames
                myChoosePageDropdown.SelectedIndex = 0
            End With
        End With
    End With
    myChoosePageDialog.Show
    Set myPage = myDocument.Pages.Item(myChoosePageDropdown.SelectedIndex + 1)
    myChoosePageDialog.Destroy
    Set myChoosePage = myPage
End Function
Function myPlacePDF(myInDesign, myDocument, myPage, myFileName)
    myInDesign.PDFPlacePreferences.PDFCrop = idPDFCrop.idCropMedia
    myCounter = 1
    myBreak = False
    Do While myBreak = False
        If myCounter > 1 Then
            if not myStep then
                Set myPage = myDocument.Pages.Add(idLocationOptions.idAfter ,myPage)
            end if
            Set myPage = myDocument.Pages.Add(idLocationOptions.idAfter ,myPage)
        End If
        myInDesign.PDFPlacePreferences.PageNumber = myCounter
'        Set myPDFPage = myDocument.Pages.Item(-1).Place(myFileName, Array(0, 0))
'      	Set myPDFPage = myPDFPage.Item(1)
        Set myPDFPage = myPage.Place(myFileName, Array(0, 0)).Item(1)
        If myCounter = 1 Then
            myFirstPage = myPDFPage.PDFAttributes.PageNumber
        Else
            If myPDFPage.PDFAttributes.PageNumber = myFirstPage Then
                Call myPage.Delete
                myBreak = True
            End If
        End If
        myCounter = myCounter + 1
    Loop
End Function

 

 

 

Srishti Bali
Community Manager
Community Manager
August 31, 2018

Hi there,

Sorry to hear about this. As already mentioned by David, the PlaceMultiPagePDF.jsx script in the newest version works perfectly fine.

Please make sure you are trying these steps: https://indd.adobe.com/view/5213c1c4-29c9-4b9b-85f1-c414affab0fb

If it still does not work, please try resetting preferences for InDesign: Set preferences in Adobe InDesign

Regards,

Srishti

davidblatner
Community Expert
Community Expert
August 31, 2018

That is strange… I am using the newest version and the PlaceMultiPagePDF.jsx script works properly for me.

However, if that script isn't working, you might try this one, which offers more options.

https://indesignsecrets.com/placing-all-the-pages-of-a-pdf-inside-indesign.php