Internet searches have yielded the following results:
import win32com.client
app = win32com.client.Dispatch('InDesign.Application')
myFile = r'C:\test.indd'
myDocument = app.Open(myFile)
myPage = myDocument.Pages.Item(1)
for x in range(0, 5):
myPage = myDocument.Pages.Add()
for a in range(0,5):
myPage = myDocument.Pages.Item(a 1)
myRectangle = myPage.Rectangles.Add()
myRectangle.GeometricBounds = ["0", "0", "297mm", "210mm"]
myRectangle.StrokeWeight = 0
myPlace = myRectangle.Place(r'C:\mail.pdf')
All I have to do is make sure that pages from the PDF file (for example, 1-20 pages) are placed on each separate page in Indesign. I found this code on the adobe indesign site, but I can't think of it to the end... An error pops up that such a variable does not exist (myPage.PDFPlacePreference.PageNumber = "2").
myPage.PDFPlacePreference.PageNumber = "2"
myPlacePDFFile = myPage.Place(r'C:\mail.pdf')
CodePudding user response:
Try to replace:
myPage.PDFPlacePreference.PageNumber = "2"
with:
app.PDFPlacePreferences.PageNumber = 2