What is DOSPrinter:
DOSPrinter is an universal printer driver for DOS applications running under Windows. DOSPrinter is an Epson matrix printer emulator. It allows your DOS applications to print to any printer.
You can send your reports directly to email or Word.
You can convert your reports to PDF without installing any PDF virtual printer, because DOSPrinter has a lightweight and efficient PDF generator built in.
DOSPrinter is a win32 C++ program. It is windowless to keep it simple and discreet. It is small in size, robust and runs very fast.
Usage
Examples
Supported ESC commands
How to print graphics
How to select a font
How to print barcodes
Other howtos
About Localization and code pages
What if my DOS program cannot print to file
How to run DOS applications under 64 bit Windows
Known issues and additional info
Pricing and licensing
Usage:
Command line: DOSPrinter.exe [switches] filename
switches:
/TRAY | ![]() |
|||
/R | Start in resident mode. Similar to TSR under DOS, but since this is a win32 exe, you should consider resident mode as the background process mode. What "resident" means: DOSPrinter prints the specified file(s) and after that it waits in background for the specified file(s) to change. After the file(s) has changed, DOSPrinter prints out this changed file(s). Multiple instances of DOSPrinter are allowed with /R switch. Your application could print on several different printers this way: start more instances of DOSPrinter /R, each one with a different input file (or different folder) and a different destination printer specified. It's up to your application to provide different filenames for input files. The switch /R is very similar to /TRAY. /R is better when you don't want to have any UI or systray icon. |
|||
/R1 | Same as /R, but it allows only one instance of DOSPrinter per computer (also, all desktops and users under Windows). If any previous instance of DOSPrinter exists, an error message pops up and the second DOSPrinter instance does not start. | |||
/U | Unload instance(s) of DOSPrinter from the memory. If used together with /IDn switch, unloads only the instance(s) with the specified ID number | |||
/IDn | Optionally specify the ID for the instance. n is the ID number of the instance. This switch can be combined with /R /TRAY and /U switches. | |||
/DEL | Delete the file after printing it. It deletes the file permanently (does not move the file in the recycle bin). | |||
/nn | ![]() For example the /72 switch emulates the Fanfold page size (perforated German Std Fanfold), which is 12'' long on any other page size (letter, A4 etc). This switch gets disabled if any kind of "set vertical motion" esc-command is present in the file. |
|||
/FOCUSn | Restore the focus to the calling window after DOSPrinter did the job. This is useful when the printer driver pops up with a print-status-monitor window, which a lot of modern printer drivers (mostly inkjets) do. This could be very annoying when printing from a full-screen DOS window. In that case, the printer's popup window takes the focus from the DOS window, which gets minimized, and the user has to take the focus back manually, by pressing Alt+Tab. This switch prevents other windows from taking the focus in a period of time. n is the number of seconds to guard over the focus after the job is placed in the spooler. Increase this number for more efficient guarding of the focus, or decrease it for faster DOSPrinter response. If n is omitted, default value is 7 seconds. |
|||
/GOFF | Switch off interpreting of the ASCII graphical characters (forces letters instead of lines and boxes). | |||
/GON | Force graphical characters (lines and box drawing). Optional: install MS LineDraw font for optimal interpretation of the graphical characters. | |||
/SEL | Display the "select printer dialog" before printing the file. | |||
/SEL'printer' | Specify a printer. 'printer' is a printer name from Windows OR a network share name OR the printer port. For example, all of this forms are valid: /SEL'HP LaserJet 2200' /SEL'\\ACCOUNTING\HP' /SEL'LPT2:'. Must be enclosed in singlequotes('), not doublequotes. Note that there is no space between SEL and 'printer'. Download PrnList utility for help with this switch. It lists all installed printers. |
|||
/SEL2 | Display the "select destination dialog" before printing the file. The destination can be the printer, previewer or email. The previewer can be Acrobat Reader or MS Word. Optionally, combine this switch with /PDF or /RTF to specify which one to use as the previewer. Also, you can combine it with /EMAIL, /EMLUI, /SMTP or /SMUI to specify the email destination and with /SEL'printer' to specify the printer destination. | |||
/EMAIL'to' | ![]() This is the complete format for the switch: /EMAIL'recipient_1[,recipient_n][\subject]'. See the examples for an example. Must be enclosed in singlequotes('), not doublequotes. The printout is sent as an attachment in the EMF (enhanced metafile) format by default. If you prefer the RTF or PDF format, combine this switch with the /RTF or /PDF switch. Note that there is no space between /EMAIL and 'to'. If you find the "Would you like to send email" dialog too annoying, disable security options in your email client. If your email client is 64-bit version of Outlook, use 64-bit version of DOSPrinter. When sending, DOSPrinter is stopped until the message is sent or canceled. If you need more options when sending email, unzip DOSPrinter.ini in the working directory. You can edit it with Notepad. A special form of this switch is /EMLUI'to', which brings up the email client's user interface. |
|||
/EMLUIPURE | Sends an email without any input txt file provided - a pure email. The address, subject and body is provided from DOSPrinter.ini file. Other forms of this switch are: DOSPrinter.exe /EMAILPURE - sends email without UI. DOSPrinter.exe /EMLUIPURE Test.ini - same as above, opens the email window with the data populated from Test.ini file. For the case you don’t like the default ini file name DOSPrinter.ini. DOSPrinter.exe /R /EMLUIPURE Test.ini - same thing, but in resident mode. This way DOSPrinter is running all the time. You have to change the content of the file Test.ini. DOSPrinter will automatically create new email from it. |
|||
/SMTP'to' | ![]() 'to' is the optional recipients email address and the subject. The 'to' string format is the same as explained for /EMAIL'to' switch. A special form of this switch is /SMUI'to', which brings up a "Send eMail" window. Again, 'to' is not required. |
|||
/SMTPPURE'to' | Sends an email without any input txt file provided - a pure email. To make it work, you need to download a plug-in program DOSPrinter.SMTP.exe. Unzip it and read readme.html for further details. 'to' is the optional recipients email address and the subject. The 'to' string format is the same as explained for /EMAIL'to' switch. filename is the file to attach unchanged, without any parsing. A special form of this switch is /SMUIPURE'to', which brings up a "Send eMail" window. Again, 'to' is not required. Example: DOSPrinter.exe /SMUIPURE'abc@def.com\my image' *.jpg will send all jpg files from the current folder to email address abc@def.com with the subject "my image". |
|||
/FILE | ![]() If you prefer PDF or RTF format then combine this switch with /PDF or /RTF. In that case, the output filename is: input_filename + .pdf or .rtf extension. Output file name is assigned automatically based on input filename. To specify output filename use the form /FILE'filename'. To specify output folder use the form /FILE'foldername'. To specify a dynamical filename use the variables %date% and %time% which will be replaced by current date and time in format YYYYMMDD and HHMMSS. Example: /FILE'%date%_%time%'. |
|||
/RTF | ![]() If you don't have MS Word, consider free MS Word Viewer. Other RTF editors/viewers are just not so rich. A special form of this switch is /RTFG. "G" is for graphics. Use /RTFG when printing bit-image graphics (when using ESC* or ESCJ commands on the document). Another form is /RTP or /RTPG, which immediately prints (using Word), instead showing the document. |
|||
![]() A special form of this switch is /PDP, which prints immediately from Adobe Reader, instead previewing the document. If you want to create a PDF file without opening the Acrobat Reader use the switch /FILE. DOSPrinter uses its own PDF composer. You don't need any third party PDF printer driver. Known problems and solutions related to /PDF: - You cannot use GIF images in PDF for embbedded graphics (ESC"file" command) or watermarking (/IMAGE switch). JPG and BMP are only supported. |
||||
/LEFTn.nn | Set the left margin in inches. n.nn is a decimal number value for inch distance from the left paper edge. If you specify the margin lesser than the printer's physical (mechanical) margin is, the value of n.nn is ignored. Note that there is no space between LEFT and n.nn. | |||
/TOPn.nn | Set the top margin in inches. n.nn is a decimal number value for the inch distance from the top paper edge. If you specify the margin lesser than the printer's physical (mechanical) margin is, the value of n.nn is ignored. Note that there is no space between TOP and n.nn. | |||
/PAGExx | Set page size. The format can be one of these: /PageA3, /PageA4, /PageA5, /PageB4, /PageB5, /PageLETTER (short /PageLET), /PageLEDGER (short /PageLED), /PageLEGAL (short /PageLEG), /PageEXECUTIVE (short /PageE), /PageFOLIO (short /PageF). A special form is /PAGEnnnXnnn where you can set the page width and height in tenths of a millimeter. For example for the page 20cm by 30cm the switch is /Page2000x3000. If you are measuring in inches, multiply the inches by 254 to get tenths of mm. |
|||
/CPInn | Sets characters per inch (vertical character pitch) initially. nn is the number of characters per inch. This are the standard CPI values: - /CPI12 (sets 12 CPI) - /CPI15 (sets 15 CPI) - /CPI17 (sets 17.14 CPI, which is the samme as CONDENSED MODE) - /CPI20 (sets 20 CPI) Default is 10 CPI. You can also set any other nonstandard number of characters per inch. A special form of this switch is /CPIAUTO (short /CPIA) that sets the CPI automatically. If your report is large, the letters will be too small. In that case combine /CPIAUTO with /LAND (landscape). The CPI value set by this switch is superseded with a cpi-related command (like ESCP or ESCM) present in the file. |
|||
/F'font' | ![]() |
|||
/LINES | Draw graphical lines when the lines in the report are represented with minuses ('-----') or equal signs ('====='). The short version of this switch is /LIN. | |||
/LAND | Set landscape orientation. | |||
/9PIN | Print in 9-pin compatibility. Default is 24 (or 48) pin compatibility. Some ESC/P commands work differently for 9-pin and 24-pin printers (like ESC 3, ESC A, ESC *, etc). The short form for this switch is /9P. | |||
/MODERN | ![]() |
|||
/RAW | Print directly to a printer in text mode, without any interpreting or emulating. Useful with matrix printers. There are two different worlds in printing: text mode and graphical mode. The graphical mode becomes the issue with matrix printers - they are just too slow in graph mode and DOSPrinter by default works in graph mode. On the other side, there are ink-jets and laser printers; even if some of them do have the text-mode printing capabilities, they are not so slow in graphical mode, so this switch is obsolete for this kind of printers. But, a DOS program can print directly to a matrix printer, without the need of an intermediator like DOSPrinter. So, where is the purpose for this switch? First: If you have a text-mode printer with USB port, you cannot print directly to it from a DOS program, and this switch is one of the possible solutions for that. Second: you can use DOSPrinter as the print server for your (DOS or Win) application, and not caring about what type of printer is on the other side of DOSPrinter interface. If the printer is a matrix one, you could use the /RAW switch, and your application doesn't have to be aware of that. Following switches could be combined with the /RAW switch: /TRAY, /R, /R1, /DEL, /SEL, /SEL'prn', /FOCUS, /S, others are ignored. |
|||
/S | Silent mode. Prevents showing the error message dialog window. | |||
/EUROnnn | ![]() |
|||
/DELAYnn | Delay printing for nn seconds. nn is a minimal delay. It is proportionally prolonged when the file changes during the delay. Delaying is suitable when the input file closes before it is completed (buffered file writing). Default value is 0 (no delay). | |||
/CHOPnn | Some printers are too slow in start (1 minute or more to start printing) when the report is large. This switch cuts the large reports in multiple spool jobs. nn is a number greater than or equal to 1, and represents the max number of pages to put in a single spool job. Smaller nn value means smaller jobs and faster starting of printing. Use this switch sparingly in a multiuser environment, because your printed pages might be interspersed with other documents that are using the same printer spooler. |
|||
/FITnn | ![]() |
|||
/IMAGE'file' | Set background image on every page (watemark). The complete format is: /IMAGE'file,x,y,dpi' where 'file' is the image filename, x and y are coordinates in thousands of inch, dpi is the resolution of the image. For example, if you'd like the image 2 inches from the left and the top edge, the switch would be /IMAGE'file.jpg,2000,2000'. 'image,x,y,dpi' must be enclosed in single quotes ('). If x and y are not specified, the default is 0. If dpi not specified the default is 200. The background image should be a light color image to not interfere with the foreground text. |
|||
/JOB'name' | Set printer spooler job name to 'name'. 'name' is any string enclosed in single quotes ('). If not specified, the job name by default is 'DOSPrinter'. Job name is visible in the printer spooler queue and in printer status window that shows the ink level. | |||
/CP1252 | Force code page 1252, which is the default ANSI charset (US English). | |||
/CP932 | Force code page 932, which represents the SHIFTJIS charset. | |||
/CP949 | Force code page 949, which represents the HANGUL charset. | |||
/CP936 | Force code page 936, which represents the GB2312 charset. | |||
/CP950 | Force code page 950, which represents the CHINESEBIG5 charset. | |||
/CP1253 | Force code page 1253, which represents the GREEK charset. | |||
/CP1254 | Force code page 1254, which represents the TURKISH charset. | |||
/CP1255 | Force code page 1255, which represents the HEBREW charset. | |||
/CP1256 | Force code page 1256, which represents the ARABIC charset. | |||
/CP1257 | Force code page 1257, which represents the BALTIC charset. | |||
/CP1251 | Force code page 1251, which represents the RUSSIAN charset. | |||
/CP874 | Force code page 874, which represents the THAI charset. | |||
/CP860 | Force code page 860, which represents the PORTUGUESE charset. | |||
/CP1250 | Force code page 1250, which represents the EASTEUROPEAN charset. | |||
/CP437 | Force the nonstandard easteuropean DOS code page 437. | |||
/LNG | ![]()
|
BS | Backspace |
HT | Tab horizontally |
LF | Line feed |
VT | Tab vertically |
FF | Form feed |
CR | Carriage return |
SO | Select double-width printing (one line) |
SI | Select condensed printing |
DC2 | Cancel condensed printing |
DC4 | Cancel double-width printing (one line) |
ESC SO | Select double-width printing (one line) |
ESC SI | Select condensed printing |
ESC ! | Master select |
ESC - | Turn underline on/off |
ESC + | Set n/360-inch line spacing |
ESC 0 | Select 1/8-inch line spacing |
ESC 1 | Select 7/72-inch line spacing |
ESC 2 | Select 1/6-inch line spacing |
ESC 3 | Set n/180-inch line spacing |
ESC 4 | Select italic font |
ESC 5 | Cancel italic font |
ESC @ | Initialize printer |
ESC * | Select bit image (also ESC ^, ECS K, ESC L, ESC Y, ESC Z) |
ESC A | Set n/60-inch line spacing |
ESC C | Set page length in lines |
ESC E | Select bold font |
ESC F | Cancel bold font |
ESC G | Select double-strike printing |
ESC H | Cancel double-strike printing |
ESC P | Select 10-cpi |
ESC M | Select 12-cpi |
ESC g | Select 15-cpi |
ESC l | Set left margin. This margin is added to the margin specified through the /LEFT switch. |
ESC J | Advance print position vertically |
ESC j | Reverse paper feed (n/216 inch) |
ESC N | Set bottom margin (set skip-over-perforation) |
ESC O | Cancel bottom margin (cancel skip-over-perforation) |
ESC R | Select an international character set |
ESC S | Select superscript/subscript printing |
ESC T | Cancel superscript/subscript printing |
ESC W | Turn double-width printing on/off |
ESC w | Turn double-height printing on/off |
ESC r | Select printing color |
ESC x | Set LQ of draft |
ESC ( - | Select line/score (underline/strikethrough) |
ESC B | Set vertical tabs |
ESC D | Set horizontal tabs |
ESC e | Set fixed tab increment |
ESC f | Horizontal/vertical skip |
ESC ( V | Set absolute vertical print position |
ESC $ | Set absolute horizontal print position |
ESC \ | Set relative horizontal print position |
ESC EM | Control paper loading/ejecting (select paper source) |
ESC ( B | Barcode setup and print |
ESC k | Select typeface |
ESC p | Turn proportional mode on/off |
ESC X | Select font size by pitch and point |
ESC z n | Select font size. n is a byte number representing the Word font size. This is a nonstandard ESC sequence. |
ESC SP | Set intercharacter space by n/120 inch |
n | Font name | n | Font name | n | Font name |
0 | Courier New | 6 | Impact | 12 | Monofur |
1 | Lucida Console | 7 | Comic Sans MS | 13 | Haettenschweiler |
2 | Andale Mono | 8 | Bookman Old Style | 14 | Garamond |
3 | Letter Gothic | 9 | Script | 15 | Verdana |
4 | Monotype Corsiva | 10 | Times New Roman | 16 | Tahoma |
5 | Arial | 11 | Century Gothic | 17 |
Barcode type |
Notes about check character |
Notes about BarCodeData characters |
EAN-13 | The last digit is a checksum digit. DOSPrinter calculates the checksum digit automatically. You have to provide 12 digits. If provided 13 digits, the last digit is ignored and replaced by DOSPrinter in all cases. |
Valid barcode characters are 13 digits in the range 0 - 9 Invalid characters are replaced with zeroes. |
EAN-8 | The last digit is a checksum digit. DOSPrinter calculates the checksum digit automatically. You have to provide 7 digits. If provided 8 digits, the last digit is ignored and recalculated by DOSPrinter in all cases. |
Valid barcode characters are 8 digits in the range 0 - 9 Invalid characters are replaced with zeroes. |
UPC-A | The last digit is a checksum digit. DOSPrinter calculates the checksum digit automatically. You have to provide 11 digits. If provided 12 digits, the last digit is ignored and recalculated by DOSPrinter in all cases. |
Valid barcode characters are 12 digits in the range 0 - 9 Invalid characters are replaced with zeroes. |
UPC-E | The last digit is a checksum digit. DOSPrinter does not calculate the checksum digit automatically for this barcode type. |
Valid barcode characters are 8 digits in the range 0 - 9 Invalid characters are replaced with zeroes. First digit (named number system digit) must be 0 or 1. |
Interleaved 2 of 5 | Optionally, DOSPrinter inserts a mod 10 checksum character at the end, if bit 0 of flag c is set to 1. |
Valid barcode characters are 0 - 9. Invalid characters are replaced with zeroes. The specification requires that the barcode must have even number of digits. If you provide odd number of digits, DOSPrinter adds a zero at the beginning to satisfy the specification. |
CODE 39 | Optionally, DOSPrinter inserts a mod 43 checksum character at the end, before the stop character (*), if bit 0 of flag c is set to 1. |
The start(*) and stop(*) characters are not required, but (by default) DOSPrinter adds them. You can override the automatic generation of start and stop characters by setting the bit 3 of flag c to 1. Valid characters are numbers, uppercase letters and characters '-','.',' ','$','/','+','%','*'. Other characters are skipped. |
POSTNET | The last digit is a checksum digit. DOSPrinter calculates the checksum digit automatically. If you provide the checksum digit, it is ignored and replaced by DOSPrinter. |
Valid barcode characters are 0 - 9 Valid number of digits are 6, 10 and 12 with the check digit included, or 5, 9 and 11 without the check digit. Only special POSTNET code scanner can read this type of barcode. |
CODE 93 | Two checksum characters are required for this barcode type. DOSPrinter calculates and inserts them automatically if bit 0 of flag c is set to 1, at the end, before the stop character (*). |
It is a high-density barcode, suitable for long alphanumeric data. The start(*) and stop(*) characters are not required, but (by default) DOSPrinter adds them. You can override the automatic generation of start and stop characters by setting the bit 3 of flag c to 1. Valid are all the ASCII characters with code from 0 to 127. |
CODE 128 | Checksum character is required for this barcode type. DOSPrinter calculates and inserts one automatically if bit 0 of flag c is set to 1. |
It is a high-density barcode (especially dense for numbers), suitable for long alphanumeric data. Valid are all ASCII characters with code 32 to 127. Invalid characters are ignored. |
Codabar | There is no checksum character for this barcode. |
You must manually provide the start and stop characters, which could be characters A, B, C or D. Valid data is numbers 0-9 and characters '-','$',':','/','.' and '+'. Other, invalid characters are ignored. |