@node Part II Generating Hardcopies
@chapter Generating Hardcopies

A variety of tools are available that can be used to turn your
carefully constructed (and hopefully pleasing) user interfaces into
printed hardcopies or something appropriate for inclusion in your
program document. Most of these involves saving a snapshot of your
interface on the screen into a file. Then this file is translated into
something that a printer can understand, such as @code{PostScript}.
While this approach works, the resulting file is typically huge.
Further, by taking a snapshot of the screen, the resolution of the
output is limited by the screen resolution, which typically is much
lower than the printer resolution. This is especially evident for
text.

Another approach is to design the printing capabilities into the
objects themselves so the GUI is somewhat output device independent in
that it can render to different devices and X or the printer is just
one of the devices. While this approach works better than screen
snapshot, in general, it bloats the library unnecessarily. It is our
observation that most of the time when a hardcopy of the interface is
desired, it is for use in the application documentation. Thus we
believe that there are ways to meet the needs of wanting hardcopies
without bloating the library. Of course, some object classes, such as
xyplot, charts and possibly canvas (if vector graphics), that are
dynamic in nature, probably should have some hardcopy output support
in the library, but even then, the relevant code should only be loaded
when these specific support is actually used. This fattening problem
is becoming less troublesome as computers get faster and typically
have more RAMs nowadays.

@code{fd2ps} was designed to address the need of having a hardcopy of
the interface for application documentation development. Basically,
@code{fd2ps} is a translator that translates the Form Designer output
directly into @code{PostScript} or @code{Encapsulated PostScript} in
full vector graphics. The result is a small, maybe even editable,
@code{PostScript} file that you can print on a printer or include into
other documents.

The translation can be done in two ways. One way is to simply give the
Form Designer the command line option @code{-ps} to have it output
@code{PostScript} directly. or you can run @code{fd2ps} stand alone
using the command
@example
fd2ps fdfile
@end example
@noindent
where @code{fdfile} is the Form Designer output with or without the
@code{.fd} extension. The output is written into a file named
@file{fdfile.ps}.

@code{fd2ps} accepts the following command line options when run as a
stand-alone program
@
@table @code
@item -h
This option prints a brief help message.
@item -p
This option requests Portrait output. By default, the orientation is
switched to landscape automatically if the output would not fit on the
page. This option overrides the default.
@item -l
This option requests landscape orientation.
@item -gray
This option requests
all colors be converted to gray levels. By default, @code{fd2ps} outputs
colors as specified in the @code{.fd} file.
@item -bw @i{width}
This option specifies the object border width. By default, the border
width specified in the @code{.fd} file is used.
@item -dpi @i{res}
This option specifies the screen resolution on which the user
interface was designed. You can use this flag to enlarge or shrink the
designed size by giving a DPI value smaller or larger than the actual
screen resolution. The default DPI is 85. If the @code{.fd} file is
specified in device independent unit (point, mm etc), this flag has no
effect. Also this flag does not change text size.
@item -G @i{gamma}
This option specifies a value (gamma) that will be used to adjust the
builtin colors. The larger the value the brighter the colors. The default
gamma is 1.
@item -rgb @i{file}
The option specifies the path to the colorname database
@file{rgb.txt}. (It is used in parsing the colornames in XPM file).
The default is @file{/usr/lib/X11/rgb.txt}. The environment variable
@code{RGBFile} can be used to change this default.
@item -pw @i{width}
This option changes the paper width used to center the GUI on a
printed page. By default the width is that of US Letter (i.e.@: 8.5
inches) unless the environment variable @code{PAPER} is defined.
@item -ph @i{height}
This option changes the paper height used to center the output on the
printed page. The default height is that of US Letter (i.e.@: 11
inches) unless the environment variable @code{PAPER} is defined.
@item -paper @i{format}
This option specifies one of the standard paper names (thus setting
the paper width and height simultaneously). The current understood
paper formats are
@table @asis
@item Letter
8.5 x 11 inch.
@item Legal
8.5 x 14 inch
@item A4
210 x 295mm
@item B4
257 x 364mm
@item B5
18 x 20 cm
@item B
11 x 17 inch
@item Note
4 x 5inch
@end table
The @code{fd2ps} program understands the environment variable
@code{PAPER}, which should be one of the above paper names.
@end table
