google-apps-scriptgoogle-docs

How do I find the page number/number of pages in a document?


I want to create a new document based on a template and need to know when my insertion or append results in a new page in the final printed output is there any property/attribute eg number of pages that can be used for this?


Solution

  • I've search this a lot in the past and I don't think there's any property or any other way to know page info.

    The solution I use is to insert page breaks on my template or via the script, using my own knowledge of how my template works, i.e. how much space it takes as I iterate, etc. And then I know which page I am by counting the page breaks.

    Anyway, you could an enhancement request on the issue tracker.