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

How to get the number of pages in a PDF

Community Expert ,
Mar 11, 2016 Mar 11, 2016

Copy link to clipboard

Copied

I need to import a multiple page PDF into FrameMaker. I can specify each page number and it works successfully, but the missing piece is knowing how many pages are in the PDF. With FrameScript, I can use its EActiveXObject object to query the PDF and find out the number of pages. It can also be done with InDesign ExtendScript by using its app.doScript method to pass some Visual Basic to the PDF, returning its page count. I am trying to figure out how to do this with FrameMaker ExtendScript. Any ideas would be appreciated.

One thing I tried: I was hoping that once the page number I passed to the Import method exceeded the number of pages in the PDF that the command would fail. But it doesn't; it simply imports page 1.

Rick

TOPICS
Scripting

Views

6.0K

Translate

Translate

Report

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
Contributor ,
Mar 14, 2016 Mar 14, 2016

Copy link to clipboard

Copied

There's some simple JaavScript code in this thread that just searches the PDF for various regular expressions:

https://forums.adobe.com/thread/289547

Votes

Translate

Translate

Report

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
New Here ,
May 01, 2016 May 01, 2016

Copy link to clipboard

Copied

var Lpage = newDoc.numPages; will provide the total page count

Votes

Translate

Translate

Report

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 04, 2016 May 04, 2016

Copy link to clipboard

Copied

LATEST

IMHO the most reliable method is described here (following a link from previous posts):

https://forums.adobe.com/message/1112710#1112710

I have tested this with various items.

Klaus

Votes

Translate

Translate

Report

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