Skip to main content
frameexpert
Community Expert
Community Expert
March 11, 2016
質問

How to get the number of pages in a PDF

  • March 11, 2016
  • 返信数 3.
  • 6125 ビュー

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

このトピックへの返信は締め切られました。

返信数 3

K.Daube
Community Expert
Community Expert
May 4, 2016

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

bnanilgowdaa
Participating Frequently
May 1, 2016

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

Participating Frequently
March 14, 2016

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

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