Ps2pdf bug? The pdf output is rotated relative to the ps output
Asked Answered
H

1

5

I am having a bizarre problem in converting postscript to pdf using ps2pdf. Here is a minimal code snippet that causes the problem.

/Times findfont 40 scalefont setfont
-1 1 scale
15 15 moveto (R) show

This should show the letter, horizontally reflected. And when I view the postscript, that's what I see. But if I take the code above, save it as a file "bad.ps" and run the following command on it

ps2pdf bad.ps

I get a vertically reflected letter R.

I get the same problem with other fonts. BUT when I just draw lines, etc., the problem goes away. Any ideas?

Hasid answered 26/2, 2013 at 19:53 Comment(1)
note you are also drawing off page (in negatve page space). Properly to draw a backwards R at page 15 15 you need : -1 1 scale -30 15 moveto (R) show - and with that I reproduce your unexpected 180 rotation.Unbalance
D
9

It sounds like the orientation of the PDF is rotated. By default, PS2PDF detects the orientation based on the dominant text orientation on the page. To override this behavior, use the

-dAutoRotatePages=/None

command line option. This option is described in more detail on the PS2PDF command line reference.

Dyne answered 26/2, 2013 at 22:33 Comment(3)
confirm this works (With the -30 mod in my other comment). I'd still flag this a bug, by what logic does the code decide upsidedown is better than backwards?Unbalance
Its a heuristic, it tries to get text to go left->right, sometimes it gets it wrong, heuristics do that.Barty
Still I think if you don't want to have pages rotated, use the settings (and accept it as a valid answer).Culinarian

© 2022 - 2024 — McMap. All rights reserved.