| |
 |
Chapter 5
- Control codes - Escape sequences
Some special characters
inserted in the ASCII print file can be used to modify
the appearance of the print job.
Also known as Escape
Sequences, these codes were commonly used in text-mode
printing to obtain special effects, such as bold,
underline, and so on.
There were different
sets of escape sequences for different printer models, so
printing to an Epson printer were requiring the
programmer to send a different ascii stream than printing
the same job to an HP printer.
Using
PRINTFIL, a single set of Control Codes can be used to
produce those effects to ANY Windows printer, regardless
of which emulation it supports (or no
emulation at all if it is a Windows-only printer),
because PRINTFIL automatically translates the control
codes found on the ascii print-job file into the correct
Graphical Effects for the selected printer, using the
Windows printer driver.
PRINTFIL has its
own set of Escape Sequences, but if you cannot
change the source ascii file (or you dont want to change
it), you can customize them, by inserting the desired
characters (in decimal notation, separated by commas) in
the Printfil's configuration dialog, or directly in the
[Sequences] section of the PRINTFIL.INI file (but in this
case you'll have to restart Printfil in order to apply
the changes).
If Printfil's escape
sequences does not match those embedded by the source
application into its print jobs, you'll see some extra
characters printed within the text. If you
already know which kind of sequences your source app. is
embedding (Epson, HP, ...), you can select them in the Configuration -> Standard -> Escape dialog. If you don't know which
kind of sequences are them you can find them out
by using the "Help -> Dump: Redo Last Print"
Printfil's menu entry. In this way you'll see the decimal
value near each character in your last printed job.
It is also
possible to simultaneously use more than a sequence for
each effect, allowing Printfil to correctly
manage jobs designed for different printer models: Epson,
HP etc. without to modify the source app. To do so,
simply separate the different sequences by the pipe char
("|" - 124 dec.)
For example:
| C:\WINDOWS\PRINTFIL.INI
[Sequences]
Bold_on=27,80,1
Bold_off=27,80,2
Ignore_Chars=26,69|27,67,66
|
The
following table has the default sequences and the entries
you can use in PRINTFIL.INI to customize them.
| CHARACTER OR SEQUENCE |
EFFECT |
PRINTFIL.INI |
| 13 |
Carriage Return |
|
| 10 |
Line feed |
|
| 12 |
Form feed |
|
| 9 |
Tabulation of the text in fields
(8 characters) |
|
| 8 |
Delete previously sent character (backspace) |
|
| |
This setting is useful to ignore a
sequence on the file (for example printer reset
strings) |
Ignore_Chars |
| 27,18 |
Set normal font width: 10 cpi. (1) |
Normal_Width |
| 27,15 |
Set condensed font width: 17 cpi. (1) |
Condensed |
| 27,87,1 |
Set double-wide font width: 5 cpi. (1) |
Double_Width |
| 27,16,5 |
Set font width at 8 cpi. (1) |
Cpi8 |
| 27,16,1 |
Set font width at 12 cpi. (1) |
Cpi12 |
| 27,16,2 |
Set font width at 14 cpi. (1) |
Cpi14 |
| 27,16,3 |
Set font width at 15 cpi. (1) |
Cpi15 |
| 27,16,4 |
Set font width at 20 cpi. (1) |
Cpi20 |
| 27,119,1 |
Double Height |
Double_Height |
| 27,119,0 |
Normal Height |
Normal_Height |
| 27,83,0 |
Superscript on (use Normal_Height to
turn it off) |
Superscript |
| 27,83,1 |
Subscript on (use Normal_Height to turn it off) |
Subscript |
| 27,80,1 |
BOLD on |
Bold_on |
| 27,80,2 |
BOLD off |
Bold_off |
| 27,80,3 |
ITALICS on |
Italics_on |
| 27,80,4 |
ITALICS off |
Italics_off |
| 27,80,5 |
UNDERLINE on |
Underline_on |
| 27,80,6 |
UNDERLINE off |
Underline_off |
| 27,80,7 |
Switching Font Start (2) |
Font_Start |
| 27,80,8 |
Switching Font End (2) |
Font_End |
| 27,80,11 |
Switching Image Start (3) |
Img_Start |
| 27,80,14 |
Switching Image End (3) |
Img_End |
| 27,80,15 |
Switching Color Start (4) |
Color_Start |
| 27,80,16 |
Switching Color End (4) |
Color_End |
| 27,80,17 |
Copies Start (5) |
Copies_Start |
| 27,80,18 |
Copies End (5) |
Copies_End |
(1) The
normal width of the font, as we have previously said, is
computed based on the sheet dimensions and on the number
of characters per row specified in the configuration
dialog or in the FILENAME.CFG.
For example, if we have an A4 sheet, the columns are set
to 80 and the margins are set to 0.5 Cm., we'll have a
width of about 10 cpi. We assume this dimension to be
"normal" (i.e. sending chr(27)+chr(18) ). To
set a font with different dimensions, PRINTFIL will use
the ratio between the normal dimension and the desired
one. For example: Condensed = Normal / 10 * 17 (80
"normal" characters = 80 / 10 * 17 = 136
"condensed" characters in the same space in a
row).
(2) Using this
sequences you can change the font used in the print job.
For example, if in the middle of a job you print
chr(27)+chr(80)+chr(7)+"Arial"+chr(27)+chr(80)+chr(8),
all the following characters will be printed in Arial
font. To reset the font to the default (the one specified
in PRINTFIL.INI), you have to specify an empty font. i.e.
chr(27)+chr(80)+chr(7)+chr(27)+chr(80)+chr(8). The
Font_End sequence is useful only if you want to print
other characters in the same row, otherwise you can
simply print a chr(10) - Line Feed. For example:
chr(27)+chr(80)+chr(7)+"Arial"+chr(27)+chr(80)+chr(8)+chr(13)+chr(10)
is the same as chr(27)+chr(80)+chr(7)+"Arial"+chr(10)
(3) Using this
sequences you can insert a graphical image into the page.
For example, after printing all the text in page 1
(including a chr(12) - Eject, if needed) you can insert
chr(27)+chr(80)+chr(11)+"C:\BACKGR\LOGO.BMP"+chr(27)+chr(80)+chr(14),
just before to print the text on page 2.
Please note to place it at the beginning of the page,
just before to print the text, so you can eventually
place the text over the bitmap.
You can put more than one bitmap per page concatenating
the sequences. For example:
chr(27)+chr(80)+chr(11)+"C:\BACKGR\LOGO.BMP|1|1|5|-1"+chr(27)+chr(80)+chr(14)
+
chr(27)+chr(80)+chr(11)+"C:\BACKGR\SIDEBAR.BMP|10|1|-1|7"+chr(27)+chr(80)+chr(14).
The Img_End sequence is useful only if you want to print
other characters in the same row, otherwise you can
simply print a chr(10) - Line Feed. For example:
chr(27)+chr(80)+chr(11)+"logo.bmp"+chr(27)+chr(80)+chr(14)+chr(13)+chr(10)
is the same as chr(27)+chr(80)+chr(11)+"logo.bmp"+chr(10)
For a deep explanation of the 4 optional parameters to
place the bitmap everywhere on the sheet, please see the
next chapter.
(4) Using this
sequences you can change the font's color.
For example, if in the middle of a job you print
chr(27)+chr(80)+chr(15)+"255"+chr(27)+chr(80)+chr(16),
all the following characters will be printed in red.
To reset the color to the default (the one specified in
PRINTFIL.INI), you have to specify an empty color. i.e.
chr(27)+chr(80)+chr(15)+chr(27)+chr(80)+chr(16). The
Color_End sequence is useful only if you want to print
other characters in the same row, otherwise you can
simply print a chr(10) - Line Feed. For example:
chr(27)+chr(80)+chr(15)+"0"+chr(27)+chr(80)+chr(16)+chr(13)+chr(10)
is the same as chr(27)+chr(80)+chr(15)+"0"+chr(10).
For a deep explanation about the various color's numbers
see the Color setting in Chapter 3:
Configuration
(5) Using
this sequences you can change the number of copies. The "Copies"
parameter works at the entire job level, not for a single page.
If more than a "copies sequence" is present in the print job, Printfil
will apply the last found one to all the pages in the print job.
For example, if in the middle of a job you print
chr(27)+chr(80)+chr(17)+"2"+chr(27)+chr(80)+chr(18),
the job willbe printed in 2 copies. The Copies_End sequence is needed
only if you want to print other characters in the same row or if
you're using the HP-PCL emulation ( Copies_Start =
chr(27)+chr(38)+chr(108) ). In all the other cases you can simply print
a chr(10) - Line Feed. For example: chr(27)+chr(80)+chr(17)+"3"+chr(27)+chr(80)+chr(18)+chr(13)+chr(10)
is the same as chr(27)+chr(80)+chr(17)+"3"+chr(10)
|
|
|