The function getPageDimensions (of CAM::PDF) returns same values for both portrait and landscape pages. How can I identify the orientation of a PDF page? I am using CAM::PDF Perl library and would like to know how to do this using this library. But any other means to identify this is also welcome (preferably using a Perl lib).
Thanks.
I’m the author of CAM::PDF.
Well, there’s two parts to this. One is the page’s dimensions, as you noted. That works as expected: I used Apple’s Preview.app to rotate a PDF file and ran these two command lines:
But there’s also the `/Rotate’ page attribute. The argument is a number of degrees (default 0, but 90 or 270 are not uncommon). Like page dimensions, it’s an inheritable property so you have to navigate to parent pages. Here’s a quick-and-dirty command line tool to output the rotation value: