Hi, I need to get quanity of pages of pdf file linked in InDesign CS4 JS. Here what I have:
var myArtFront = app.activeDocument.pages[0].rectangles[0].graphics[0];
var myLink = myArtFront.itemLink;
var myArtFrontName = myArtFront.itemLink.name;
var myFrontPageNumber = myLink.parent.pdfAttributes.pageNumber;
var pdfPgCount = myLink.pages.length;
alert (pdfPgCount);
and it doesn't return anything.
Thank you for your help.
Yulia
There has been many discussions on how to get a pdf page count. Search
the forum for various solutions.
Harbs
I went through all the Forum pages for PDF page count and total pages in PDF from InDesign and couldn't find my specific case. The way I have the access to the PDF in the script is through the link of placed into InDesign file. Would it be sufficient data to pull total count of the pdf pages from the link? None of what I've tried so far worked:
var myArtBack = app.activeDocument.pages[1].rectangles[0].graphics[0];
var myArtBackName = myArtBack.itemLink.name;
var myLink = myArtBack.itemLink;
var pdfPgCount = myArtBack.documentPreference.pagesPerDocument;
or
var pdfPgCount = myLink.documentPreference.pagesPerDocument;
I think I am stuck in the place of what variable to pass for the pdf doc (green in last 2 lines), so it would give me the pdfPgCount. Do I even have the correct variable defined.
Thank you so much for your help.
Yulia