SECTION 3
Supporting Windows Applications
3-34 PEN*KEY
R
6200/6300 Hand-Held Computer Programmer’s Reference Guide
"
Forward.
Advances the paper a certain number of lines. Use this option
with caution because Windows is not aware of the paper movement. (See
the
Special Paper Handling
paragraph.) Set the following:
"
wOpt
to
PRT_FORWARD(0x0030)
"
lParam1
to the number of lines to advance
"
lParam2
to 0
"
Rewind.
Rewinds the paper back into the printer a certain number of lines.
Use this option with caution because Windows is not aware of the paper
movement. It may also cause a head jam. (See the
Special Paper Handling
paragraph on the next page.) Set the following:
"
wOpt
to
PRT_REVERSE(0x0040)
"
lParam1
to the number of lines to advance
"
lParam2
to 0
Special Paper Handling
The PrtService API supports two paperĆhandling options to be used with care:
PRT_FORWARD and PRT_REVERSE. They allow reports to be voided" after
they are printed and inspected. Windows maintains an internal value that
knows" where the current page is relative to the top of form and end of form. If
you use these options, Windows can get confused.
The printer also knows where it is on the page (every 11 inches is a new page);
and it may not match the actual paper, if the topĆofĆform button is used
incorrectly. Windows always does a form feed at the end of a page to advance the
paper to the top of the next page. These options are typically used around the
printers topĆofĆform marker, which confuses things even more. Different sizes of
paper behave differently and may jam the printer.
The following describes a scenario that works in most cases. Other options need
to be done on a trialĆandĆerror basis:
1. Generate your entire page (may be only half of the page) and call
EndPage(...)
.
EndPage(...)
flushes everything printed to the printer and
performs a form feed. This puts you at the top of the next page.
2. Call
StartPage(...)
to reset the Windows device context to do more
output.
3. Use PRT_FORWARD to advance the paper far enough so that the user can
determine whether the page is correct. Use a small number of lines, if you
can, especially if you are using multipart forms. If possible, do not advance
at all. This may be possible if you have not printed on the bottom inch of
the page or if the information is not critical. In any case, use
PRT_REVERSE to rewind the paper exactly the same number of lines (see
step 6).
4. Have your application ask the user to determine whether the page is
correct.
5. Use PRT_REVERSE to rewind the paper back into the printer the same
number of lines that you used in step 3. This takes you to the top of the
form. Skip this step if step 3 did not move the paper.
6. Use PRT_REVERSE to rewind the paper back into the printer far enough
to get to the spot at which you want to print your validation information.
Make sure that you rewind past the topĆofĆform marker so that the
EndPage(...)
in step 7 goes to the top of the next page. If not,
EndPage(...)
skips an entire page. To print on the last line of the page,
use the value of 2, assuming
TextOut(...)
starts at 0 for the Y value.
3. Windows
Applications