Skip to main content
Inspiring
September 20, 2017
Answered

How to get acrobat page count from Indd CS6 with js

  • September 20, 2017
  • 1 reply
  • 650 views

Hi,

I need to get count of pages in the acrobat file that will be placed into Indd. How can I get this data:

var myFile = File (myFilePath);

pdfPageCount = myFile.pageCount();

Could not find anything in OMV.

Thank you for your help.

Yulia

This topic has been closed for replies.
Correct answer Jongware

You probably didn't find anything because nobody calls a PDF an "acrobat file". Here is a long thread from 2008 on, discussing various methods: How can I get a total page count of a PDF before placing every page in the PDF?

There is not one single 'best' method, though. In a worst case scenario, you must not only parse an entire object tree (which may include addenda), but for modern PDFs you may need to implement a deflate algorithm in JavaScript.

1 reply

Loic.Aigon
Legend
September 21, 2017

Search through the forum, there was some snippet exposed which seemed to do the job.

Inspiring
September 21, 2017

I did search through the forum, do you have a little bit more info about where to find that snippet?

Jongware
Community Expert
JongwareCommunity ExpertCorrect answer
Community Expert
September 22, 2017

You probably didn't find anything because nobody calls a PDF an "acrobat file". Here is a long thread from 2008 on, discussing various methods: How can I get a total page count of a PDF before placing every page in the PDF?

There is not one single 'best' method, though. In a worst case scenario, you must not only parse an entire object tree (which may include addenda), but for modern PDFs you may need to implement a deflate algorithm in JavaScript.