CD_PS - PostScript Driver (cdps.h)

This drivers allows generating a PostScript file. This format was created to be a high-quality graphics language for printers and is currently supported by several printers. If your printer supports PostScript, you can send the file generated by the driver directly to the printer port. Usually, the filename has an extension .PS or .EPS. The driver generates level-2 PostScript, therefore some PostScript viewers might present errors. The format's copyrights are property of Adobe Systems.

Use

The file is created and opened by calling function cdCreateCanvas(CD_PS, Data), in which Data contains the filename and canvas dimensions. This function opens the file and writes its header. Then, other functions in the CD library can be called as usual. The Data parameter string has the following format:

"filename -p[paper] -w[width_mm] -h[height_mm] -l[left_mm] -r[right_mm] -b[bottom_mm] -t[top_mm] -s[resolution_dpi] [-e] [-g] [-o] [-1] -d[margin_mm]"
or in C
"%s -p%d -w%g -h%g -l%g -r%g -b%g -t%g -s%d -e -o -1 -g -d%g"

The filename must be inside double quotes (") if it has spaces. Any amount of such canvases may exist simultaneously. It is important to notice that a call to function cdKillCanvas is required to close the file properly.

Paper Size - The default paper size is A4. It is possible to change it by using one of the predefined sizes - CD_A0, CD_A1, CD_A2, CD_A3, CD_A4, CD_A5, CD_LETTER and CD_LEGAL - with parameter "-p". It is also possible to define a paper in a particular size by using parameters "-w" e "-h". Values are provided in millimeters.

Default Paper Sizes
  Width (mm) Height (mm)
A0 841 1187
A1 594 841
A2 420 594
A3 297 420
A4 210 297
A5 148 210
Letter 216 279
Legal 216 356

Margins - The margins are controlled by parameters "-l" "-r" "-t" and "-b" (left_mm, right_mm, top_mm, bottom_mm). Values are provided in millimeters. Default margins are 25.4 mm to all parameters. You can draw only inside the margins.

Resolution - Resolution is used to convert values from millimeters to pixels (the same as points, but the number of points is per inch - DPI). Use parameter "-s" to configure the resolution. The default value is 300 DPI.

Orientation - The page can be oriented as portrait or landscape. The default value is portrait, but when the parameter "-o" is used, the horizontal and vertical values are switched.

EPS - The PostScript file can be in an Encapsulated PostScript format. For such, simply specify the parameter "-e". It is useful for other applications to import the PostScript file. You can define the margins of the bounding box by means of parameter "-d", in millimeters.

Debug - Parameter "-g" adds a series of comments to the PS file, making the beginning and end of a command from the CD library explicit. It is useful only for those who understand PostScript and wish to identify a problem. It considerably increases the file size.

Level 1 - Parameter "-1" forces the driver to generate a level-1 PostScript. In this case, pattern, stipple and hatch are not supported.

Pages - Use function cdFlush to change to a new page. The previous page will not be changed.

Behavior of Functions

Control

Coordinate System & Clipping

Attributes

Colors

Client Images

Primitives

Server Images

Exclusive Attributes