From xyzzy@speakeasy.org  Thu May 31 18:48:26 2001
From: xyzzy@speakeasy.org (Trent Piepho)
Date: Thu, 31 May 2001 10:48:26 -0700 (PDT)
Subject: [Rd] paper size in postscript driver
Message-ID: <Pine.LNX.4.04.10105310901380.2031-100000@xyzzy.dsl.speakeasy.net>

I have a non-PS printer setup to print under linux using ghostscript as a
filter.  This printer has two paper trays, one has letter paper, the other
tabloid size paper.  If I print from a program that uses a PPD file to
configure the printer, like StarOffice or The Gimp, I can select the paper
size from a nifty list.  If I select letter size, the printer print with
paper from the letter tray.  If I select tabloid, the printer will use
the tabloid tray.

I added tabloid to R's list of supported paper sizes, which was pretty
trivial.  If I view the file with gv/ghostscript, I get a tabloid sized window
on the screen with my plot.  But if I print, the printer uses the letter tray
and the plot is cropped to the letter size paper.

I looked postscript from staroffice vs R, and noticed these lines:
%%BeginSetup
%%BeginFeature: *PageRegion Tabloid

        << /PageSize [792 1224] /ImagingBBox null >> setpagedevice
%%EndFeature
%%EndSetup

These follow the "%%EndProlog" line in the postscript file.  If I add these
lines to an R produced tabloid sized ps file, it will print on tabloid paper!

It doesn't view properly in gv though.  When looking at a plot in landscape
orientation, the right edge is cut off.  Tabloid is 11" x 17", and it looks
like the right 6" is cut off, as if the landscape plot is being clipped to a
bounding box of portrait oriented paper.  The plots do not get cut off when
viewed if I don't add that bit of code.  The plots do print fine, which is odd
since both the printer and gv use ghostscript to process the postscript file. 

Maybe some postscript guru could add this feature to R's PS driver?  It looks
like some kind of setpagedevice call is needed to tell the printer what paper
size to use.

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] paper size in postscript driver
Trent Piepho