Welcome to the Monastery PerlMonks

### Re^3: Determining a PDF's orientation

by JamesNC (Chaplain)
 on Aug 22, 2005 at 21:29 UTC ( #485774=note: print w/replies, xml ) Need Help??

in reply to Re^2: Determining a PDF's orientation
in thread Determining a PDF's orientation

That is a pretty big buffer size and I think 1024 would do just as well because it just gets chopped up anyway. R:0 means that the optional /Rotate entry is missing. If you know the page is in landscape mode, then the page MediaBox should match the page ie 0 0 792 612 would be 792 wide by 612 high ( 11 x 8 1/2 inches ). Now, if the text is rotated and it is not due to the /Rotate option in the viewer, then the reason is because the user space has been tranformed. In pdf speak:
```    my \$angle = 90;
my \$cos = sprintf("%.4f",cos( \$angle*PI/180 ));
my \$sin = sprintf("%.4f",sin( \$angle*PI/180 ));
my \$sin2 = -\$sin;
\$rotate = "\$cos \$sin \$sin2 \$cos 0 0 cm ";
the rotate scalar entry is applied to the contents of the page and then everything in that space still operates as if x and y are still the same.... but the page is just rotated.
The page contents are often LZW or deflate encoded and you would have to decompress the contents to see if that were the case... kind of messy to do by hand if that is the case. I know how to do it... but that may not be the best solution for you. I would just try to infer from the page size and go from there. That is part of the challenge of trying to decode a Pdf... if the user space is tranlated or transformed then the consumer application needs to be aware of that. Perhaps you should send the author of that Pdf module a message to alert them about your problem, he might have overlooked something.
Wish I could be more helpful.
JamesNC

Create A New User
Node Status?
node history
Node Type: note [id://485774]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2018-03-18 12:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
When I think of a mole I think of:

Results (230 votes). Check out past polls.

Notices?