Output to a printer (PHP)

Set up and configure output to a printer from your reporting application.

  • Send output directly to the printer - To send the output to a printer without previewing, call the selectDevice() function as part of your report configuration function with the parameter "Printer":
    $greRunnerObj->selectDevice('Printer')
  • Set page margins - The logical margins of the report page are read from the 4rp file (report design document). To override those margins, call the setPageMargins() function:

    $greRunnerObj->setPageMargins(
        '.05cm',#  topMargin String,
        '.05cm',#  bottomMargin String,
        '.05cm',#  leftMargin String,
        '.05cm' #  rightMargin String
    );
  • Set print quality - To control the quality of the printed report, call the setPrinterPrintQuality() function. By default this is not set. Setting this option reduces the set of usable printers to those matching it.
    One of these values is passed to the function as a parameter: draft|high|normal. The value is passed as a String, for example:
    $greRunnerObj->setPrinterPrintQuality('high');
  • Print double-sided - To specify whether the report pages should be printed on one or both sides of the page, call the setPrinterSides() function. By default this is not set. Setting this option reduces the set of usable printers to those matching it.

    One of these values are passed to the function as a parameter. The value is passed as a String:

    • one-sided: Each consecutive print-stream page is printed on the same side of consecutive media sheets.
    • two-sided-short-edge: Consecutive pairs of print stream pages are printed on the front and back sides of consecutive media sheets. The orientation of the pages is correct as if the pages were to be bound along the short edge of the paper.
    • two-sided-long-edge: Consecutive pairs of print stream pages are printed on the front and back sides of consecutive media sheets. The orientation of the pages is correct as if the pages were to be bound along the long edge of the paper.
    $greRunnerObj->setPrinterSides('two-sided-long-edge');
  • Select a paper tray - To control which paper tray is used, call the setPrinterMediaTray() function.

    One of these String values is passed to the function as a parameter: bottom|envelope|large-capacity|main|manual|middle|side|top.

    $greRunnerObj->setPrinterMediaTray('top');
  • Identify the printer and paper source - To determine where your report is printed, call the setSVGPrinterName() and setSVGPaperSource() functions:
    $greRunnerObj->setSVGPrinterName('Balzac');
    $greRunnerObj->setSVGPaperSource('Tray 2');
  • Silently print the report (optional) - To bypass the preview and print silently on the named printer, call the configureSVGPreview('PrintOnNamedPrinter') function:
    $greRunnerObj->configureSVGPreview('PrintOnNamedPrinter');

For the full list of properties and methods, refer to the Genero Report Writer PHP API documentation.