Landscape printing

Helge Blischke h.blischke at acm.org
Fri Jul 29 12:27:34 PDT 2011


Ray Stacey wrote:

>> Ray Stacey wrote:
>>
>> >> Ray Stacey wrote:
>> >>
>> >> >> Ray Stacey wrote:
>> >> >>
>> >> >> >> Ray Stacey wrote:
>> >> >> >>
>> >> >> >> > We are running cups 1.4.7 on Solaris 10. I'm trying to print a
>> >> >> >> > postscript file from our application using the command lp -o
>> >> >> >> > landscape -o PageSize=Legal -d treekill2
>> >> >> >> > INV-R200.r01.17206.ps.
>> >> >> >> >
>> >> >> >> > The file prints on legal paper, however the first page is
>> >> >> >> > landscape and each subsequent page is rotated 90 degrees. So
>> >> >> >> > the first page is fine, the 5th page is fine, the 9th page is
>> >> >> >> > fine ....
>> >> >> >> >
>> >> >> >> > Any ideas??
>> >> >> >>
>> >> >> >> What make and model is the printer?
>> >> >> >> How is it configured?
>> >> >> >> is there a *cupsFilter line in the printer's PPD?
>> >> >> >> is there a *LandscapeOrientation: xxxx
>> >> >> >> where xxxx is either Plus90 or Minus90 in the PPD?
>> >> >> >>
>> >> >> >> Helge
>> >> >> >>
>> >> >> > It's an HP 8100. It is configured using the ppd file from the
>> >> >> > cups website. THere is no *cupsFilter and LandscapeOrientation is
>> >> >> > Plus90.
>> >> >> >
>> >> >> > I tried the same command with a generic postscript sample file
>> >> >> > and I'm not seeing the rotation problem. That means there is
>> >> >> > something wrong with the postscript output from our application.
>> >> >> > No idea what it could be, I don't know postscript language at
>> >> >> > all.
>> >> >>
>> >> >> Then post (an URL to) a sample file and do the following:
>> >> >> cupsctl --debug-logging
>> >> >> print the sample file
>> >> >> cupsctl --no-debug-logging
>> >> >> post the portion of the /var/log/cups/error_log that contains the
>> >> >> messages related to the test job.
>> >> >>
>> >> >> Helge
>> >> >>
>> >> > Here you go:
>> >> >
>> >> > http://home.sourcecable.net/~raystacey/test.ps
>> >> >
>> >>
>> >> Ray,
>> >>
>> >> your PostScript job itself contains the necessary transformation for
>> >> landscape printing, and the contents of each page - including the
>> >> showpage execution - is enclosed in a save / restore pair.
>> >> Thus, the transformation inserted by cups' pstops filter for landscape
>> >> printing acts outside the page contents bracketed by save and restore
>> >> what results in every page rotated by 90 degrees with respect to the
>> >> previous.
>> >>
>> >> Please try printing without the "-o landscape" option; I'm pretty sure
>> >> you'll get the right printout then.
>> >>
>> >> Helge
>> >>
>> > I see what you mean. However, if I print without "-o landscape" it
>> > prints in portrait mode. The printout is on legal, but it is not
>> > rotated.
>>
>> Well, can you modify your application to output a PostScript stream as
>> indicated by the following context diff output?
>>
>>>
>> If not, I'd suggest to set up a prefilter or similar that does the
>> modification.
>>
>> Helge
>>
>>
> 
> I made those changes to my test.ps and it printed properly. Can you
> explain what the difference is, it's not clear to me?

Well, fairly early in the setup section, there is the statement

[ 582.0 1008.0 108.0 75.0 12.0 12.0 true 30.0 2.0 0.995000 false true false true true true ] init

which, in essence, configures the page layout (or the page geometry, whatever you like).
The last item in the array (the stuff between the brackets) defines if landscape transformation
is to be done or not, and the last statement in the PostScript procedure which makes up the
init operator just executes the transformation if specified for the first time, so that it will be
active for the first page. For the subsequent pages this transformation is repeated within the 
newpage procedure.

On the other hand, cups' pstops filter inserts the defaults from the PPD preferably just after
the %%BeginSetup comment line (or around some other suitable comment line, if the %%BeginSetup
is missing).
Most of the statements inserted from the PPD defaults call the setpagedevice operator,
which resets the graphic state to some extent, espeically reverts to the default coordinate system.
That means, the landscape transformation executed by the init procedure preceding the call
of setpagedevice is undone by the latter.

My proposed modification ensures that the init call is the last statement in the setup section.

Helge

PS: Note that this modification is not (yet) totally bomb proof. It would be better to
(1) delete the statement
DoRotate { 0 Hpts translate -90 rotate } if
from the init procedure, and
(2) insert just after the line
/Saveobj save def
the statements
DoRotate { 0 Hpts translate -90 rotate } if
iYpos


for the first (and only the first) page.





More information about the cups mailing list