How to set up printing of web reports in the web app?

I have created a text/html report. How can I set up printing of standalone report instead of the whole application? When pressing Ctrl+P the whole front-end gets printed.

@koki can you share your solution?

We had a different issue with printing from ASAP web application. We wanted to print report (created in crystal reports) directly, when user clicks on action button. So we created a Sequential workflow with task ServiceMethodCallTask -> service ReportService -> method PrintReport. This task has several parameters. One issue was with the Printername parameter. There should be a link to a network printer queue like \ServerName\PrinterQueueName. You should specify permission for that queue for the user, who is running ASAP application pool in IIS. Second issue was with the printer driver - we found out, that it is not working with some printer drivers types. So you can gat a situation, that PCS driver is not working and PostScript driver is OK for given printer.
Hope, this can help you.

1 Like

Thank you. But I need print HTML report. I´ve heard, that you solve printing from html too?

We are using Crystal Reports for printing reports, but I think you can do it with html reports the same way. You choose only different report in the workflow task parameter.

@koki What about the print JavaScript snippet in an HTML report?

@tvavrda Maybe bad idea: can I open the report in a new browser window - something like target = “_blank”?

@Kit4it Opening a report in a separate browser tab is also possible – you need to set the report’s property OpenMethod = LaunchBrowserWindow.

As for printing from the HTML report you can add the following snippet to your XSLT > HTML template:

<html>
  <script type="text/javascript">
    function printpage() {
    		var printButton = document.getElementById("printbutton");
        	printButton.style.visibility = 'hidden';
        	window.print()
        	printButton.style.visibility = 'visible';
    }
  </script>
  <body>
	<form>
		<input id="printbutton" type="button" value="Tisk"
		   onclick="printpage();return false;" />
	</form>
        ... here goes your report ...
  </body>
2 Likes

Thans to all, I have chosen JS for this time and it does work.