Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

DOS Printing and Modern Printers.: SEL Sel "Printer Name"

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

DOS printing and modern printers.

Enabling DOS applications to print to modern (Windows) printers isnt that straightforward:
In the DOS days, printers were connected to a parallel (LPT1-3) or serial (COM1-4) port. Printers now
connect to an USB port, or even wireless.
DOS applications can only print to a parallel or serial port; they dont know about future USB ports.
Modern PCs dont have parallel or serial ports anymore.
DOS printers expect to receive text. A DOS application adds printer control codes to end a line (line
feed), eject a page (form feed), eventually print in bold (DOS printer model specific codes) When a
line ended, it was immediately printed (dot-matrix printers). Modern (Windows GUI) printers mostly dont
support text input and are not line orientated. Instead they expect graphical images of complete pages.
DOS text is ASCII based; 128 (minus 32 control codes) characters, basically those found on an US
International keyboard. ASCII was extended to support an additional 128 characters. Due to ASCIIs
limitations, a language specific DOS code page is needed to define what those extra characters
translate to in Windows text (Unicode with thousands of characters).

Some work is needed to facilitate a DOS application to print to a Windows printer, mainly:
The stream of text and printer control codes sent to a LPTx/COMx port has to be collected, and at some
moment converted to graphical images of pages.
Those images then have to be redirected to a Windows printer (mostly not parallel/serial).

When a DOS application prints text, vDos will:


Save that text to a #LPTx/COMx.asc file, so you can optionally use an alternative (external) Windows
program to convert the (ASCII) text in that file, and print the generated pages to Windows printers.
Convert the (ASCII) text to Windows Unicode text (based on the DOS code page), and save it to a
#LPTx/COMx.txt file. You can open that file in a Windows editor, or read it into a Windows application.
By default convert the collected text to graphical images and send those to the default Windows printer.

Printing in vDos.
If you dont tell vDos (in config.txt) what to do with text sent to a LPTx/COMx port, vDos will print to the
default Windows printer. If the printer output is plain text (with line feeds and eventually form feeds),
possibly with printer codes inserted by your DOS application as if it was printing to an Epson/IBM
compatible printer, this should work just fine.

You can adjust the default settings of how this text is handled by adding a LPTx/COMx = options line
(without the quotation marks shown here) to config.txt. The options on the right side of the equals sign are:

SEL
Will first display a printer selection dialog; choose to what installed Windows printer to print.
SEL=printer name
Explicitly set the printer to be used.
* Default: the default Windows printer

RAW
To use this option, the (selected) printer must support DOS text input (PCL/PostScript printers do). The
(ASCII) text is sent directly to the printer. For example, use RAW when printing to an actual PCL printer,
after choosing a PCL (mostly HP) printer in your DOS application.

FONT=Windows installed font


Print the text in this font (should be a monospaced one; each character has the same width).
* Default: Courier New

HORZ=left[,right,chars]
left: The left paper margin in mms.
right: The right margin in mms.
chars: The number of characters that have to fit between these margins.
* Default: 15,10,80

VERT=top[,bottom,lines]
top: The top paper margin in mms.
bottom: The bottom margin in mms.
lines: The number of lines that have to fit between these margins.
* Default: 10,15,calculated using the paper size.

Example:
LPT1 = sel horz=15,10,132
Displays a dialog to select the Windows printer to use, then prints in a smaller sized default Courier New
font, so 132 characters will fit between the left and right margins.

Use a third-party program to print.


vDos support of Epson/IBM printer formatted text is incomplete, especially graphics arent supported. vDos
is also special at setting/handling margins (ignoring those eventually set by embedded printer codes). You
could be unhappy with the end result on paper, perhaps with an application doing extensive print formatting.
Since vDos saves the (ASCII) text to a #LPTx/COMx.asc file, you can use an external DOS-to-Windows
print program. Three of those programs (among others available online):

DOSPRN
Shareware ($14.95, price drops at more licenses).
DOSPRNs author added some extensions to make it work better in vDos. DOSPRN also supports IBM
and PCL codes, and you can eventually define alternative sets of printer codes.
Usage example LPT1: LPT1 = "%ProgramFiles%\DOSPRN\DOSprn.exe" options #lpt1.asc
DOSPrinter
Shareware, it comes in two distinct versions, with a reduced price for vDos users:
Standard ($ 30,-, price drops at more copies).
Single user/workstation license.
Unlimited ($ 380.-).
Grants you the right to use DOSPrinter on an unlimited number of PCs inside your company, you can
also distribute DOSPrinter as part of your software package to other companies (royalty free).
Usage example LPT2: LPT2 = "C:\vDos\DOSPrinter.exe" WAIT options #lpt2.asc
(Provided the DOSPrinter program is copied to the default C:\vDos directory).
WinPrint
Freeware ($ 0).
WinPrint installs to the Windows system tray, monitoring a directory for new files to be printed. There
seems to be no documentation on its use or what printer codes are supported.
Usage example COM1: COM1 = dummy
(vDos shouldnt do anything after creating the #LPTx/COMx files, since WinPrint will be set to monitor a
directory for new .asc files, created by vDos).

DOS application prints to PCL printer.


If your DOS application can print to a PCL printer; many laser printers still support that text input. If you
dont have an actual PCL printer, or want to produce a PDF file to preview, store or send by mail; vDos will
detect that a PCL printer is addressed (the text will contain some PCL specific code sequences). If
provided, the PCL6 program will then be started to convert the saved #LPTx/COMx.asc file to a PDF
document. The PDF document is then opened in the default Windows PDF viewer. PCL6 (GhostPCL) can
be downloaded and is documented at: www.columbia.edu/~em36/ghostpcl.html.
Other options in config.txt.
TIMEOUT = OFF
Printer output is collected as a print job, considered to be finished if the DOS application doesn't send
further text for some time. If you experience problems with printing (broken pages), or just want the printer
to respond faster; you can experiment to see if disabling this mechanism will help. A DOS application can
address a printer is various ways, this will only work for the preferred nice way; first opening and finally
closing a DOS LPTx/COMx device. Mind, DOS applications arent always that nice; nothing could get
printed with this option set.

LPTx/COMx options (x = 1-9, though most DOS programs only support LPT1-3 and COM1-4):

= DUMMY
Dont print; you just want to ignore the printers output, or use an external DOS-to-Windows printer program,
monitoring a directory for new .asc files, created by vDos.

= CLIP
Dont print, copy the (Unicode) text to the Windows clipboard to paste into another program.
Example: COM4 = CLIP

= Windows command/program [command/program options] #LPTx/COMx.asc/txt


Open the .asc(ASCII)/.txt(Unicode) file by command/program.
Example: LPT2 = %windir%\system32\notepad.exe HIDE /p #lpt2.txt
(Let notepad.exe print (/p) #lpt2.txt, while hiding (HIDE) the Notepad window).

= Windows device:
Communicate with the device interactively (expect no text to collect as a print job). The colon at the end is
required.
Experimental (!) and barely tested; no PC with an actual parallel/serial port, such a device, or even a DOS
program to test around.
Example: COM1 = COM1:

You might also like