PDF Page Count Algorithm | December 2004 |
It's not often that you can't find coding examples on the internet to do basic programming tasks, so I was surprised when I couldn't find code to determine the page count of PDF documents. I've had to return to my old hacking ways (ie 'hacking' in its original sense). I visited my favorite hacking website - www.wotsit.org, downloaded the PDF document specifications and got coding. It didn't take too long to construct a reasonably efficient algorithm which does what I want. I've thrown a few PDFs at it over the last couple of days so I hope I've squashed most of the bugs. Update 22-Dec-2005: Yes, I did find a couple of minor bugs which have now been corrected. |
|