The RTF Printer Driver is the driver associated with the LP device in the default
configuration.
This driver isn't a real driver since it does not deal with a printer but rather passes a Rich Text
Formatted file to WORDPAD.EXE and WORDPAD.EXE prints the file. The sequence is as follows:
|  OPEN(X)"LP"  |
A temp file called temprtf.rtf is created (unless LTF <> "" see LISTFILE below).
Wordpad's current margins are saved. An RTF header is placed in the file.
|  PRINT(X)DATA$,  |
The string DATA$ is placed in the temp file.
|  PRINT(X)'XX',  |
The XX Mnemonic is processed and the
required RTF commands and placed in the temp file.
|  CLOSE(X)  |
An RTF trailer is added to the file. The temp file is closed. Wordpad's margins are set based on the 'MARGINS'
mnemonic. Wordpad is then executed with a command simalar to:
WORDPAD.EXE /P temprtf.rtf
If 'PT'(P$) [the PRINT TO mnemonic] had been used instead Wordpad is
then executed with a command simalar to:
WORDPAD.EXE /PT temprtf.rtf + P$
SM32 waits for WORDPAD.EXE to close.
The temp file is deleted
| | | |
Paragraph - 'LF': The RTF driver uses $0A$ and 'LF' as an end of paragraph RTF command which causes a
line feed as the programmer would expect. However if you end your PRINT's with a comma WORDPAD
will fit your printed data within the page margins.
Special Conditions/Mnemonics
The fin function returns 2 $00$ terminated strings. The 1st string is the RTF header. This
string is usefull in that it contains all the valid font facenames (see $__GETFONTS).
The 2nd string
is the full path of WORDPAD.EXE. If this contains WRITE.EXE instead of the WORDPAD.EXE path SM32
was unabled to find the correct path. This path can be overridden by placing a pathname in the
Driver Info: line of the device configuration. The 2 strings can be broken out as follows:
OPEN(1)"LP";A$=FIN(1);PRINT(1)'ABORT',;CLOSE(1)
P=POS($00$=A$);W$=A$(P+1);W$=W$(1,LEN(W$)-1);H$=A$(1,P-1)
The LTF variable only applies the device named LP. For the RTF driver if the LTF system
variable is <> "" then WORDPAD.EXE is not executed at CLOSE time. The printed
information is simply stored in the file specified by LTF. Note that this file is emptied
at OPEN time. Example:
LISTFILE "MYLISTING.RTF"
LOAD "MYPROG"
OPEN (1)"LP"
LIST(1)
STOP
Use this mnemonic to prevent WORDPAD from being executed. This can be usefull while debugging.
If a program goes to console mode, a:
PRINT(X)'ABORT',
STOP
will prevent the print that would normally occur with the STOP (closing channel X). Also see
$__GETFONTS program that just wants to do a FIN and not print anything.
In stead of printing the temp file to the default printer at close time another printer
is selected.
LOAD "MYPROG"
OPEN (1)"LP"
PRINT(1)'PT'("HP DESKJET 920C"),
LIST(1)
STOP
In stead of printing the temp file at close time, the temp file is simply OPENED in WORDPAD.
A command similar to:
WORDPAD.EXE temprtf.rtf
is executed.
Note that SM32 will hang until the user closes WORDPAD and the temp file is then deleted.
This option gives the user a chance to use any of WORDPAD features. (one would be to change the
paper to Landscape an option not available from SM32)
Example:
LOAD "MYPROG"
OPEN (1)"LP"
PRINT(1)'PV',
LIST(1)
STOP
Regular Mnemonics
Single @ position is not always accurate with this driver as it may not always know the current
position.
It uses a space character to move the to right and does NOT attempt to move left.
Once the 'EG' is output no ERROR 29's will be generated for invalid MNEMONICS.
The 'BG' restores the generation of ERROR 29's
Next Character is printed in aqua.
Next Character is printed in black.
Next Character is printed in blue.
RTF commands use:
\,{ and }
as special characters. If they occur in the printing data they
are escaped to:
\\,\{ and \}
So if the programmer wants to pass in some RTF commands he must set output transparency.
The following example uses the RTF Superscript command:
10 BEGIN
20 OPEN (1)"LP"
30 PRINT (1)'PV','fs'(18),
40 PRINT (1)"W=X",;CALL SUPER,"2"
50 PRINT (1)" + Y",;CALL SUPER,"3"
60 STOP
70 SUPER: ENTER A$
80 PRINT (1)'BO',"\up14 "+A$+"\up0 ",'EO',
90 EXIT
Turns ON/OFF underlining.
Centers the current paragraph.
Set the font size to 8
NOTE:
Same as 'FS'(8)
Set the font size to 16
NOTE:
Same as 'FS'(16)
Sets the font size:
'FS'(P) - where P is the font size in Points.
Example: PRINT (7)'FS'(24),
Next Character is printed in fushia.
Next Character is printed in gray.
Next Character is printed in Green.
Start or End Italics printing.
Left aligns the current paragraph.
Ends a paragraph.
Next Character is printed in lime.
Set the WORDPAD page margins. The nmemonic requires 4 numeric arguments:
Left,Right,Top and Bottom margin
Example:
OPEN (1)"LP"
PRINT(1)'PV',
PRINT(1)'MARGINS'(.5,.5,.5,.5),
PRINT(1)"Testing Set Margins"
STOP
Next Character is printed in maroon.
Next Character is printed in navy.
Next Character is printed in olive.
Next Character is printed in purple.
Next Character is printed in Red.
Right aligns the current paragraph.
'BB' or 'SF' cause following characters to print in bold.
'EB' or 'SB' cause following characters to print in normal.
Next Character is printed in silver.
Set the font size to 10
NOTE:
Same as 'FS'(10)
Next Character is printed in teal.
Next Character is printed in yellow.