From ripley@stats.ox.ac.uk  Thu May 31 22:55:17 2001
From: ripley@stats.ox.ac.uk (Prof Brian D Ripley)
Date: Thu, 31 May 2001 22:55:17 +0100 (BST)
Subject: [Rd] paper size in postscript driver
In-Reply-To: <Pine.LNX.4.04.10105310901380.2031-100000@xyzzy.dsl.speakeasy.net>
Message-ID: <Pine.GSO.4.31.0105312248180.22000-100000@auk.stats>

On Thu, 31 May 2001, Trent Piepho wrote:

> 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.

Let's not get confused here.  What you are asking for is the job of your
print spooling software.  Proper postscript should have a DSC comment
specifying the paper size, and R's does:

%!PS-Adobe-3.0
%%DocumentNeededResources: font Symbol
%%+ font Helvetica
%%+ font Helvetica-Bold
%%+ font Helvetica-Oblique
%%+ font Helvetica-BoldOblique
%%DocumentMedia: a4 595 841 0 () ()
...

If you use the paper size by "special" this is set, and it is the job of
your spooler to make use of it.  Looks like yours is deficient
(and that's not unlikely if you are not using a proper spooler).  *But*
we can't fix this in R without breaking it for those who do run
proper print management software.

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
Prof Brian D Ripley