0% found this document useful (0 votes)
120 views8 pages

Do Sprinter

q
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
120 views8 pages

Do Sprinter

q
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

What is DOSPrinter:

DOSPrinter is an Epson printer emulator. It facilitates DOS applications that support an Epson
printer or emulation, to actually print to any GUI (Windows) printer, email, RTF (MS Word) or PDF.

The DOSPrinter program is shareware. Included in vDos installation is a demo version that
occasionally prints a copyright notice on the first page and is valid for 30 days. If you find it useful,
register your copy. The developer offers a special vDos edition for a reduced price. This version
misses the /TRAY switch that isn’t needed for vDos.
DOSPrinter is available in two distinct types of licenses:
1. Standard ($ 30,-, price drops for more copies).
Single user/workstation license.
2. Unlimited ($ 380.-).
This grants you the right to use DOSPrinter on an unlimited number of workstations inside
your company and you can distribute DOSPrinter as part of your software package to other
companies (royalty free).

How to use DOSPrinter.


Note: Only switches of interest for vDos are listed here.

/nn Force nn lines per page (nn is a number).


For example /72 emulates the Fanfold page size (perforated German Std Fanfold), which
is 12'' long or any other page size (letter, A4 etc). This switch gets disabled if any kind of
"set vertical motion" ESC command is present in the printer data.
/GOFF Switch off interpreting 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.
/SEL'printer' Specify a printer. 'printer' is a Windows printer name, a network share name or the printer
port. For example, all of this forms are valid:
/SEL'HPLaserJet2200' /SEL'\\ACCOUNTING\HP' /SEL'LPT2:'.
Must be enclosed in singlequotes('), not doublequotes. Note that there is no space between
SEL and 'printer'.
/SEL2 Display the "Select destination dialog" before printing. The destination can be a printer,
previewer or email. The previewer can be a PDF reader or MS Word. Optionally, combine
this switch with /PDF or /RTF to specify which one to use. You can also combine it with
/EMAIL, /EMLUI, /SMTP or /SMUI to specify the email destination and with /SEL'printer'
to specify the default printer destination.
/EMAIL'to' Print to email instead of printer. 'to' is the email address of the recipient. Specify more
recipients by separating them with ',' or ';'. Include the email subject by separating it with
the '\' sign (backslash).
This is the complete format for the switch: /EMAIL'recipient_1[,recipient_n][\subject]'.
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, add the /RTF or /PDF switch.
Note that there is no space between /EMAIL and 'to'. If you get and find the "Would you
like to send email" dialog annoying, you have to disable it in your mail client.
When sending, DOSPrinter is stopped until the message is sent or canceled.
If you need more options for sending email, edit DOSPrinter.ini in the working directory.
A special form of this switch is /EMLUI'to', which brings up the email client's user
interface.
/SMTP'to' Print to email instead of printer. Everything is the same as the /EMAIL switch, except it
sends the mail directly to the mail server over the SMTP protocol. To make it work, you
need a plug-in program: DOSPrinter.SMTP.exe. Read readme.html for further details.
A special form of this switch is /SMUI'to', which brings up a "Send eMail" window.
Again, 'to' is not required.
/FILE Print to file instead of printer. The output file is a graphical format type (EMF). EMF is
viewable with the majority of available graphical viewers. The output filename is:
input_filename + page_number + .emf extension.
Another option would be to print to a RTF or PDF file type by including the /RTF or /PDF
switch. In that case, the output filename is: input_filename + .rtf or .pdf extension.
Short version of this switch is /FI.
/RTF Print to "Rich Text Format", viewable and editable with most word processors.
A special form of this switch is /RTFG. "G" is for graphics. Use /RTFG when printing bit-
image graphics (using ESC* or ESCJ commands in a document). Another form is /RTP or
/RTPG, which immediately prints (using Word), instead of showing the document.
/PDF Print to PDF. You must have Adobe Acrobat Reader or another PDF viewer installed in
order to view PDF files
A special form is /PDP, which prints immediately instead of previewing the document.
If you only want to create a PDF file without opening it, add the /FILE switch.
DOSPrinter has its own PDF composer. You don't need any third party PDF printer driver.
You cannot use GIF images in PDF for embedded 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 the distance from the left
paper edge. If you specify a value less than the printer's physical (mechanical) margin,
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 distance from the top
paper edge. If you specify a value less than the printer's physical (mechanical) margin,
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 20x30cm the switch is /Page2000x3000. If you are
measuring in inches, multiply the inches by 254 to get tenths of mm.
/CPInn Sets the characters per inch (horizontal character pitch) initially. nn is the number of
characters per inch. These are the standard CPI values:
/CPI12 (12 CPI)
/CPI15 (15 CPI)
/CPI17 (17.14 CPI, which is the same as CONDENSED MODE)
/CPI20 (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 wide, the letters can be too small. In that case add /LAND (landscape).
The CPI value set by this switch is superseded by a cpi-related command (like ESCP or
ESCM) in the printer data.
/F'font' Set font name. 'font' is the font name. The default font is ‘Courier New’.
/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 mode. 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 *).
The short form for this switch is /9P.
/MODERN Select "Modern" style font, default is "Old" style. Old style characters are bigger and more
readable. It affects 17 and 20 cpi font size only. The short form for this switch is /M.
/RAW Print directly to a printer, without any interpreting or emulating. Useful with DOS
compatible printers.
Following switches can be combined with the /RAW switch: /R, /R1, /DEL, /SEL,
/SEL'prn', /S, others are ignored.
/S Silent mode. Prevents showing an eventual error message dialog window.
/EUROnnn Defines the ASCII character for the Euro symbol. nnn is a number between 33 and 255.
Note that there is no space between EURO and nnn. By default Euro is ASCII code 128.
/DELAYnn Delay printing for nn seconds. nn is a minimal delay. It is proportionally prolonged when
the printer data 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 slow in starting printing (1 minute or more) when the report is large.
This switch cuts 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 the other documents that are using the same printer spooler.
/FITnn Set the text width, nn is a percent value. Values smaller than 100% will shrink the text,
greater than 100% enlarges the text width. This is useful with nonstandard paper sizes. If
you are using a common paper size like Letter, A4, A5, etc, you don't need to specify this
switch. In that case DOSPrinter fits the text width automatically to the paper width. If you
have to fit the text by the height, use the /nn switch (see details above).
/IMAGE'file' Set a background image on every page (watermark). 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.
/JOB'name' Set printer spooler job name to 'name'. 'name' is any string enclosed in single quotes ('). If
not specified, the job name is 'DOSPrinter'. Job name is visible in the printer spooler
queue, some printer status managers etc.
/CP1252 Force code page 1252, The default ANSI charset (US English).
/CP932 932, SHIFTJIS.
/CP949 949, HANGUL.
/CP936 936, GB2312.
/CP950 950, CHINESEBIG5.
/CP1253 1253, GREEK charset.
/CP1254 1254, TURKISH.
/CP1255 1255, HEBREW.
/CP1256 1256, ARABIC.
/CP1257 1257, BALTIC.
/CP1251 1251, RUSSIAN.
/CP874 874, THAI.
/CP860 860, PORTUGUESE.
/CP1250 1250, EASTEUROPEAN.
/CP437 Force the nonstandard east European DOS code page 437.
/LNG Set a different user interface language. Currently supported languages:
/LngBR (Brasilian Portuguese) /LngHR (Croatian)
/LngPT (Portugal Portuguese) /LngSI (Slovenian)
/LngES (Spanish) /LngIT (Italian)
/LngEN (English) /LngDE (German)
/LngFR (French) /LngHU (Hungarian)
/LngNL (Dutch) /LngCA (Catalan)
Translations are stored in the editable file Language.ini. English is default.
Note: Switches can be used in any combination and sequence. Switches are case insensitive.
Instead of '/' you can also use the '-' sign.

Some examples:
1. /SEL - Before printing, show select printer dialog.
2. /SEL'HP LaserJet 2200' - Print to HP LaserJet printer.
3. /EMLUI'[email protected],[email protected]\Monthly report' - Send an email message with the
subject 'Monthly report'.
4. /SMUI'[email protected]\Monthly report' - Send an email message directly over SMTP.
5. /PDF /F'Lucida Console' – Create a PDF file and open it. Use the font named Lucida
Console.
6. /PDF /IMAGE'watermark.jpg,1000,2000,100' – Create a PDF file. Set the image
watermark.jpg as the background on every page. Watermark.jpg will be placed 1 inch from
the left and 2 inches from the top edge. The resolution is set to 100 DPI.

Esc/P Esc/P2 supported commands:


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 ^, ESC 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

Print graphics:
1. Put inside the text this sequence: ESC"filename.bmp". ESC is ASCII code 27, filename.bmp
the name of the image file to print. Don't forget to enclose the filename in double quotes. The
image is printed with a resolution of 200 dpi. This means that if you want the image with
dimensions 1x1 inch on the paper, you provide an image of 200x200 pixels.
You can change the default resolution for the image with: ESC"filename.bmp,400DPI".
Note that there is no space between ESC and "filename". Images can be BMP, GIF, JPG,
ICO format. This is a nonstandard ESC command.
2. Use the ESC* sequence (Bit-image mode) in your documents. This is a standard ESC/P
ESC/P2 command.
3. If you'd like to print an image on every page, use the switch /IMAGE'filename'.

Select a font:
1. Use the /F'fontname' switch, where 'fontname' is the name of an installed Windows font.
2. Embed the ESCkn (Select typeface) sequence in your document. This is a standard ESC/P
ESC/P2 command. The third byte of the sequence ESCkn is a number representing the font
name by this table:

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

Note that not all fonts supports every code page.


There are two types of fonts: fixed and proportional pitch. Fixed means that every letter has the
same width. DOSPrinter yields the best results with fixed pitch fonts.
By default DOSPrinter works with proportional mode turned off (fixed pitch mode). Use the ESC
sequence ESCp1 to set the proportional mode on, or ESCp0 to set it off.
You can change the font size (or CPI) with the standard ESC sequences like ESC P, ESC M, ESC
g, ESC X, etc.
A special ESC sequence for setting the font size is ESCzn, where n is a byte number representing
the Word font size. This is a nonstandard ESC sequence.

Print barcodes:
The standard ESC sequence for printing barcodes is ESC ( B nL nH k m s v1 v2 c BarCodeData
where ESC is ASCII 27, ( is ASCII 40, B is ASCII 66.

nL and nH are two bytes representing the total number of following data bytes, determined by the
equation: (number of data bytes) = 6 bytes + BarCodeData bytes = ((nH*256) + nL). (where 6 bytes
are k, m, s, v1, v2, and c). nH is ignored in DOSPrinter. This means you can print barcodes with
max 255-6=249 characters, which should be enough.

k is the barcode type. Possible values for k and meanings are:


0 = EAN-13
1 = EAN-8
2 = Interleaved 2 of 5
3 = UPC-A
4 = UPC-E
5 = Code 39
6 = Code 128
7 = POSTNET
8 = Code 93
9 = CODABAR

m is the barcode width measure. Possible values are 1, 2, 3, 4 and 5.

s is the "Space adjustment value". It is ignored by DOSPrinter.

v1 and v2 represent the barcode length (height) calculated by the formula: inches = (v1 + v2*256) /
180. For 9pin mode emulation the formula is (v1 + v2*256) / 72.

c is the “Control flag”. The bits have these meanings:


bit 0 is 0/1: No/a check digit is added.
bit 1 is 0/1: The human readable characters are added/not added.
bit 2 is 0/1: Flag character is centered/under (for EAN-13 and UPC-A only).
bit 3 is 0/1: For CODE39 and CODE93 only - start and stop characters (*) are added/not added.
Other bits are ignored.

BarCodeData are characters to be printed. Some comments about barcode characters:

Barcode Notes about the check character Notes about BarCodeData characters
type
EAN-13 The last digit is an automatically calculated Valid characters are 13 digits in the range 0 – 9.
checksum. You have to provide 12 digits. If Invalid characters are replaced with zeroes.
provided 13 digits, the last digit is replaced.
EAN-8 The last digit is an automatically calculated Valid characters are 8 digits in the range 0 – 9.
checksum. You have to provide 7 digits. If Invalid characters are replaced with zeroes.
provided 8 digits, the last digit is replaced.
UPC-A The last digit is an automatically calculated Valid characters are 12 digits in the range 0 – 9.
checksum. You have to provide 11 digits. If Invalid characters are replaced with zeroes.
provided 12 digits, the last digit is replaced.
UPC-E The last digit is a checksum. It is not calculated Valid characters are 8 digits in the range 0 – 9.
automatically for this barcode type. Invalid characters are replaced with zeroes.
First digit (number system digit) must be 0 or 1.
Interleaved Optionally, a mod 10 checksum character is Valid barcode characters are 0 - 9.
2 of 5 inserted at the end, if bit 0 of flag c is set to 1. Invalid characters are replaced with zeroes.
The specification requires that the barcode must have
an even number of digits. If you provide an odd
number of digits, a zero at is added at the beginning
to satisfy the specification.
CODE 39 Optionally, a mod 43 checksum character is The start(*) and stop(*) characters are not required,
inserted at the end, before the stop character but are by default added. You can override this by
(*), if bit 0 of flag c is set to 1. setting the bit 3 of flag c to 1.
Valid characters are digits, big letters and characters '-
','.',' ','$','/','+','%','*'. Other characters are skipped.
POSTNET The last digit is an automatically calculated Valid barcode characters are 0 - 9
checksum. If you provide the checksum digit, it Valid number of digits are 6, 10 and 12 with the check
is replaced. digit included, or 5, 9 and 11 without the check digit.
Only special POSTNET code scanners can read this
type of barcode.
CODE 93 Two checksum characters are required for this It is a high-density barcode, suitable for long
barcode type. These are calculated and alphanumeric data.
inserted automatically if bit 0 of flag c is set to The start(*) and stop(*) characters are not required,
1, at the end, before the stop character (*). but are by default added. You can override this by
setting the bit 3 of flag c to 1.
Valid are the ASCII characters 0 to 127.
CODE 128 Checksum character is required for this It is a high-density barcode (especially dense for
barcode type. It is calculated and inserted numbers), suitable for long alphanumeric data.
automatically if bit 0 of flag c is set to 1. Valid are ASCII characters 32 to 127. Invalid
characters are ignored.
Codabar There is no checksum character for this You must manually provide the start and stop
barcode. characters, which could be characters A, B, C or D.
Valid data are digits 0-9 and characters '-','$',':','/','.'
and '+'. Invalid characters are ignored.
See examples\BarCode for how to use the ESC ( B command.

Change the paper orientation (Landscape/Portrait):


By default DOSPrinter prints in Portrait orientation. These two methods change it to Landscape:
1. The /LAND switch. This is very simple and changes the orientation for all pages.
2. To change the orientation at the page level, put inside the document this command seqence:
ESCoL or ESCoP, where ESC is ASCII code 27, o is 111, L is 76, P is 80.
ESCoL is for setting Landscape orientation, ESCoP for Portrait.
The rule for these two commands is: If an ESCo command is found at the beginning (first 20
bytes) of the page, it affects the current and next pages. If not, it affects the next pages only.
ESCo is a nonstandard ESC command. See examples\Land.txt for an example.

Print multiple copies of pages:


By default DOSPrinter prints one copy of each page. You can set the number of copies with the
ESC sequence ESCnN placed in the document to print, where ESC is ASCII code 27, n is 110, N
is the number of copies.
You can set different number of copies for individual pages. The rule is: If the ESCnN sequence is
found at the beginning (first 20 bytes) of the page, it affects the current and next pages. If not, it
affects the next pages only.
ESCnN is a nonstandard ESC command. See examples\Copies.txt for an example of the usage of
ESCnN command.
Some printers are not capable to print multiple-page copies (virtual printers, for example).

Print on both sides of the page (duplex printing):


If your printer is capable to print in duplex mode, you can put inside the document this command
sequence: ESCoV or ESCoH, where ESC is ASCII code 27, o is 111, V is 86, H is 72.
The rule for this ESC sequence is: If an ESCoV or ESCoH command is found at the beginning
(first 20 bytes) of the page, it affects the current and next pages. If not, it affects the next pages
only. To switch back to simplex mode, use the ESC sequence ESCoS.
ESCoV, ESCoH and ESCoS are nonstandard ESC commands.

Control the paper source (change paper bin):


Set the paper source in the printer driver properties, or use the /SEL switch to select a paper
source. These methods are simple, but set the paper source for all pages.
With the ESC sequence ESC EM nL nH you can set the paper source per page. ESC is ASCII code
27, EM is 25, nL and nH are two bytes identifying the paper source. nL is the low, nH the high byte.

How to find the values for nL and nH? There is a form


of this command to help you with that. Put in the
document this form of command: ESC EM 255 0,
where 255 is value for nL, 0 is the value for nH. This
form of command shows a message box like the
image on the right, displaying all possible paper
sources with their ID numbers for the selected
printer. The formulas are:
nH = INT(ID/256)
nL = MOD(ID/256)

For example, ID for Cut Sheet is 258 (see sample image), so nH = 1 and nL = 2. This is a standard
ESC/P command, but there is a difference from the DOSPrinter implementation: The standard
requires only one byte for the n value. The rule is: If the ESC EM command is found at the
beginning (first 20 bytes) of the page, it affects the current and next pages. If not, it affects next
pages only.

Localization and code pages:


By default DOSPrinter interpreters the current DOS OEM character set. You can check which
OEM code page is currently active on your machine by finding the registry key:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Nls\Codepage\OEMCP. You can
also change this value (at your own risk).
You could override this default behavior by including the switch "/CPnnnn", where nnnn is your
code page. If you want the screen UI translated use the switch /LNGxx (see details above).

Issues and additional info:


Some printer drivers behave strangely. That is the case with some drivers produced by HP, or
others, especially drivers for cheap inkjets. The strange behavior is that they are printing slow, or
not rendering some fonts or code pages. The solution is to install another printer driver. The
easiest thing to do is to use a compatible driver that already exist in Windows. For example, if you
have a HP DeskJet 3820 behaving oddly, follow these instructions:

 Click “Start” - "Control Panel" - "Printers and Faxes" - "Add Printer"


 The wizard will ask for the printer port. Select the same port the existing driver uses.
 From the "Manufacturers" list select "HP".
 From the "Printers" select "HP DeskJet" (without the model number).

This way we installed a generic DeskJet driver, which works all right in all the circumstances. You
can use it together with the existing, original driver from the printer box.
Another solution to this problem would be to use the /PDP or /RTP switch. This uses the PDF
reader or Word to print the report to the driver in question.

You might also like