lout-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PageSize


From: Peter Samuel
Subject: Re: PageSize
Date: Wed, 3 Feb 1999 04:05:05 +0300 (MSK)

On Mon, 1 Feb 1999, Monty Zukowski wrote:

> I've been generating some PostScript with Lout to be printed on a plotter
> and when I print it reels off a few extra feet of paper.  I consulted the
> printer manufacturer's web site, and they recommended adding a PostScript
> command such as this:
> 
> <</PageSize [1584 2448]>>setpagedevice
> 
> This sets the page size for the device (which can change since it prints off
> of a roll of paper.  I have been using a lout setup file with the proper
> margins and page size set to Other with appropriate sizes, but that didn't
> make the printer happy.
> 
> So, what's the best way to get that PostScript command into the Lout file
> for generation?  Do you know if there is a preferred place to include it
> into the document?

I have a package called psenlarge that will take PS and convert it to
PS with the relevant setpagedevice contructs. It requires Perl 5.x and
ghostscript 5.x (tested with 5.10 and 5.50). It uses the pswrite driver
to "normalise" the input PostScript. pswrite has a couple of little
quirks

    - dash dimensions are wrong. psenlarge attempts to correct for
    this

    - setlinewidths are wrong. psenlarge attempts to correct for this

    - some colour images lose colour. psenlarge cannot correct for
    this.

I've used it to scale images from A4 to A0 for our plotter (OCE5120
begin driven by ghostscript's HP DesignJet 650C engine) but it will do
just about anything you want. See the man page below.

It is available from

    ftp://ftp.uniq.com.au/pub/tools/psenlarge-1.3.tar.gz

Regards
Peter
----------
Peter Samuel                                address@hidden
Technical Consultant                        or at present:
Uniq Professional Services,                 address@hidden
a division of X-Direct Pty Ltd
Phone: +61 2 9206 3410                      Fax: +61 2 9281 1301

"If you kill all your unhappy customers, you'll only have happy ones left"

###########################################################################

PSENLARGE(1)              User Commands              PSENLARGE(1)



NAME
     psenlarge - enlarge or reduce a PostScript file

SYNOPSIS
     psenlarge -h
     psenlarge [-oP |-xnn -ynn] [-m] [-n] file.ps
     psenlarge [-p [-iP |-Xnn -Ynn]] [-m] [-oP |-xnn  -ynn]  [-m]
     [-n] file.ps

DESCRIPTION
     psenlarge enlarges or reduces a PostScript file to one of  a
     number of different paper sizes or a custom size.

     psenlarge uses Ghostscript to normalise the input PostScript
     by  converting  it  to  PostScript of a known form using the
     pswrite driver. This driver is shipped with Ghostscript 5.x.
     Therefore psenlarge requires Ghostscript 5.x or later. As of
     the writing of this software, Ghostscript 5.50 was the  most
     stable  release of Ghostscript known to work with psenlarge,
     however psenlarge will also work with Ghostscript 5.10.

     psenlarge bases  its  scaling  factors  on  the  BoundingBox
     information  obtained  from  the  pswrite driver.  psenlarge
     will attempt to maximise the scaling while  maintaining  the
     original  aspect  ratio.  For example, if the original is A4
     but only occupies the bottom quarter of the page,  psenlarge
     will  attempt  to  make the resulting BoundingBox occupy the
     entire page less a margin at each  edge  of  the  page.  The
     resulting BoundingBox will be centred on the page.

     psenlarge will only operate on the first file given  on  the
     command line. If a file name is not provided, standard input
     is used. The resulting PostScript is sent to  standard  out-
     put.

OPTIONS
     -h   Print the usage information

     -oP  The output paper size. Where P is one of:

                   Paper       Dimensions
                __________________________________________
                    A10        26 mm x 37 mm
                     A9        37 mm x 53 mm
                     A8        53 mm x 74 mm
                     A7        74 mm x 105 mm
                     A6        105 mm x 149 mm
                     A5        149 mm x 210 mm
                     A4        210 mm x 297 mm
                     A3        297 mm x 420 mm
                     A2        420 mm x 594 mm
                     A1        594 mm x 840 mm



SunOS 5.5.1       Last change: 27 October 1998                  1






PSENLARGE(1)              User Commands              PSENLARGE(1)



                     A0        840 mm x 1188 mm
                     B5        177 mm x 250 mm
                     B4        250 mm x 353 mm
                 US Letter     8 1/2 inches x 11 inches
                   Letter      8 1/2 inches x 11 inches
                 US Ledger     11 inches x 17 inches
                   Ledger      11 inches x 17 inches
                  US Legal     8 1/2 inches x 14 inches
                   Legal       8 1/2 inches x 14 inches
                  US 11x17     11 inches x 17 inches
                   11x17       11 inches x 17 inches
                 US Tabloid    11 inches x 17 inches
                  Tabloid      11 inches x 17 inches
                US Statement   5 1/2 inches x 8 1/2 inches
                 Statement     5 1/2 inches x 8 1/2 inches
                US Executive   7 1/2 inches x 10 inches
                 Executive     7 1/2 inches x 10 inches
                  US Folio     8 1/2 inches x 13 inches
                   Folio       8 1/2 inches x 13 inches
                 US Quarto     8.47 inches x 10.8 inches
                   Quarto      8.47 inches x 10.8 inches
                  US 10x14     10 inches x 14 inches
                   10x14       10 inches x 14 inches

          The default output paper size  is  A0.   -o  cannot  be
          specified with either the -x or -y options.

     -xnn -ynn
          The output paper size using custom measurements. The  x
          value is the width in PostScript points and the y value
          is the height in PostScript points. One point  is  1/72
          inches.  If the value is immediately followed by either
          an i or an m the units will be  inches  or  millimetres
          respectively. If both the -x and -y options have trail-
          ing unit qualifiers, the last unit qualifier  specified
          will  take  precedence. Both the -x and -y options must
          be specified together. These  options  cannot  be  used
          with the -o option.

     -m   Do not preserve the aspect ratio of the original  Boun-
          dingBox.   Adjust  the  scaling  to  use as much of the
          paper as possible, less a default margin at each  edge.
          Cannot be used with the -p option.

     -n   Do not enforce a margin at each of of the output  page.
          The  default margin is 25 PostScript points. Once point
          is 1/72 inches.

     -p   Use the ratio of input page size to output page size to
          determine  scaling  factors  instead of the input Boun-
          dingBox details.




SunOS 5.5.1       Last change: 27 October 1998                  2






PSENLARGE(1)              User Commands              PSENLARGE(1)



     -iP  The input page size. Where P is one of the  page  names
          listed in the table above. The default input paper size
          is A4. Can only be used with the -p option.  Cannot  be
          used with either the -X or -Y options.

     -Xnn -Ynn
          The input paper size using custom measurements.  The  X
          value is the width in PostScript points and the Y value
          is the height in PostScript points. One point  is  1/72
          inches.  If the value is immediately followed by either
          an i or an m the units will be  inches  or  millimetres
          respectively. If both the -X and -Y options have trail-
          ing unit qualifiers, the last unit qualifier  specified
          will  take  precedence. Both the -X and -Y options must
          be specified together. These options must be used  with
          the -p option. These options cannot be used with the -i
          option.

EXAMPLES
     The following examples assume that the  input  PostScript  -
     tiger.ps - has a BoundingBox of 0 0 598 843


     psenlarge tiger.ps
          Enlarge the file tiger.ps to A0. Use  as  much  of  the
          paper  as  possible  while preserving the aspect ratio.
          Leave a margin at each edge of the output page.  Output
          will be sent to STDOUT.

     cat tiger.ps | psenlarge -oB5 -n
          Reduce the file tiger.ps to B5. Preserve  the  original
          aspect  ratio  of the BoundingBox.  Do not use any mar-
          gins. Output will be sent to STDOUT.

     psenlarge -oLetter tiger.ps > tiger.letter.ps
          Convert the file tiger.ps to US  Letter  and  save  the
          output  in the file tiger.letter.ps.  Preserve the ori-
          ginal aspect ratio of the BoundingBox .

     psenlarge -o"US Letter" tiger.ps > tiger.letter.ps
          Convert the file tiger.ps to US  Letter  and  save  the
          output  in the file tiger.letter.ps.  Preserve the ori-
          ginal aspect ratio of the BoundingBox . Note the use of
          the  alternative paper name and the need for the double
          quotes.

     psenlarge -x8.25i -y10.5 -n tiger.ps
          Convert the file tiger.ps to a custom  size  of  8  1/4
          inches  by  10 1/2 inches. Preserve the original aspect
          ratio of the BoundingBox.  Do not use any margins.

     psenlarge -x8.25i -y10.5m -n tiger.ps



SunOS 5.5.1       Last change: 27 October 1998                  3






PSENLARGE(1)              User Commands              PSENLARGE(1)



          Convert the file tiger.ps to a custom  size  of  8  1/4
          millimetres  by 10 1/2 millimetres. Preserve the origi-
          nal aspect ratio of the BoundingBox.  Do  not  use  any
          margins.   Note  that the units are millimetres in this
          case as the second unit qualifier  m  takes  precedence
          over the first.

     psenlarge -p -X598 -Y843 -oB5 tiger.ps
          Reduce the file tiger.ps to B5. Base the scaling on the
          ratio of the input size of 598 PostScript points by 843
          PostScript points to the size of a B5 page less a  mar-
          gin  at each edge of the B5 output page. Output will be
          sent to STDOUT.

CAVEATS
     The pswrite driver can often generate files that are  signi-
     ficantly larger than the original PostScript input file.

     psenlarge will not  improve  the  resolution  of  the  input
     images.  If the scaling factor is greater than 1 then output
     pixels will  be  scaled  accordingly.  This  can  result  in
     heavily pixelated images at large magnifications.

     The pswrite driver  appears  to  have  a  problem  with  the
     PostScript  setdash  operator. Values for this operator seem
     to be 72 times larger than they should be.  Correcting  this
     situation  can  result in large gaps in the dashed lines for
     large magnifications.  psenlarge attempts to compensate  for
     this anomaly by dividing the setdash values by 36 instead of
     72. Testing has thus far been limited to only a few cases.

     The pswrite driver  appears  to  have  a  problem  with  the
     PostScript  setlinewidth  operator. Values for this operator
     seem to  be  10  times  smaller  than  they  should  be  for
     Ghostscript  5.10  and 100 times smaller than they should be
     for Ghostscript 5.50.  Correcting this situation can  result
     in  lines  which  are  too  thick  for large magnifications.
     psenlarge attempts to compensate for this anomaly by  multi-
     plying  the  setlinewidth  values  by 5 instead of 10 in the
     case of Ghostscript 5.10 and by 50 instead  of  100  in  the
     case of Ghostscript 5.50.  Testing has thus far been limited
     to only a few cases.

     The pswrite driver appears to have some problems with colour
     images.  Occasionally  colour  images will have their colour
     maps altered so that they appear as black and white  images.
     There  seems to be no way of determining whether the pswrite
     will affect colour images until the image  is  processed  by
     the pswrite driver.

     psenlarge attempts to catch PostScript errors  by  examining
     the  standard  output from Ghostscript. This may not work in



SunOS 5.5.1       Last change: 27 October 1998                  4






PSENLARGE(1)              User Commands              PSENLARGE(1)



     all cases - especially if the input PostScript file has  its
     own   error   handling   routines  that  override  those  in
     Ghostscript's  own  systemdict  dictionary.    Ghostscript's
     standard output is redirected to psenlarge's standard error.

     psenlarge will handle multi page files however the Bounding-
     Box  details  generated  by  the  pswrite driver are for the
     entire document. If, for example, page 1  occupies  the  top
     right corner and page 2 occupies the bottom left corner, the
     BoundingBox generated by pswrite  will  be  for  the  entire
     page.

VERSION
     Version 1.3

AUTHOR
     Peter Samuel, Uniq Professional Services

SEE ALSO
     gs(1).


SunOS 5.5.1       Last change: 27 October 1998                  5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]