ps2pdf behavior regarding page orientation with eps images

While writing a paper I was puzzled to see that although I was not putting anything in LaTeX code to affect the orientation of the page (Image 1), some pages were rotated at the final pdf file (Image 2). But why was that? Although I did play around to see if there was something wrong with the images, or the code, or whatever could possible go wrong with the LaTeX, the output was the same.


Image 1: The LaTeX code – nothing unusual here, just inserting some figures.


Image 2: The final pdf output. Clockwise: (1) a page with text, (2) a page with some figures properly shown, (3) the problematic page – it should be oriented as portrait and not landscape, (4) the next page with, properly displayed, plots.

From the final pdf document (Image 2, “page” 3) it is obvious that LaTeX does not do anything wrong. The page has the proper portrait orientation, but the pdf page is rotated. Looking around to see what could go wrong with the ps2pdf conversion I found out that:
“By default Ghostscript determines viewing page orientation based on the dominant text orientation on the page. Sometimes, when the page has text in several orientations or has no text at all, wrong orientation can be selected.” [1]

Since the images used are eps files [2], which means that they are text files, and they have plenty of text vertically oriented, Ghostscript takes their orientation as the proper one. When I manually run:
ps2pdf -dAutoRotatePages=/None file.pdf
these orientation issues removed.

Another idea is to use some extra invisible text (like white text in a white background) in order to increase the horizontal text. That way Ghostscript will select the right orientation from the beginning. A way to do it is presented in [3], but in my case it didn’t work well as it was also increasing the length of caption resulting in its displacement. Moreover, if highlighted the text become visible.

[1] Ps2pdf/Orientation

Leave a Reply

Your email address will not be published. Required fields are marked *