VISTA Printing Printer Subtypes
Written by Sam Habiel
- 1 VISTA Subtypes
- 1.1 What is a Subtype
- 1.2 How to specify a Subtype?
- 1.3 Common Subtypes in VISTA
- 1.4 PCL5 Quick Reference
- 1.5 Portrait Letter 12 CPI 6 LPI
- 1.6 Landscape Letter 14 CPI 6 LPI
- 1.7 Portrait Letter 17 CPI 7 LPI (MARs and BCMA Med Log)
- 1.8 Portrait Landscape Letter 22 CPI 12 LPI
- 1.9 Portrait Legal 12 CPI 6 LPI
- 1.10 Greensheet
- 1.11 Support for Advanced Subtype Specifiers
What is a Subtype
A subtype (stored in file #3.2 TERMINAL TYPE) is an entry associated with each device that tells the device how to handle special non-standard situations; plus some base characteristics. With printers, typically a subtype has two fields populated: Open Execute and Close Execute, in addition to Right Margin, Form Feed, Page Length, and Back Space. The Open Execute resets the printer, sets the page orientation, sets the top and left margins, and sets the font size. The close execute sets the variable IONOFF to an empty string (effectively defining it in the symbol table), and sends a reset to the printer. Right Margin and Back Space aren't used with printers; Form Feed goes into the M variable IOF, Page Length goes into the M variable IOSL ("IO Screen Length") determines how many lines are to be printed on each page before VISTA sends an IOF to go to the next page. That's important to keep in mind since the number of lines that VISTA prints needs to match how many lines are available on the page, otherwise the printer will either spit an extra page containing the extra lines or it will clip the output, depending on whether you specified how many lines are to be printed in PCL. The subtypes below don't specify how many lines to print, so the former behavior will happen with them. The solution is to decrease page length.
The reason IONOFF is needed is that by default VISTA will send an extra page following each print out; because it was developed in the days of dot-matrix printers, where the extra page separated jobs. The days of dot-matrix printing are practically over; most printers used today are inkjet or laser. Typically we don't want an extra page at the end. You may be lead to believe that IONOFF is enough; however, most reports in VISTA have hardcoded extra pages at the beginning or end. I was told there was going to be a project in the late 90's to make sure all reports relied on the device handler for printing separator pages, but that never happened.
There is a field in the device file called "SUPPRESS FORM FEED AT CLOSE". This field does the exact same thing as setting IONOFF in the Close Execute in the terminal type. In general, I recommend setting IONOFF in the terminal type rather than filling SUPPRESS FORM FEED AT CLOSE for every single printer you configure.
The same extra page issues apply to Zebra printers as well, except over there they may manifest as extra labels if IOF is configured to send a label feed command (^PH or ~PH).
How to specify a Subtype?
Normally, subtypes are configured once per device. When you set up a printer in the DEVICE file, you populate the subtype in the subtype field.
However, you can override subtype selection on a job basis, by using this syntax on the Device prompt:
If you type partial matches, the device driver (^%ZIS) is going to list for you all partial matches for you to choose form. That's pretty nice since I never remember what subtypes I have beyond them having P-HP at the beginning.
There are variations on this syntax, by the way, that don't have to do with subtypes:
1. DEVICE: printer_name;right margin;page length 2. DEVICE: printer_name;subtype;right margin; page length 2. DEVICE: ;right margin;page length 3. DEVICE: ;;page length
As you can see, you can specify custom margins and page lengths. You need to remember that aside from terminal emulators, margins have no effect, as VISTA does not test for them when printing. It does really care about the page length though (see discussion about IOSL above). If a printer name isn't specified, the home device is assumed.
Novice power users type ';;99999' to print a report without page breaks on the terminal emulator, without understanding what it means. The variations above should tell you: print to the home device to an infinite length. Of note, $Y on Cache wraps at the unsigned int16 limit (32767); therefore, testing if $Y is greater than IOSL when IOSL is greater than 32767 (in my last example, it's 99999) will always return false, causing page breaks to never be issued. As far as I know, GT.M does not wrap $Y, so you may have to give it gigantic page lengths; although, in practice, I don't remember having encountered that problem. It's possible there is something in ^%ZIS4 that I missed regarding that.
Common Subtypes in VISTA
Here are the most common subtypes in VISTA (standardized for Unices; you will need to remove $C(27),"&k2G" on Windows Servers):
NB: CPI = Characters Per Inch; LPI = Lines Per Inch
PCL5 Quick Reference
*27,"E"/$C(27,69) - Reset *27,"&l0O" - Portrait / *27,"&l1O" - Landscape *27,"&l3E" - Top Margin is 3 lines *27,"&a5L" - Left Margin is 5 columns *27,"&k2G" - Line endings are LF. Default Line endings are CRLF (unless overridden in printer settings). *27,"(s0p12h0s0b4099T" - Primary '(s' font is fixed pitch, 12 cpi, upright (not italic), not bold, and is the Courier Font (#4099).
Portrait Letter 12 CPI 6 LPI
This is THE MOST COMMON subtype to use. Most reports in VISTA print on this one.
NAME: P-HP-LTR-POR-C12L6-W80 RIGHT MARGIN: 80 FORM FEED: # PAGE LENGTH: 56 BACK SPACE: $C(8) OPEN EXECUTE: W $C(27),"E",$C(27),"&l0O",$C(27),"&l3E",$C(27),"&a5L",$C(27),"& k2G",*27,"(s0p12h0s0b4099T" S ($X,$Y)=0 CLOSE EXECUTE: S IONOFF="" W *27,"E" DESCRIPTION: 12 cpi 6 lpi width 80 standard letter printer
Landscape Letter 14 CPI 6 LPI
This is the second most common subtype. Any menu option that says it needs 132 characters will need to use this subtype.
NAME: P-HP-LTR-LAND-C14L6-W132 RIGHT MARGIN: 132 FORM FEED: # PAGE LENGTH: 45 BACK SPACE: $C(8) OPEN EXECUTE: W $C(27,69),$C(27),"&l1O",$C(27),"&l3E",$C(27),"&a5L",$C(27),"&k 2G",*27,"(s0p14h0s0b4099T" S ($X,$Y)=0 CLOSE EXECUTE: S IONOFF="" W $C(27)_"E" DESCRIPTION: 14 cpi 6 lpi width 132 landscape letter printer
Portrait Letter 17 CPI 7 LPI (MARs and BCMA Med Log)
This is the (theoretically) third most commonly used subtype. It's only used for specific reports. It's also known as a condensed print subtype.
NAME: P-HP-LTR-POR-C17L7-W128 RIGHT MARGIN: 128 FORM FEED: # PAGE LENGTH: 64 BACK SPACE: $C(8) OPEN EXECUTE: W *27,"E",*27,"&k2G",*27,"&l3E",$C(27),"(s0p17h9v0s0b4099T",*27, "&l7C" S ($X,$Y)=0 CLOSE EXECUTE: S IONOFF="" W *27,"E" DESCRIPTION: 17 cpi 7 lpi width 128 standard letter printer (MAR)
Portrait Landscape Letter 22 CPI 12 LPI
This is the subtype that will take the most amount of text; it's ideal to print a lot of data from Fileman, for example. It's also known as the condensed landscape print subtype. It's not commonly used except by Fileman power users.
NAME: P-HP-LTR-LAND-C22L12-W228 RIGHT MARGIN: 228 FORM FEED: # PAGE LENGTH: 88 BACK SPACE: $C(8) OPEN EXECUTE: W $C(27,69),$C(27),"&l1O",$C(27),"&l4E",$C(27),"&l0D",$C(27),"&k 2G",*27,"(s0p22h0s0b4099T" S ($X,$Y)=0 CLOSE EXECUTE: S IONOFF="" W $C(27)_"E" DESCRIPTION: 22 cpi 12 lpi width 228 landscape letter printer (condensed)
Portrait Legal 12 CPI 6 LPI
This is not commonly used; I just created this because I thought it may it come in useful for some users.
NAME: P-HP-LGL-POR-C12L6-W80 RIGHT MARGIN: 80 FORM FEED: # PAGE LENGTH: 74 BACK SPACE: $C(8) OPEN EXECUTE: W $C(27),"E",$C(27),"&l3A",$C(27),"&l0O",$C(27),"&l3E",$C(27),"& a5L",$C(27),"&k2G",*27,"(s0p12h0s0b4099T" S ($X,$Y)=0 CLOSE EXECUTE: S IONOFF="" W *27,"E" DESCRIPTION: 12 cpi 6 lpi width 80 standard letter printer
If you don't know what a green sheet is, then skip this. It's here for those who want it.
NAME: P-HP-LTR-POR-GREENSHEET RIGHT MARGIN: 100 FORM FEED: # PAGE LENGTH: 58 BACK SPACE: $C(8) *OLD XY CRT: 60 OPEN EXECUTE: W *27,"E",*27,"&k2G",*27,"&l0O",*27,"&l4H",*27,"&l1E",*27,"(s0p" _$S($G(PSDCPI)=10:"10h14",1:"12h12")_"v0s0b6T" S ($X,$Y)=0 CLOSE EXECUTE: S IONOFF="" W $C(27)_"E" 10 PITCH: $C(27)_"(s10H" 12 PITCH: $C(27)_"(s12H" DESCRIPTION: HP JL4Si 12 pitch Courier DEFAULT LINES PER INCH: $C(27)_"&l8C" X LINES PER INCH: $C(27)_"&l12C" BAR CODE OFF: "*"_$C(27)_"&l0O"_$C(27)_"(8U"_$C(27)_"(s0p"_$S($G(PSDCPI)=10:"1 0h14",1:"12h12")_"v0s0b6T" BAR CODE ON: $S($D(PSDX2):$C(27)_"*p"_(PSDX2-1*300+200)_"y*p"_(PSDX1-1*810+38) _"X",1:"")_$C(27)_"(0Y"_$C(27)_"(s0p8.1h12v0s0b0T*"
Support for Advanced Subtype Specifiers
If you look at kernel system management guide, you will notice that you can use a rather obtuse syntax to customize your output on a print by print basis. E.g.:
M stands for right margin, here set to 132; L stands for page length, here 100; P stands for pitch, here 16, can only be 10, 12 or 16; B stands for Bold; and Q stands for Quality, taking in 0, 1 or 2, here set to 2.
How to set up a device to support this isn't documented anywhere in the Kernel Manuals; I figured it out eventually by reading the %ZIS source code. You need to set up these fields as follows for each subtype:
10 PITCH: $C(27)_"(s10h" 12 PITCH: $C(27)_"(s12h" HIGH INTENSITY (BOLD): $C(27)_"(s3b" LOW INTENSITY (UNBOLD): $C(27)_"(s-3b" NORMAL INTENSITY (RESET): $C(27)_"(s0b" 16 PITCH: $C(27)_"(s16h" DEFAULT PITCH: $C(27)_"(s12h"
The only thing you may have to vary between different subtypes is what is considered a default pitch. Here it is 12, but it can be different. Reading the code, I don't believe that setting the default pitch matters since the printer gets reset every single time a job is sent, discarding the last pitch sent. I don't support 'Q' in the configuration above, so it has no effect; that's because 'Q' is nonsensical when using laser printers. It had a use back in the dot-matrix days.