Skip to main content
nihads63401021
Participant
November 7, 2018
Answered

Best way to count PDF Pages in Illustrator Script

  • November 7, 2018
  • 2 replies
  • 1373 views

Hi!

I'm trying to count the total Page amount of a PDF File in JavaScript but haven't found any decent solution so far.

Any ideas?

This topic has been closed for replies.
Correct answer subieguy2

What version of Illustrator are you using?

The latest version of Illustrator will open multiple page PDFs...

Since you are most likely on an older version of Illustrator you can use the open multiple page pdfs script....

It opens all the pages of a PDF on individual artboards.

http://aiscripts.com/

Then my script would work.

2 replies

nihads63401021
Participant
November 8, 2018

Thx! Yes I'm working with Illustrator CS6.

Sadly the link returns 404.

Here is an extended version of the script:

ExtendScripts4AI-ID/AI_Multi-Page PDF Loader 4 AI v2.5.jsx at master · arnaudin/ExtendScripts4AI-ID · GitHub

subieguy2
Inspiring
November 7, 2018

You could just have it count the art boards...then alert you

alert("There are " + app.activeDocument.artboards.length + " pages");

nihads63401021
Participant
November 8, 2018

This will always return 1 as you can only open one PDF page at once

subieguy2
subieguy2Correct answer
Inspiring
November 8, 2018

What version of Illustrator are you using?

The latest version of Illustrator will open multiple page PDFs...

Since you are most likely on an older version of Illustrator you can use the open multiple page pdfs script....

It opens all the pages of a PDF on individual artboards.

http://aiscripts.com/

Then my script would work.