Can anyone tell me what is wrong with this script? It runs with no errors, but the resulting document is full of gray pages. If I change the CreateObject call from using InDesignServer.Application.CS5 to using InDesign.Application.CS5, then it works fine. But I want to use the server object and not the client.
Rem PlaceMultipagePDF.vbs
Rem An InDesignServer CS5 script
Rem Places all of the pages of a multi-page PDF.
Function main()
Set myInDesign = CreateObject(“InDesignServer.Application.CS5″)
myFileName = “C:test.pdf”
myNewDocument = True
Set myDocument = myInDesign.Documents.Add
Set myPage = myDocument.Pages.Item(1)
myPlacePDF myInDesign, myDocument, myPage, myFileName
myInDesign.Documents.Item(1).Save(myFileName & “.indd”)
End function
Function myPlacePDF(myInDesign, myDocument, myPage, myFileName)
Rem idPDFCrop.idCropMedia = 1131573325
myInDesign.PDFPlacePreferences.PDFCrop = 1131573325
myCounter = 1
myBreak = False
Do While myBreak = False
If myCounter > 1 Then
myDocument.Pages.Add
End If
myInDesign.PDFPlacePreferences.PageNumber = myCounter
Set myPDFPage = myDocument.Pages.Item(-1).Place(myFileName, Array(0, 0))
Set myPDFPage = myPDFPage.Item(1)
If myCounter = 1 Then
myFirstPage = myPDFPage.PDFAttributes.PageNumber
Else
If myPDFPage.PDFAttributes.PageNumber = myFirstPage Then
myDocument.Pages.Item(-1).Delete
myBreak = True
End If
End If
myCounter = myCounter + 1
Loop
End Function