Skip to main content
Version: 8.1

Vision - Report Viewer Scripting Functions

This page details the various component and extension functions available for Vision's Report Viewer component.

Component Functions​

.print(printerName, showDialog)​

note

The following print method will only work if a report has finished loading on the Report Viewer component.

  • Description

    • Uses the named printer and determine if the print dialog window should appear or not.
  • Parameters

    • String printerName - The name of the printer the report should be sent to. Will use the default printer if left blank. [optional]

    • Boolean showDialog - True if the dialog window should appear, False if the dialog window should be skipped. Will be true if left blank. [optional]

  • Return

    • None
print()
#calls print on a Report Viewer component located in the same window

reportViewer = event.source.parent.getComponent('Report Viewer')
reportViewer.print()
print() with default printer, no dialog
#calls print on a Report Viewer component located in the same window
#bypasses the print dialog window and uses the default printer

reportViewer = event.source.parent.getComponent('Report Viewer')
reportViewer.print(None, False)

getBytesPDF()​

  • Description

    • Return the bytes of the generated report in the Report Viewer using PDF format.
  • Parameters

    • None
  • Return

    • Byte Array - The bytes of the report in PDF format.

getBytesPNG()​

  • Description

    • Return the bytes of the generated report in the Report Viewer using PNG format.
  • Parameters

    • None
  • Return

    • Byte Array - The bytes of the report in PNG format.

saveAsPDF(fileName)​

  • Description

    • Prompts the user to save a copy of the report as a PDF. Shows a file selection window with the extension set to PDF.
  • Parameters

    • String fileName - A suggested filename to save the report as
  • Return

    • None

saveAsPDF() Example​

Code Snippet - saveAsPDF()
#Saves the file as a PDF to a user selected location.
#The file selection window defaults to a name of "Daily Report"

reportViewer = event.source.parent.getComponent('Report Viewer')
reportViewer.saveAsPDF("Daily Report")

saveAsXls(fileName)​

  • Description

    • Prompts the user to save a copy of the report as an XLS file. Shows a file selection window with the extension set to XLS.
  • Keyword Args

    • String fileName - A suggested filename to save the report as.
  • Return

    • None

Extension Functions​

onReportGenerated​

  • Description

    • Called when the Report generation process has been completed.
  • Keyword Args

    • Component self - A reference to the component invoking this method.

    • Byte Array pdfBytes - The PDF formatted bytes generated by the Report.

  • Return

    • None