WordPerfect .PRD Printer File Format


     The .PRD file is composed of 4 blocks of data.  The structure
of each of these blocks are listed in the following subheadings.


Pointers to Printer Control Strings

     The first block begins with a byte value that represents the
version number of this .PRD file.  Currently the version number is
always 1.  Each word value after that, is an offset pointer into
the "Printer Control String Pool" below.  The origin of the offset
value is the first byte of the Printer Control String Pool, not the
beginning of the file.  If the offset value is zero then there is
no string in the Printer Control String Pool for that command.  So
that command will be ignored for this printer.

Offset    Size           Meaning
 0        1 Byte         Revision Number (Always 1)
 1        1 Word         Start Of Document String
 3        1 Word         End Of Document String
 5        1 Word         Start Of Page String
 7        1 Word         End Of Page String
 9        1 Word         Underline On
11        1 Word         Underline Off
13        1 Word         Bold On
15        1 Word         Bold Off
17        1 Word         Auto Linefeed on Carriage Return
19        1 Word         Compressed Type On
21        1 Word         Compressed Type Off
23        1 Word         Graphics Class (DataPerfect use only)

Before DataPerfect 2.1 the last 3 word pointers were reserved.

The "Graphics Class" field is used by DataPerfect to determine, 1-
does the printer have the supported capabilities to print graphic,
and 2-which supported graphics format does it use.  This graphics
information is used by DataPerfect 2.1 and up, to print bar graphs.


Printer Control String Pool

     This is the second block of data.  This pool's size is 167
bytes long.  The first 2 words mark the beginning of this block. 
They have the following meanings;

Offset    Size           Meaning
0         1 Word         Offset from pool to first available byte
2         1 Word         Number of bytes free in pool

The printer control strings that follow this are variable length. 
The first byte of each string contains the length of the string
following it.  Each byte after the length contains the characters
of the printer string.  Printer control strings are NOT null
terminated.

The FFh code is used in printer control strings as a literal print
character.  The only value that requires this literal print
character before it, is the FFh character itself.  So, to send the
FFh character to your printer you would put "FFh,FFh" in to the
string to send the single FFh value to the printer.  There is one
other place the FFh value is required, and that is the "No
Graphics" string in the "Graphics Class print control information. 
The FFh value is put in here by convention, to be recognized
correctly by DataPerfect.

The values used in the "GRAPHICS CLASS" field have the following
values and meanings.

     Value(s)  Size      Meaning
     FFh,0     2 bytes   No Graphics (or unsupported class)
     1         1 byte    HP LaserJet
     2         1 byte    Cannon Laser
     3         1 byte    Epson/IBM ProPrinter Series

So, to put the HP LaserJet in as the correct graphics method for
your printer, you would put in the string of 01,01.  Where the
first 01 is the length of the string and the second 01 indicates
the graphics class.



Character Map (Used in printing)

     The third block of data is the printer character map.  It is
256 bytes long and covers all the possible key strokes from the
standard ASCII character set to the IBM extended character set. 
Each byte in the Character Map represents the corresponding ASCII
or extended ASCII character.  For example offset zero of the
Character Map maps to the ASCII value of 000, and offset 156 maps
to ASCII 156, etc.  Using the map you can substitute any character
in the 0-255 range, with a different ASCII value or a variable
length printer string.  To do this you put the appropriate value
into the map at the correct offset for that character.  The legal
values that can be entered into the map and their meaning are given
below.

VALUE          MEANING
 0             CHAR MAPS TO ITSELF
-1 (255)       REPLACE WITH STRING (Located in Character Map
                                   Overflow Area)
 1 TO 254      CHAR MAPS TO THE GIVEN VALUE



Character Map Overflow Area 

     This is last block of data in a .PRD file.  It is 576 bytes in
length.  Here is the structure of this area.

Offset    Size           Meaning
0         1 Word         Offset of Map Overflow Area to first byte
                         of available space (zero if area is
                         empty)
2         1 Word         Number of free bytes in overflow area,
                         excluding null delimiters
4         1 Byte         ASCII value of character
5         1 Byte         Length of substitution string
6         Variable       Substitution string

The values for offsets 4 - 6 are repeated for each character in the
Character Map that has the -1 (255) value.

     If a user is using the Printer Definition program to edit a
.PRD file, and the user edits one of the strings in this area, the
following happens.  The correct character string is found and
deleted.  Any strings that may have been after this deleted string,
are copied to the left to fill in the hole.

     This copy action continues down the list of strings until the
end of the list is reached.  Any data left over from the old list
is not zeroed out.

     The new string is copied to the end of the new, shifted list. 
If the new string is short it could leave some of the old data
(from before the shift) after the end of the new string.

     To mark the true ending of the new list and beginning of true
available space, 2 null bytes are always written after the new
list.  These 2 null bytes are not counted when recomputing the new
value to go into offset 2.
