There is no page size associated with a PDF document. Every page in a PDF
document can have a different size. Even though some applications make the
assumption that all pages are the same size, and only display the size of
the first page, that is wrong for many documents.
To get the page size for one page, you would use the
As far as I know, there is no method to get the PDF version of a document
reading the first line of a document, you may not get the real version
information: A file may claim that it's PDF-1.2, but can contain
transparency, which was not added to the PDF spec until version 1.4. So to
get the real version of a PDF file, you need to look for features that are
used in the file.
Karl Heinz Kremer
PDF Acrobatics Without a Net