Please expose a PDF's page count to scripting
To place a PDF in InDesign, you have to know the PDF's page count. The main point of the PlaceMultiPagePDF script is to show how you can place a PDF without knowing its page count, but it's slow business and get very tedious when you want to place part-ranges that include an open-ended range, such as 10-20, 30-
There is a hack, but it's ugly and unreliable.
Peter
-
karl
commented
when scripted the working logic is as follows, place first page, set this first page as a variable, now place all pages until you place first page variable twice, exit the loop and delete last page. This logic in AppleScript works with no 3rd party software needed. If you look at the multiple page import script you can see this logic in it.
"tell mypage
set pdfPageNum to page number of PDF attributes of item 1 of all graphics
if myCounter = 1 then
set myFirstPage to pdfPageNum
else if pdfPageNum = myFirstPage then
delete mypage
exit repeat"like this above
-
Uwe Laubender
commented
Below a link to a thread that is showing a hack and other workarounds, that rely on software that is not InDesign:
"How can I get a total page count of a PDF before placing every page in the PDF?"
(Jezz) Apr 30, 2008https://forums.adobe.com/message/1112698#1112698
Regards,
Uwe Laubender
( ACP )