Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Javascript Page Count

Contributor ,
May 22, 2018 May 22, 2018

OK here is an easy one to answer I cant figure out how to get a page count, Ive looked on the web and I cant find anything (that works)?

Im just starting a script to put items on specific pages. This what I thought should work, but dosent?

var myDocument = app.activeDocument;

var Count = myDocument.numPages;

alert('This document has ' + Count + ' pages.', 2, 0);

*also tried

var Count = myDocument.pages.numPages;

what am I not seeing/understanding to make this work?

TOPICS
Scripting
2.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 22, 2018 May 22, 2018
LATEST

Hi,

look up DOM documentation. E.g. Jongware's:

Indesign JavaScript Help

Pages have a length property.

If you want to change the number of pages in a document you can use method add() of object Pages.

Or you can change that directly at document level with the document preferences:

Adobe InDesign CS6 (8.0) Object Model JS: DocumentPreference

See into pagesPerDocument and startPageNumber .

Regards,
Uwe

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines