Copy link to clipboard
Copied
I have a program that generates postscript then "prints" the script to a PDF file using gs.
The user can opt for the document to be in landscape format. The program handles this by using the adding the "90 rotate" command early in the script. This works with no problem. When the user opens the resulting PDF in Adobe Acrobat, it is displayed in landscape orientation.
Also, the user can optionally have a "watermark" added to the document which is text at a 60 degree angle. This is handled by issuing the "60 rotate", then the watermark text, then "-60 rotate". This also works with no problem. The resulting PDF file has watermark text at a 60 degree angle in relation to the rest of the text in the document.
The problem is when these two options are used together. The document is assembled correctly (in landscape orientation with a correctly angled watermark) but it is displayed in Acrobat in portrait requiring the user to rotate it to be able to read it. When I look at the postscript, it appears to be correct, merely the sum of the above two options:
90 rotate
... some stuff ...
60 rotate
... watermark text ...
-60 rotate
... the rest of the document ...
The "net rotation" is 90, leading me to believe that it would be displayed in landscape orientation but it is displayed in portrait.
There is no other page sizing declared in the script.
How can I get the document to display in landscape when opened in Acrobat? Thanks.
Check to see that "gs" (ghostscript) isn't reorienting the page, by default, based on what it thinks the correct reading direction is.
Copy link to clipboard
Copied
Check to see that "gs" (ghostscript) isn't reorienting the page, by default, based on what it thinks the correct reading direction is.
Copy link to clipboard
Copied
My best guess is what you suggest... that gs is able to deduce the correct orientation when the text is at only one angle. When there is text at multiple angles, it cannot identify the orientation and uses the default: portrait.
However, I don't know how I can verify this hypothesis. There is nothing in our implementation of Ghostscript that explicitly does anything with page orientation. We are using Ghostscript gsdll32.dll Interpreter API with a .NET wrapper.
Any ideas on how to resolve the issue? I tried adding "<< /PageSize [792 612] >> setpagedevice" to the postscript to try to force landscape, but it didn't do anything.
Copy link to clipboard
Copied
I found a solution. I added ""<</Orientation 3>> setpagedevice" to the postscript and "-dAutoRotatePages=/None" to the gs call. The PDF file is now oriented correctly in Acrobat.
Thank you Mr. Horton for pointing me in the right direction.
Copy link to clipboard
Copied
Hi,
I am looking for the same solution to change the file in Landscape when I push Print button. Can you please help me which .ps file i need to mention your code?
Thank you
Anitha