Number of pages of InDesign-file

Post Reply
User avatar
JimmyHartington
Advanced member
Posts: 310
Joined: Tue Mar 22, 2011 7:38 am

Number of pages of InDesign-file

Post by JimmyHartington »

Has somebody a method to get the number of pages in an InDesign-file in Switch?
The variable [Stats.NumberOfPages] does not return anything. And I can not see anything in the XMP about this.
laurentd
Member
Posts: 142
Joined: Wed Mar 13, 2019 2:06 pm

Re: Number of pages of InDesign-file

Post by laurentd »

Hi Jimmy,
  • You can use an InDesign script for this. You will probably need to output the number of pages value in an xml file, or in the name of the output file.
  • You can convert your InDesign file to a pdf file, define a private data with [Stats.NumberOfPages], then re-inject your InDesign file (previously stored in a repository.
Laurent De Wilde, Solution Architect @ Enfocus
User avatar
JimmyHartington
Advanced member
Posts: 310
Joined: Tue Mar 22, 2011 7:38 am

Re: Number of pages of InDesign-file

Post by JimmyHartington »

Hi Laurent

Thanks for the suggestions.
I know I could do it in other ways, but was unsure if there were a more direct way to get the data, without needing to open/process the InDesign-file.
Padawan
Advanced member
Posts: 358
Joined: Mon Jun 12, 2017 8:48 pm
Location: Belgium
Contact:

Re: Number of pages of InDesign-file

Post by Padawan »

I think there is page information in the XMP?

This Switch variable gives the highest page number in my test:
[Metadata.Integer:Path="xmp:PageInfo/*[last()]/xmpTPg:PageNumber"]

In InDesign this is of course not always equal to the amout of pages since you can start a document with any page number you want.

But I guess using scripting you should be able to get the amount of pages from the xmp by counting the items in the xmp:PageInfo element.

If you don't want to process the InDesign file, then I think XMP is your only option.
User avatar
JimmyHartington
Advanced member
Posts: 310
Joined: Tue Mar 22, 2011 7:38 am

Re: Number of pages of InDesign-file

Post by JimmyHartington »

Padawan wrote: Tue Aug 29, 2023 1:20 pm [Metadata.Integer:Path="xmp:PageInfo/*[last()]/xmpTPg:PageNumber"]
In my tests it seems this metadata is based on the setting in InDesign, which can save a preview of each page.
And since I have it set to 5 pages, then all my InDesign files are reported as being 5 pages.
I could set it to all pages, but then it takes to long to save really big files.

Image
Padawan
Advanced member
Posts: 358
Joined: Mon Jun 12, 2017 8:48 pm
Location: Belgium
Contact:

Re: Number of pages of InDesign-file

Post by Padawan »

You can lower the indesing saving time for all pages by lowering the preview resolution. But that may be a problem if you use the preview.
User avatar
JimmyHartington
Advanced member
Posts: 310
Joined: Tue Mar 22, 2011 7:38 am

Re: Number of pages of InDesign-file

Post by JimmyHartington »

We use the preview internally to preview files with Quick-look before opening. Which is why I prefer 5 pages with higher resolution instead of all pages at lower resolution.
Post Reply