September 6, 2001 - Popping Up the Print Dialog | WebReference

September 6, 2001 - Popping Up the Print Dialog

Yehuda Shiran September 6, 2001
Popping Up the Print Dialog
Tips: September 2001

Yehuda Shiran, Ph.D.
Doc JavaScript

When you want to display the print dialog window, simply call the TemplatePrinter's showPrintDialog() method. The following function parses the action request passed by the print template loader from Microsoft. Notice the call to showPrintDialog() when the action is "Prompt":

invocations = 0;
function CheckIfPrintRequested() {
  invocations++;
  if (invocations > 1) return;
  switch (dialogArguments.__IE_PrintType) {
    case "Prompt":
      if (printer.showPrintDialog()) PrintPrep();
      break;
    case "NoPrompt":
      PrintPrep();
      break;
    case "Preview":
    default:
      break;
  }
}
To learn more about print templates, read Column 89 (Print Templates, Part I) and Column 91 (Print Templates, Part II: TemplatePrinter.) Download the Microsoft print template loader.