PRINTERDIALOG

PRINTERDIALOG

Description

This command opens the standard Windows Common Printer Dialog. If the user chooses a printer and accepts, the next print job will go to this printer. Accepting a printer also sets the global variables PrinterName$, PrintCollate and PrintCopies to reflect what the user chose for the Printer Name, Collate and Copies. If no printer is accepted, then PrinterName$ is set to an empty string.

PrinterFont$

To set the font used when LPRINTing text use the PrinterFont$ variable. See also PrinterFont$

PrintCopies

If the printer driver can handle printing multiple copies, PrintCopies will be set to "1" and the program only needs to lprint the text one time. If the printer driver cannot handle multiple copy printing, then PrintCopies will contain the number of copies chosen by the user in the printerdialog, and the program must print these copies in a loop. An example follows.

Usage:

  'choose a file to print
  filedialog "Print a BAS file", "*.bas", fileToPrint$
  if fileToPrint$ <> "" then
    printerdialog
    print "PrinterName$ is ";PrinterName$
    print "PrintCopies is ";PrintCopies
    print "PrintCollate is ";PrintCollate
    print "PrinterFont$ is ";PrinterFont$
    if PrinterName$ <> "" then
      open fileToPrint$ for input as #readMe
      while not(eof(#readMe))
        line input #readMe, line$
        lprint line$
      wend
      close #readMe
      dump
    end if
  end if
  end

Multiple Copies:

  txt$ = "Some text to print."
  printerdialog
  for i = 1 to PrintCopies
    lprint txt$
    dump
  next i