Remote printing with LyciaWeb
LYCIA
There are two ways of a print job handling:
- on the application server side,
- on the client side.
Handle printing jobs on the application server side
In the following 4GL code example, the ‘report1’ outputs will be printed on the default printer on the application server side:
MAIN START REPORT report1 TO printer OUTPUT TO REPORT report1() FINISH REPORT report1 END MAIN REPORT report1() FORMAT ON EVERY ROW PRINT "Printed by default printer on Application Server side." END REPORT
For a printer to be accessible by the Lycia3 application server in the cloud, certain cloud print services/cloud-ready printers should be installed and configured.
Installation and configuration depend on the cloud services provider and are out of the scope of this article.
Handle printing jobs on the client side
It's also possible to generate a report on the application server and process its outputs (e.g. open in new tab, download and print) on the client side.
In the following example, the fgl_report_type() function and Report Viewer Config element of the Lycia Theme Designer are used to open report outputs in the new browser tab, download and print them on the client side via the corresponding menu command:
MAIN MENU COMMAND "NewTab" CALL fgl_report_type("newTab","newTab") START REPORT activity_report TO PIPE "newTab" OUTPUT TO REPORT activity_report () FINISH REPORT activity_report COMMAND "Download" CALL fgl_report_type("download","download") START REPORT activity_report TO PIPE "download" OUTPUT TO REPORT activity_report () FINISH REPORT activity_report COMMAND "Print" CALL fgl_report_type("print","print") START REPORT activity_report TO PIPE "print" OUTPUT TO REPORT activity_report () FINISH REPORT activity_report COMMAND "exit" EXIT MENU END MENU END MAIN REPORT activity_report() FORMAT ON EVERY ROW PRINT "Processed on the client side." END REPORT