Highlighted

How to get the number of pages in a PDF

Adobe Community Professional ,
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

5.4K

Likes

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

How to get the number of pages in a PDF

Adobe Community Professional ,
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

5.4K

Likes

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

Likes

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
Reply
Loading...
Mar 14, 2016 0
New Here ,
May 01, 2016

Copy link to clipboard

Copied

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

Likes

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
Reply
Loading...
May 01, 2016 0
K.Daube LATEST
Advocate ,
May 04, 2016

Copy link to clipboard

Copied

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

Likes

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
Reply
Loading...
May 04, 2016 0