## Kermit 95 Printer Setup and Troubleshooting

Contents:

- Postscript Printing
- Print Redirection
- Using Windows Print Queues
- Bidirectional Printers
- SET PRINTER Command Summary
- "WinPrinters"
- Troubleshooting

As of: Kermit 95 3.0.0 DEV

Kermit 95 supports both host-directed and local text-mode printing for one printer at a time, selected by the `SET PRINTER` command.

Kermit 95 sends text directly to the printer without any preprocessing or reformatting beyond what might already have been done to it already by the terminal emulator (e.g. character-set translation). So if your printer can't accept plain text, you need to install a standard input/output print filter.

To clarify the preprocessing comment: If you Print-Screen (`\Kdump`) or use the Windows Print Screen key, the characters are taken "from the screen" and so have already been formatted and possibly translated by the terminal emulator. The same is true for host-directed autoprint, print-screen, or print-line operations. BUT... host-directed transparent print operations redirect all the bytes from the host straight to the printer, including escape sequences and untranslated characters, completely bypassing the screen and terminal emulator.

When configuring a printer you may choose to use its DOS name, such as PRN or LPT1, or its Windows queue name; the choice implies totally different drivers and spooling mechanisms. When printing to a DOS Device name the data may be converted by the underlying printer drivers to the necessary format. When using the Windows Printer Queue mechanism the output from Kermit 95 is treated as raw data and is not altered before being sent to the printer. This means that if you are using a WinPrinter (a printer designed for use with only Microsoft Windows operating systems) you will be unable to print to the printer via the Windows Print Queue method.

It's usually not possible to know which method works with which printer, so in general, try using a Windows Print Queue first; then if that doesn't work, try a DOS Device name.

### Postscript Printing

If you are using a Postscript only printer, the raw data output by Kermit 95 will not be understood by the printer. Kermit 95 provides a built-in Text to Postscript filter which can be used to convert a plain text file to postscript so it can be understood by the printer.

      SET PRINTER /POSTSCRIPT /WIDTH:80 /LENGTH:66

where the width and length are used to determine where word wrap and page breaks should be placed. This built-in filter takes the place of the `TEXTPS.EXE` external filter that is shipped with Kermit 95 as a historical utility.

### Print Redirection

Kermit 95 has an option for the printer output to be sent to an external program (also known as a 'filter'). Before the Text to Postscript filter was integrated into Kermit 95, this feature was used to support Postscript printers. The `SET PRINTER` command supports a `/COMMAND` switch which is used to specify the filter. Any of the following forms is accepted (using textps as an example):

      SET PRINTER /COMMAND:textps.exe>lpt1
      SET PRINTER /COMMAND:{textps.exe>lpt1}
      SET PRINTER /COMMAND:{ textps.exe > lpt1 }
      SET PRINTER /COMMAND:|textps.exe>lpt1
      SET PRINTER /COMMAND:{| textps.exe > lpt1 }

Note: `SET PRINTER /PIPE:` is an acceptable synonym for `SET PRINTER /COMMAND`.

### Using Windows Print Queues

In Windows 95 and NT only, you can use the SET PRINTER command to select a Windows print queue; i.e. you can refer to a printer by the name shown in Control Panel..Printers. Try this if you have trouble with the default DOS-device printing method.

The format of the K95 command for choosing a Windows print queue is:

      SET PRINTER /WINDOWS-QUEUE:HP_LaserJet_5L_(PCL)

The Windows name must be spelled, capitalized, and punctuated exactly as shown in the Printers folders. If the name contains spaces (as most do), it must be given with spaces replaced by underscores, as shown.

Windows printer names are available to you as keywords, so you can type ? to get a list of them, and you can use completion (Tab or Esc) rather than having to type them out all the way, and/or you can abbreviate them:

      K-95> set printer /windows-queue:? Print Queue, one of the following:
        HP_LaserJet_5L_(PCL)   IBM_1403   Xerox_9700
      K-95> set printer /windows-queue:HP_LaserJet_5L_(PCL)
      K-95> set printer /windows:hp                          (Abbreviation OK)
      K-95> set printer /win:H<ESC>P_LaserJet_5L_(PCL)       (Completion works)

If you enter "`SET PRINTER /WINDOWS-QUEUE:`" by itself without specifying a printer, your default Windows printer is selected.

Material to be printed is sent to Windows print queues, as it is to any other kind of printer, in "raw" character form, that is, without conversion to PostScript, PCL, rasters, or other format. So if you have (e.g.) a PostScript or PCL printer, the material to be printed must already have been converted to the appropriate format prior to printing; certain host applications (e.g. DEC ALL-IN-1) do this, but others do not. If conversion (e.g. to PostScript) is needed, you can't use a Windows printer; instead, you'll need to use a print-filter and a DOS printer.

### Bidirectional Printers

Most printers are "one way" devices, but K95 supports "bidirectional printers" too. These are printers or other devices that send data back to the computer, such as bar-code scanners. Bidirectional printers may be configured only on serial (COM) ports in Windows NT, but can be either serial or parallel ports in Windows 95/98/ME/2000/XP. For serial printers, only COMx device names may be used; TAPI names are not supported for this purpose. See the `SET PRINTER` command reference for syntax.

A bidirectional printer works just like an ordinary printer, except that all characters that arrive from the printer port are sent directly to the host, at all times, no matter what the state of the "terminal printer".

Thus, during host-controlled printing operations, K95 becomes a completely transparent bidirectional connection between the printer and the host. Here's a demonstration: plug a terminal into one of your PC's serial ports; make a Telnet connection from K95 to a host computer; set your host terminal type to agree with the terminal on your COM port; set K95's terminal type to VT100 or above; have the host send `ESC [ 5 i` ("start transparent print"); now conduct a host session on the physical terminal.

In practice, K95's bidirectional printing feature is primarily useful with handheld barcode scanners and similar devices, although it can also be used to allow file transfers from a non-networked computer over the network, or to turn K95 into a reverse terminal server.

### SET PRINTER Command Summary

The `SET PRINTER` command is completely described in this section. Each of these settings has a corresponding box on the Dialer entry Printer page. As of K95 1.1.18, SET PRINTER command switches are sticky, so you can issue a sequence of commands such as

      SET PRINTER /WINDOWS-QUEUE:
      SET PRINTER /TIMEOUT:300
      SET PRINTER /END-OF-JOB-STRING:\12

instead of combining them all on a single line.

A "print job" is defined to be any of the following:

1. A dump screen operation (\Kdump, Alt-P by default).

2. All of the material copied to the printer starting with "Printer on" and ending with "Printer off". This includes:

   - Alt-O / Alt-O sequences (\Kprtauto)
   - Host-directed Autoprint sequences (CSI ? 5 i ... CSI ? 4 i)
   - Host-directed Transparent print sequences (CSI 5 i ... CSI 4 i)
   - Host-directed print-line, print-region, print screen.

   See the `/TIMEOUT` switch for additional information.

3. Mouse printing: whatever mouse action, if any, is assigned to the \Kdump verb, button 1 Ctrl-Shift-Drag by default, which sends the selected area to the printer.

4. Kermit's own PRINT command.

Note: Copy-to-printer operations, of all the kinds in item 2 above, while in progress, can also be terminated using the \Kreset verb, which is assigned to Alt-R by default.

Besides the SET PRINTER command, you can also use the SET TERMINAL PRINTER command to affect how incoming material is printed:

`SET TERMINAL PRINT { AUTO, COPY, OFF, USER }`
  Allows selective control of various types of printing from the Terminal session. AUTO prints a line of text from the terminal screen whenever the cursor is moved off the line. COPY prints every byte received as it is received without interpretation. USER prints every byte after interpretation by the terminal emulator translates character-sets and interprets escape sequences. The default is OFF.

Now here's the SET PRINTER command:

`SET PRINTER [ switches ] [ name ]`
  Selects the named printer for all future print actions: the PRINT command, host-directed transparent or autoprinting, screen dumps, mouse printing, etc. If the name is omitted, then any switches that are given apply to the currently selected printer. If a name is given, the current printer, if any, is closed and the new printer is selected; any options left over from previous `SET PRINTER` commands continue to apply unless overridden by new options. Access to the named printer is via DOS calls unless the `/WINDOWS-QUEUE` switch has been included or a Windows print queue name has has been completely specified in the name field. A DOS printer name such as PRN: or LPT1: should end with a colon (:).

Here are the `SET PRINTER` switches. The first group is used to specify the printer itself:

`/NONE`
  Include this switch to specify that all printer actions should simply be skipped. Use this, for example, if you have no printer.

`/DOS-DEVICE[:name]`
  Include this to declare a DOS printer and, optionally, to specify its name. You can use any of the following forms:

  `SET PRINTER /DOS-DEVICE:xxx`
    Selects xxx as your printer, using DOS access (xxx would typically be PRN, LPT1, etc).

  `SET PRINTER /DOS-DEVICE /maybe-other-switches xxx`
    Says that the printer that you will name later in the command ("xxx" in this example) will be a DOS printer.

  `SET PRINTER /DOS-DEVICE`
    Redeclares the current printer device to be a DOS device. This works only if the current printer name is a valid DOS device name, such as PRN or LPT1 (or NUL), or else a network printer name.

`/WINDOWS-QUEUE[:[queue-name]]`
  Include this to declare a Windows printer and, optionally, to specify its queue name. If you use `/WINDOWS-QUEUE` with a colon but without a queue name the default Windows printer queue is used. If you omit the colon too, the command specifies that the currently selected printer is a Windows really a Windows Print Queue. You can type a question mark (?) after the colon (:) to see a list of known queue names. Windows printer queue names must be entered with underscores instead of spaces, for example:

        HP_LaserJet_5L_(PCL)

  You can use the following forms:

  `SET PRINTER /WINDOWS-QUEUE:HP_LaserJet_5L_(PCL)`
    Selects "HP LaserJet 5L (PCL)" as your printer, using Windows spooling. Note the substitution of spaces by underscores.

  `SET PRINTER /WINDOWS-QUEUE HP_LaserJet_5L_(PCL)`
    Selects "HP LaserJet 5L (PCL)" as your printer, using Windows spooling. Note the substitution of spaces by underscores.

  `SET PRINTER /WINDOWS-QUEUE:`
    Selects the default Windows printer queue.
  `SET PRINTER /WINDOWS-QUEUE`
    Redeclares the current printer device to be a Windows printer queue. This works only if the current printer name is a valid print queue name.

`/FILE[:name]`
  Specifies that all printer material is to be appended to the named file, rather than being sent to a printer. If the file does not exist, it is created the first time any material is to be printed. If the colon and the name are omitted, this declares that any previously selected name should be treated as a filename. When supplying a filename, you should include the full pathname in case you change directories later.

`/COMMAND[:name]`
  Specifies that all printer material is to be sent as standard input to the program or command whose name is given. If the colon and the name are omitted, this declares that any previously selected name to be a pipename. The name can begin with "|" to emphasize it's a pipe, but this optional; for example: `SET PRINTER /COMMAND:lpr` and `SET PRINTER /COMMAND:|lpr` are equivalent. Synonym: `SET PRINTER /PIPE`.

  If you give a printer name without specifying any of these switches, then:

  1. If it matches the name of a Windows print queue exactly, it is assumed to be a Windows print queue;

  2. If if starts with "|" it is assumed to be a pipe;

  3. Otherwise it is assumed to be a DOS printer name or a filename.

  Examples:

        SET PRINTER {HP LaserJet 5L (PCL)}  ; Windows queue
        SET PRINTER PRN                     ; DOS device
        SET PRINTER OOFA.TXT                ; Filename
        SET PRINTER {Name With Spaces.Txt}  ; Filename
        SET PRINTER |lpr                    ; Pipe
        SET PRINTER {| textps > lpt1}       ; Pipe
        SET PRINTER {| lpr -Plaser}         ; Pipe

  Note: braces are required if the name contains any spaces.

The next group of switches tells whether the printer is one-way or bidirectional (two-way):

`/OUTPUT-ONLY`
  Include this to declare the printer capable only of receiving material to be printed, but not sending anything back. This is the normal kind of printer, and Kermit's default kind, and is the opposite of /BIDIRECTIONAL.

`/BIDIRECTIONAL`
  Include this to declare the printer bidirectional. This is the opposite of `/OUTPUT-ONLY`. You can also use this option with serial printers, even if they aren't bidirectional, in case you need to specify speed, flow control, or parity.

The next group applies only to bidirectional and/or serial printers:

`/FLOW-CONTROL:{NONE,XON/XOFF,RTS/CTS,KEEP}`
  Flow control to use with a serial bidirectional printer, default KEEP; i.e. use whatever the Windows driver for the port normally uses.

`/PARITY:{NONE,EVEN,ODD,SPACE,MARK}`
  Parity to use with a serial printer, default NONE; i.e. use 8 data bits and no parity. If you omit the colon and the keyword, NONE is selected.

`/SPEED:number`
  Interface speed, in bits per second, to use with a serial printer, such as 2400, 9600, 19200, etc. Type `SET PRINTER /SPEED:?` for a list of possible speeds.

The next switch lets you specify the character set used by the printer, in case it is different from the default.

`/CHARACTER-SET:character-set-name`
  Specifies the character set used by the printer which may be different from both the character set used by the host and by the local computer. The default value is CP437. Type "set printer /char:?" to see a list of choices.

The final group deals with print jobs -- how to identify them, how to start them, how to terminate them:

`/TIMEOUT[:number]`
  The number of seconds to wait after the host "closes" the printer before terminating the print job if the printer is not opened again during the specified amount of time. Normally 0, meaning to terminate the print job right away. Specify a positive number after the colon; if you omit the colon and number, 0 is used. Example of usage: some host applications print a series of lines by opening and closing the printer for each line, which would create a print job for each line, which in the worst case, might wind up printing each line on a separate page; use this option to "merge" the lines into a single print job.

`/JOB-HEADER-FILE[:filename]`
  The name of a file to be sent to the printer at the beginning of each print job, sometimes called a burst page or cover page, usually used only when a printer is shared by multiple users to identify whose print job it is, or a file containing commands for the printer, e.g. to set it up for printing a plain-text job. None, by default. If the filename contains any spaces, you must enclose it in braces. If you omit the colon and the filename, this removes any previously specified job header.

`/END-OF-JOB-STRING[:string]`
  String of characters to be sent to the printer at the end of the print job, usually used to force the last or only page out of the printer. When such a string is needed, it usually consists of a single formfeed character:

        SET PRINTER /END-OF-JOB:{\12}

  No end-of-job string is sent unless you specify one with this option. If the string contains any spaces or control characters (even in backslash notation, as above), enclose it in braces. If you omit the colon and the string, this removes any previously specified terminator.

Note that you can give `SET PRINTER` commands that do not change the printer name, only the options. Example:

      SET PRINTER LPT3
      SET PRINTER /JOB-HEADER:burst-page.txt
      SET PRINTER /END-OF-JOB:{\13\10\12}
      SET PRINTER /TIMEOUT:30

The first command selects the printer (the default printer type is DOS).

`SHOW PRINTER` shows the `SET PRINTER` options currently in effect.

`HELP SET PRINTER` summarizes the material in this section.

### "WinPrinters"

So-called "WinPrinters" are presently not supported by Kermit 95. These printers are marketed specifically for use with Microsoft Windows operating systems, and work only with Microsoft Windows. It might seem strange that Kermit 95 does not support them, since Kermit 95 is a native Windows 32-bit application, but "WinPrinters" require the print job to be formatted by the Win32 application. Transparent printing material, however, contains escape sequences or other non-textual data that can not be formatted as text.

Ironically, WinPrinters come with a 16-bit driver for use by DOS applications, but since K95 is a 32-bit application, it can't see this driver. Presently, the only way to print on a WinPrinter from Kermit 95 is to:

      set printer xxx

where xxx is a filename, and then to:

      run copy /b xxx prn

(i.e. run the DOS command to copy the print file in binary mode to the DOS printer). A series of macros can be defined to accomplish this, and can be assigned to hot keys to make printing to WinPrinters relatively painless.

### Troubleshooting

As noted previously, SET PRINTER command switches are sticky, which can result in confusion when using a mixture of commands. If printing does not work when you expect that it should, use the SHOW PRINTER command to examine the current configuration. If it looks like:

      [D:/kermit/src/] C-Kermit> sh print
      Printer: prn:
       /OUTPUT-ONLY
       /WINDOWS-QUEUE
       /TIMEOUT:0
       /END-OF-JOB-STRING:(none)
       /JOB-HEADER-FILE:(none)

where the printer name is correct but it is not a Windows Queue and yet the /WINDOWS-QUEUE flag is set; it means that you need to use the command form

      SET PRINTER /DOS-DEVICE:name

when setting the printer. Track down the script which contains the:

      SET PRINTER name

command and update it.

Remember to include the colon (:) in DOS printer device names like `PRN:`.

Remember that Print-Screen, Ctrl-Print-Screen, and Shift-Print-Screen are Windows functions. Kermit 95 never sees them and has no control over them whatsoever.

If host-generated print material fails to print:

- Can your printer print plain text? (For example, most PostScript printers can't.) If not, you'll need to specify a print filter.

- If your printer is a "WinPrinter", please read the section on WinPrinters.

- Check that Kermit 95 is actually receiving the data by entering Debug mode in the terminal screen (normally done with Alt-D). Check that the start-print and stop-print sequences are actually being received. If not, your host application is at fault. Otherwise read on.

- If the correct printing escape sequences are being received but printing does not occur, make sure Kermit 95's terminal type is set to agree with the type of escape sequences being used.

- Use the `SET PRINTER` command to tell Kermit 95 to print to a file instead of a printer. After the host prints the data, examine the file to see if it contains the correct information. If so, then Kermit is interpreting the escape sequences and capturing the data correctly, but something is wrong with the print queue, the printer device driver, or the printer itself. Review the earlier sections of this document.

- If you are using Windows print queues, you can set your Windows printer to "Pause Printing" and then watch the output from K95 as it appears in the queue.

- If printing works correctly, except that the last or only page fails to come out, use Alt-E (`\KprintFF`) to send a formfeed to the printer to try to force the last page out. (Some printers have a button that does this.)

In Windows 95/98/ME, read the `PRINTERS.TXT` file in the Windows folder; it is an ordinary plain-text file.

Windows 95/98/ME also include a Print Troubleshooter program:

1. Click the Start button, then click Help.
2. On the Contents tab, double-click the Troubleshooting topic.
3. Double-click the If You Have Trouble Printing topic.

Microsoft published numerous printer-related articles in its Knowledge Base, including:

      PSS ID Number: Q128345
      PSS ID Number: Q132425
      PSS ID Number: Q133152
      PSS ID Number: Q133438
      PSS ID Number: Q135889
      PSS ID Number: Q135890

In these articles you will find all sorts of testing and troubleshooting procedures, pointers to new printer drivers, Device Manager / Control Panel procedures, spool settings and spool file management tips, network printing procedures, hints for specific printers, instructions for using Windows 3.1 drivers in Windows 95, and some coverage of font issues.

Click Back on your Browser's Toolbar to return.