- include printer.e (part of this package)
- create a sequence to store the page header, e.g: header
-
- create a sequence to store the document details, e.g: doc
- create an object to accept some returned values, e.g: result
- initialize the global printErr (from printer.e) to FALSE
- call the printer dialog as follows:
result = getPrinter()
if length(result) = 0 then -- print was cancelled
-- so bail out of your routine here
end if
- optionally, set your font
setFont(Printer,"Courier New",9,0)
- built the header for this report:
header = {}
header = append(header," ") -- good to start with a blank line
header = append(header,"Title of this report -- blah, blah, blah")
-- add as many lines here as you want, (date printed, etc)
header = append(header," ") -- another blank line
- fill in your document detail lines:
doc = {}
for i = 1 to length(items) do
doc = append(doc, sprintf("........."))
end for
- start the print job:
printDoc(header, doc, "Job title") -- job title shows in print spooler dialog
- check to see if job was successful (maybe cancelled?)
if printErr = TRUE then
result = message_box("Print job not complete",
"ERROR", MB_ICONHAND + MB_TASKMODAL)
end if