How to print

Hi,
I would like to print a form loaded within an NGClient.

I tried to (any of those solutions work):

  • to use ```
    “controller.print()”
- calling browser print by using ```
"plugins.WebClientUtils.executeClientSideJS('window.print();');"
  • to use pdf printer:
 var success = plugins.pdf_output.startMetaPrintJob()
	forms.showWebBrowser_ProjectsReportsDashboard.controller.print(false,true,plugins.pdf_output.getPDFPrinter())
	var pdfData = plugins.pdf_output.endMetaPrintJob()
	plugins.file.writeFile("filepdf.pdf", pdfData)

Thank you

Hi Marco,

printing Servoy forms is not possible anymore in NG client.
The WebClientUtils plugin you are trying to use is for the Wicket based web client, not for NG.

If you want to access the browser through Servoy, this can be done through a service web package.
But in order to get nicely styled prints/pdf’s you should consider switching to either JasperReports or VelocityReports.
Both plugins can be found on https://www.servoyforge.net

Hope this helps

Hi Marc,
thank you for your reply.

We are actually using the smart-client in which there is a JFXPanel that shows a Dashboard based on a report loaded within a JasperReportServer (please take a look to the attachment).
We are able to print the dashboard when we are on the Smart Client but we would move the solution on NGClient.

JasperServer has it’s own exporter but we disabled it’s toolbar.

I should be able to call a URL that generates a pdf of the report but I don’t know how to do that within the NGClient.
The URL is something like that: “http://localhost:9090/jasperserver-pro/flow.html/flowFile/report.pdf”.
Calling this URL within the same session I should be able to get a pdf ready to be print.

Thank you

Hi Marco,

in NGClient you can download ready-to-go webpackage components/services and servoy modules.
In developer you just right click on the webpackage node and select ‘download with web packagemanager’.

One of the ready-to-go webpackage components is a pdfViewer which uses PDF.js in the background.
You just drag and drop the component onto your form, specify the URL and off you go.

If you want to do more fancy stuff there’s a ton of other possibilities, which is relatively easy to achieve while building your own components and services.

Hope this helps so far.

Hi Marc,
thank you for this information.

I’ll start following your suggestion.

Best regards and thank you for your time.

Marco