POST 2.1 Introduction: This document describes the MS-DOS utility POST. POST is a utility that gives MS-DOS based PC's the ability to print directly to PostScript printers from the DOS prompt. This information applies to version 2.1 of the POST utility. Background: The first PostScript based printer was introduced by Apple Computer. This printer helped establish the desktop publishing industry because it incorporated PostScript, the sophisticated Page Description Language (PDL), developed by Adobe. The printer was designed to work with the Apple Macintosh using an Apple developed interface called AppleTalk. The printer designers did however include an RS-232 port so that it could be connected to other computers such as the IBM-PC and clones. Software developers soon discovered the power of PostScript and began to write printer drivers for PC application programs. One serious drawback however, is the lack of a PostScript driver for MS-DOS. The POST utility is an attempt to solve this oversight. Purpose: POST allows users of PC's to print ASCII files directly to PostScript printers. It is intended to provide PostScript support for programs that do not have the necessary drivers, and to allow direct printing of DOS files. POST allows directory listings to be piped through it directly to a PostScript printer. POST also allows the user to print files that have been created by spreadsheet and database programs that can print to ASCII files. The user can specify a variety of parameters that will affect the appearance of the output. These parameters include the top, bottom, left margins, and the font style, size and leading. Options for scaling, rotation and translation are also provided. Version 2.0 also allows PostScript commands to be embedded in the source file. This can be used to include box drawing, shading, font changes, logos and other PostScript functions on the printed page. (This feature requires some knowledge of the PostScript language.) The ability to include PostScript commands is very powerful and can be used to produce almost anything. Function: POST Reads data from the standard input device, converts it to PostScript format, then writes the data to the standard output device. 1 POST 2.1 Command Line Format: (options are explained on next pages) [d:][path]POST[option 1 value(s) ... option n value(s)] Upper or lower case is OK except for Font names (this will be explained later). There are 72 points per inch. The default page origin is located at the lower left corner with positive X to the right and positive Y upwards. The output filename must be different from the input filename. POST will space to the next column position if it finds a tab character. Column positions can be defined as preset distances from the left margin. POST will skip to top of form if it finds a form feed character. POST will ignore control characters other than line feed, form feed and tab. OPTIONS: LETTER: VALUE(S): DEFAULTS: Left Margin L Left margin in points L 54 Top Print Line T Top print position in points T 720 Bottom Print B Bottom print limit in points B 54 Column Tab C Column tab spacing in points C 56 Typeface Size P Typeface size in points P 12 Leading D Vertical line spacing in points D 12 Typeface Font F Selected font for printing F Courier Scaling S X and Y scaling multipliers S 1.0 1.0 Page Origin X X and Y page translation points X 0 0 Page Orientation R Page rotation angle in degrees R 0 Details of Options: L: The left margin is the value assigned in points (72 per inch) to the leftmost printing position on the page. For instance, if you want to start printing one inch from the left side of the page you would include the option - L 72. T: The top margin is used by the printer every time a new page is started. Its value is the number of points (72 per inch) from the bottom of the page to the beginning character position of the first line on the page. Remember that if you decide to print in the landscape mode, you will have a smaller number of points to the first line. POST uses 720 points as the first line default (10 inches times 72 points per inch). 2 POST 2.1 B: The bottom margin is used by the printer to decide when to start a new page. Every time a new line is started the amount of line-to-line space defined (see D - leading) is subtracted from the current position on the page to see if enough room is available. If not, the current page is printed and printing starts at the top of a new page. If you are using embedded form feed control, be sure to set the bottom margin to a value that will keep from automatically paging before you want to. Also, most PostScript printers cannot print closer than one fourth to one half inch of the edge of the paper. C: The column tab spacing is the increment in points to be added to the left margin for each tab column across the page. The default tab column for the first tab is 54 points for the left margin plus 56 points. The next tab column is 56 points more than the first. P: One advantage of PostScript printers is that they can print characters in any size desired because they are defined in a manner that allows them to be scaled very accurately. POST allows any integer value to be used. The default size is 12 points which is 10 characters per inch. Do not forget that the line-to-line spacing must be adjusted in conjunction with the typeface size or overprinting can result. Normally the line-to-line (leading - option D) spacing should be equal to or greater than the typeface size. D: Leading is the line-to-line spacing value. The name is derived from when type was made from the metal of the same name - lead. The lead was poured to make rows of letters and the space between rows was the amount of leading. Be sure to increase the leading when you increase the type size to avoid overprinting. The leading value is also used to determine the number of lines per page by subtracting its value from the calculated line position each time a new line is started. F: The default font is Courier. Any other font that is already in the PostScript printer can be used. Be sure to use upper and lower case as described by the printer manual. Examples for Courier are: Courier, Courier-Bold, Courier-Oblique and Courier-BoldOblique. If you have downloaded a special font, you can select it. The PostScript printer will ignore requests for incorrectly identified fonts. Please remember that most of the fonts other than Courier are proportional and that column data will not be lined up. Examples other than Courier are not shown because most of the fonts are copyrighted. 3 POST 2.1 S: Scaling is done by the PostScript printer. It multiplies each X and Y coordinate by the X and Y scaling factors that you have provided. The printout can be enlarged or reduced. The X and Y scaling factors are the only ones that POST allows to be non-integers. POST sends translation, orientation and finally scaling values sequentially to the printer. X: Page Origin: This will allow you to translate the page origin to any place on the page. The values specified must be in points. Remember that if you translate the origin, X and Y positive values are still up and to the right. If you translate the X coordinate of the origin to the top of the page, nothing will print because it will be off the page! Also, any characters that extend beyond the right edge of the page will also not print. Generally if you translate the page origin you also need change the orientation of the page with the Rotate command (option R). R: Rotation of the coordinate system can be very confusing. The PostScript printer rotates the page image counter-clockwise by the number of degrees requested. POST expects the number to be an integer - i.e. one degree increments. POST sends the rotation value after it sends the translation values but before scaling. See the example of landscape page orientation for an example and experiment using variations. Examples: The following performs a standard directory function, pipes the output as a standard input to POST and POST converts the directory listing to PostScript format and sends it to the PostScript printer: C>DIR | POST > PRN The following sends the file infile.ext to POST, POST converts it to PostScript format and sends it to the file outfile.ext: C>POST < infile.ext > outfile.ext 4 POST 2.1 The following prints a page in the landscape mode by setting the top of page at 540 points, translating the origin to the upper left corner and rotating the page counter-clockwise 270 degrees: C>POST T 540 X 0 792 R 270 < infile.ext > PRN The following prints very full pages by setting the left margin to 24 points, top of page to 756 points and the bottom of page to 24 points: C>POST l 24 t 756 b 24 < infile.ext > PRN Hint: If there are specific functions that you are going to use often, create batch files with the required options. See your DOS manual for more information about creating batch files. Sample batch files are included with this documentation. 5 POST 2.1 Computer Connections: The purpose of this section is to help you establish the correct connection and communication method between your computer and PostScript printer. POST was developed for people who have a PC (or clone) with a PostScript printer connected to the parallel port of their PC. That is why the examples are using "PRN" as the output device. If you have this configuration, you should have no trouble using the POST utility. Making the PostScript printer work with a serial connection is slightly more difficult. The printer and the PC must be set to communicate at the same speed. 9600 bits-per-second must be used on the LaserWriter. To set up DOS to communicate correctly, enter the following incantation at the DOS prompt. Substitute the correct COM port if yours is different. MODE COM1:9600,N,8,1,P This tells DOS to talk to serial device COM1 at 9600 bits-per-second, with no parity, eight data bits, one stop bit and to continuously retry to send upon receipt of time out errors from the asynchronous adapter. You may also want to enter the following: MODE LPT1:=COM1: This tells DOS to re-route information intended for the parallel port to the specified serial port. You may not need this. Next set your printer to use the serial port at 9600 bits per second (see your printer manual). There is one problem that frequently occurs when a PostScript printer is attached to a PC via the serial ports on both devices. The problem occurs because the default handshaking (or synchronization) method used by the devices are different. By default, the Laserwriter and other PostScript printers use XON/XOFF (software) handshaking. The PC, on the other hand, uses DSR/DTR (hardware) handshaking. The problem is exacerbated by the fact that many application programs for the PC control the serial port directly and implement the software handshake protocol. This means that your word processor could produce perfect documents, but the POST utility would not work from the DOS prompt. 6 POST 2.1 In order to solve this problem, a couple of options are available. The first is to change the default handshaking method of the printer, and the second is to change the default handshaking method of the PC. To change the default handshaking method of the printer, you send a small PostScript program to it. On some printers (such as the NT and the NTX) you can also change it via the DIP switches. Early versions of the Laserwriter will not allow you to change the default handshaking method. If you change the default handshaking method of the printer, a correctly wired cable is essential. The PostScript program is shown below. Copy it to the printer using the DOS COPY command. 0000 % Server Password (zeros, not oh's) statusdict begin 25 sccbatch 4 ne exch 9600 ne or {serverdict begin exitserver}{pop end stop}ifelse statusdict begin 25 9600 4 setsccbatch end Create the file listed above using EDLIN or a wordprocessor that can create a simple ASCII file. Embed a control D as the last character to tell the printer that this is the end of the data. (Most MS-DOS based word processors and text editors support the default method of holding down the ALT key and entering the decimal value of the required control character on the keypad. To enter a control D hold down the ALT key and enter 004 on the keypad. To enter a control character with EDLIN, type Ctrl-V, then press the Capital D.) This program makes a semi-permanent change to the printer. That is - it will stay in DSR/DTR protocol until you change it again. To switch back to XON/XOFF change the two "4"s to "0"s (zeros, not oh's). To change the default handshaking method of the PC, you may need to use a copy of the program XONXOF.COM included in the ARC file. This program is a TSR which means it does not go away until you turn off the computer. Some PC clones allow you to specify the handshaking mode of the serial ports. If yours does you should have no trouble once you set it for XON/XOFF. NOTE: If you have been using POST.COM (a previous version of this utility) you will need to remove it from the directory when you install POST.EXE. Otherwise, DOS will execute the old version. DOS always executes the file with the .COM extension if it exits even if you type in the .EXE extension. 7 POST 2.1 Embedded PostScript: Version 2.1 has incorporated the ability to send PostScript commands directly to the printer without intervention. This capability can be used to include a company logo on the page, or to draw boxes on the page to highlight columns or rows. Almost any valid PostScript commands can be sent using this feature (some knowledge of the PostScript language is required). To embed PostScript commands in your file you should enter a CTRL-^ (hold down the CTRL key on the keyboard and press the ^ key). On most PCs, the ^ is above the 6 and CTRL-6 will sometimes work. Next enter a followed by the desired set of PostScript commands. Next enter a followed by another CTRL-^. The POST utility interprets the CTRL-^ as follows: When the first CTRL-^ (Decimal 30 or Hex 1E or Octal 36) is found, POST sets a flag and sends all other characters directly to the printer (or file). When the next CTRL-^ is encountered, POST reverts to its normal self. In this fashion, all sorts of control can be exerted upon the output of a PostScript printer. For example, if the following code were embedded in a normal ASCII file, a shaded logo would show up on the background of the output. Please make sure that the CTRL-^ is the first character of the embedded PostScript code and it is recommended that you use either a save-restore pair or a gsave-grestore pair to surround your embedded code to avoid corrupting the remainder of the code generated by the POST utility. Example:  gsave % there is a CTRL-^ before the gsave 200 175 moveto 500 175 lineto 500 225 lineto 200 225 lineto closepath .5 setgray fill /Times-Roman findfont 50 scalefont setfont 250 185 moveto 1 setgray (POST 2.1) show gsave 250 185 moveto 0 setgray (POST 2.1) true charpath stroke grestore grestore % there is a CTRL-^ after the grestore  8 POST 2.0 The save-restore (or gsave-grestore) should surround the PostScript code if it is independent of the current page. Embedded PostScript commands can be included anywhere in a file (the result of the code will be printed on the page that is currently being rasterized.) Shareware: This program is distributed as Shareware. If you find this program useful, send $10.00 to: F. C. Betts c/o Veda Incorporated Suite 200 5200 Springfield Pike Dayton, OH 45431 Any comments and/or suggestions will be appreciated and a response will be sent if possible. 9