

YES! But only one of those is the ROOT set. I have been getting a lot of emails asking me about this issue, saying that there are more then one "/Type /Pages" inside their PDF file. So Once you find the "/Type /Pages" inside the text of your PDF file, the "/Count " that follows it will have the number of pages in it. In other words, you would simply have to look for the "/Count ", and the number of pages will be right in front of it. SO, You must find the node with /Count XX and Without /Parent terms, and you'll get total pages of PDF a PDF may not only a pages tree node, The right answer is in "root page tree node", if /Count XX with /Parent XXX node, it not "root page tree node" If a PDF have 63 pages, the page tree node will like this. The tree structure allows PDF applications, using little memory to quickly open a document containing thousands of pages. PDF set a "Page Tree Node" to define the ordering of pages in the document.

How to get how many pages in a PDF? I read PDF spec.
Are there any libraries or examples of how to do this? I've done a bit of Googling and the only things I've found either utilize shell/bash scripts, perl, or other languages, but I need something in native PHP. I need a way to count the number of pages of a PDF in PHP. I′m interested in your php code for pdf page number count. I need a command line tool that can determine the number of pages in a pdf and or a library that could be used from PHP.Ĭan anyone please help me providing script to get the number of pages in a PDF file? How to get number of pages in a PDF file?
