[Java] Getting page count of a PDF
I'm currently working on a project that requires i get the page count of some PDFs, and this part of the system is written in Java. I've been trying to figure this out for a few days, and I've only come up with two options:
[list=1][*]I've written a Java class that opens PDFs using java.io.RandomAccessFile to parse though the PDF to determine the page count (had to read the PDF spec). I don't really trust this because, well, I wrote it.[*]Use Visual Basic to create an ActiveX DLL. Using VB, I can create an Acrobat document object and query the page count with Adobe's libraries. To integrate this DLL, I'd create a C DLL using gcc that links to the DLL that can be called via-JNI. That seems a bit complex.[/list=1]
The best option would be a Java library from Adobe, or a method to determine the page count from a PDF directly in C. Anyone have any suggestions?
|