Bug 592930 - Setting page orientation
Summary: Setting page orientation
Status: NOTIFIED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PDF Writer (show other bugs)
Version: master
Hardware: All All
: P2 normal
Assignee: Ralph Giles
URL:
Keywords: bountiable
Depends on:
Blocks:
 
Reported: 2002-08-08 22:45 UTC by Jack Moffitt
Modified: 2008-12-19 08:31 UTC (History)
1 user (show)

See Also:
Customer:
Word Size: ---


Attachments
patch (3.93 KB, patch)
2003-06-11 11:12 UTC, Alex Cherepanov
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jack Moffitt 2002-08-08 22:45:03 UTC
Originally reported by: nobody@users.sourceforge.net
This problem really stems from Acrobat.
Acrobat determines the page orientation to display 
based on the dominant text orientation on the page.
Unfortunately many of my pages have graphs, and the 
text has both orientations, and so the graphs randomly 
display as portrait (wrong) or landscape(right).

I need a way to explicitly force the display orientation of 
each page.

simon@rakon.co.nz
Comment 1 Russell Lang 2002-08-09 02:53:46 UTC
Comment originally by ghostgum@users.sourceforge.net
Logged In: YES 
user_id=20387

The first thing is that Acrobat Reader uses the orientation 
specified in the PDF file.  If nothing is specified, it uses 
Portratit.  Any auto-rotation of pages is done by the 
application which generated the PDF.

See the Acrobat Distiller parameters.
For example -dAutoRotatePages=/None or /All 
or /PageByPage.

To rotate an individual page, try adding the DSC comment
%%PageOrientation: Landscape
%%PageOrientation: Portrait
just after the %%Page: line.
This may force the orientation, but there is an issue over 
whether the auto sensing or DSC comments have priority.

I think there is some other code you can use to specify the 
page orientation (e.g. pdfmark), but I can't find the details.

Comment 2 Russell Lang 2002-08-11 05:37:15 UTC
Comment originally by ghostgum@users.sourceforge.net
Logged In: YES 
user_id=20387

The other method is to explicitly set the orientation with
setpagedevice:
  << /Orientation 3 >> setpagedevice
Valid values are 0 (portrait), 3 (landscape), 2 (upside down)
and 1 (seascape).
Comment 3 Jack Moffitt 2002-10-24 10:18:38 UTC
Comment originally by jackiem@users.sourceforge.net
Logged In: YES 
user_id=206537

Need better docs for this.  It is a common problem.
Comment 4 Alex Cherepanov 2003-06-11 11:12:04 UTC
Created attachment 193 [details]
patch

Fix DSC parser (which doesn't help much) and document existing
behavior. IMHO every file can be committed separately because
they all fix independent problems.

For gdevpdfp.c
Fix mis-identificaion of every DSC-conforming file as EPS.

For gs_pdfwr.ps
Activate DSC parser only after all prologue files are read to
prevent spurious comments starting with '%%' disturbing the parser.

For gs_stres.ps
Use single '%' in the comment.

For Ps2pdf.htm
Add a paragraph documenting current page orientation options.
Comment 5 Ralph Giles 2003-06-13 07:03:56 UTC
Thanks for tackling this. Some comments:

In the docs we default to the unix convention of command line options. i.e. is
should be -dAutoRotatePages=/None. The need to substitute '#' on windows is
documented in Use.htm; if you want to mention it again here that's fine.

Documenting the current behavior is certainly a step in the right direction, but
it doesn't really answer the question posed by the bug, "How do I force a
particular page orientation?" I think that's needed to consider the bug
resolved. For example, the setpagedevice example helps if you know Ghostscript,
but isn't of any utility with the ps2pdf script itself.

Unfortunately, as coded it doesn't doesn't even let you say -c '<< /Orientation
3 >> setpagedevice' and I didn't find any quoting magic that would pass the
option through cleanly. Perhaps we need a -dOrientation=? option added to
ghostscript for this. 

In any case maybe the answer is "you can't". If so, the docs should state this
definitively, but taking the time to convince myself that was true is why this
bug is bountiable in the first place. :)
Comment 6 Alex Cherepanov 2003-06-18 13:05:02 UTC
The patch to ps2pdf.htm and the patches to DSC handling code
are committed to HEAD branch.
Comment 7 Stefan Kemper 2005-05-11 07:52:42 UTC
*** Bug 688081 has been marked as a duplicate of this bug. ***