Does anyone know how I can count the number of pages in a pdf file using php? Thanks!
PDFs store pages in a tree. "/Pages" objects can have a "/Parent" and "/Kids" entries, followed by a "/Count". You can't sum the "/Count" entries because a Kid might be another Pages node. The "/Page" object is the leaf.
Open the pdf as a text file and count the number of times "/Page" (not "/Pages") appears in the file. That should be correct most of the time.