Page 1 of 1

Number of pages of InDesign-file

Posted: Tue Aug 22, 2023 11:07 am
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.

Re: Number of pages of InDesign-file

Posted: Mon Aug 28, 2023 2:18 pm
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.

Re: Number of pages of InDesign-file

Posted: Mon Aug 28, 2023 2:22 pm
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.

Re: Number of pages of InDesign-file

Posted: Tue Aug 29, 2023 1:20 pm
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.

Re: Number of pages of InDesign-file

Posted: Mon Sep 04, 2023 7:56 am
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

Re: Number of pages of InDesign-file

Posted: Mon Sep 04, 2023 8:19 am
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.

Re: Number of pages of InDesign-file

Posted: Mon Sep 04, 2023 10:25 am
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.