Printing
from Satellite Forms
PalmPrint comes with a Satellite Forms extension ("SFX") which
allows you to print using PalmPrint from a Satellite Forms application.
The associated "PRC" file is called SFE_PPrint.prc.
Download the Satellite Forms Extension for PalmPrint:
ZIP file
(Windows), 23K
The PalmPrint plug-in for Satellite Forms has the following methods (incidentally,
all of this information is found in the file SFE_PPrint.INF which is part
of the download):
PPrint(String) - Prints a block of text (as many characters
or lines as you like). Using this method, you simply assemble a long string
(containing embedded "newlines" and anything else), and then
make a SINGLE call to PalmPrint to cause the printing.
Here is a simple example of a script which would use this function:
dim s
s="This is an example of printing from your Palm." & chr(10)
& chr(10)
s="To license your copy of PalmPrint, visit "
s=s & "www.stevenscreek.com or call 1-408-725-0424"
PPrint(s)
Often, when printing something like a receipt, it will be more convenient
to send material to PalmPrint one line (or perhaps a few lines) at a time,
rather than assemble the entire print job at once. To do this, you use
a series of functions shown below, starting with a "Start" command
and ending with an "End" command as shown. The following items
are all functions, which return a Boolean. Printing should ONLY continue
as long as the function returns a TRUE. Do not issue further printing
commands if a FALSE is returned.
PPrint_Start() - Initialize printer - USE ONLY FOR 'LINE
BY LINE' PRINTING
PPrint_End() - End printing - MUST BE MATCHED WITH PPrint_Start
PPrint_Line(String) - Prints one (or several) lines of
text
PPrint_Bold(Boolean) - Turn bold on (or off)
PPrint_SetFont(Integer) - Set font (0=Courier, 1=Times,
2=Helvetica) Note: Font MUST be Courier for tabular output. To change
font size, add 0 to these numbers to get 12-pt font, add 8 to get 10-pt
font, and add 16 to get 9-pt font. Thus PPrint_SetFont(9) will give 10
pt. Times font; PPrint_SetFont(18) will give 9 pt. Helvetica font. Note
that font commands will not work on all printers; many receipt printers
only have a single built-in font.
PPrint_GetCharsPerLine() - Return number of characters
in one line
PPrint_GetLinesPerPage() - Return number of lines per
page
Here is an example of a script which would produce line by line printing:
dim s,result,charsperline,linesperpage
result=PPrint_Start()
if Bool(result) then
charsperline=PPrint_GetCharsPerLine()
linesperpage=PPrint_GetLinesPerPage()
s="There are " & str(charsperline) & " chars/line
and "
s=s & str(linesperpage) & " lines/page"
result=PPrint_Line(s)
endif
if Bool(result) then
s="Line 1 is plain"
result=PPrint_Line(s)
endif
if Bool(result) then
result=PPrint_Bold(true)
endif
if Bool(result) then
s="Line 2 is bold"
result=PPrint_Line(s)
endif
if Bool(result) then
result=PPrint_Bold(false)
endif
if Bool(result) then
result=PPrint_SetFont(2)
endif
if Bool(result) then
s="Line 3 is plain and Helvetica"
result=PPrint_Line(s)
endif
if Bool(result) then result=PPrint_End()
Often you will be pulling information out of a table for printing; here's
an example of a script that does that:
Dim s
Dim CR
Dim f, ns, i
CR = chr(10)
s = "Name of company: " & Lookup_1 & CR & CR
s = s & "ITEM QTY" & CR
s = s & "============================== ===" & CR
Tables().MoveFirst
while Tables().RecordValid
f = Fields("ITEM")
ns = 30 - len(f)
s = s & f
for i = 1 to ns
s = s & " "
next
s = s & " "
f = Fields("QTY")
ns = 3 - len(f)
for i = 1 to ns
s = s & " "
next
s = s & f & CR
Tables().MoveNext
wend
PPrint(s)
Return to
the main PalmPrint Developers page
|