Tuesday 15 March 2011

python - How can I know page orientation in PDF files? -



python - How can I know page orientation in PDF files? -

i wanted open pdf file , check page orientation. nil else. there quick way using c++ or python?

i didn't want utilize external library this.

without using preƫxisting pdf handling library? nil "quick" nor "easy" that.

at least, must able read , parse pdf page tree, in turn requires read , parse pdf object tree (which may compressed , updated several times).

scanning page tree, may find pages rotated and/or have dimensions indicating wider high, or other way around (a mutual definition of "portrait" , "landscape"). of course, page may have size defined in landscape orientation rotated 90 or 270 degrees.

but it's more complicated that! page rotation or size not define orientation; ultimately, it's text on page defines it. suppose page has portrait size , not rotated; yet, possible have of contents (text , graphics) rotated -- sideways left or right, upside down, or @ other angle.

furthermore, pdf designed book or journal, it's not uncommon see upright page header and/or footer in "regular" position, , have content, such wide table, rotated.

.. of course, it's tremendous fun write of yourself. official pdf specification contains plenty info started; see pdf specifications coders: adobe or iso?. create sure reserve plenty of time read of it.

python pdf

No comments:

Post a Comment