Hi Tim, James and Jose,
This is an issue with the new version of Chrome (Chrome 77, pdf auto print dialog). We included a fix in our new R3 2019 release. The print button of the HTML5 Report Viewer now renders the report for print purposes and opens it in a new browser tab. The auto-print script is still embedded in the document, but Google Chrome will wait for user interaction in order to show its print dialog.
The possible workarounds with the current version are two:
1. This workaround was proposed by one of our users- check the post from Thanh in Print Dialog doesn't appear in Google Chrome 77.0.3865.75 thread. It allows you to trigger the print dialog on Print click. Our user Naumand updated it, so the same functionality is achieved in Firefox. Here are the required steps:
- Add a reference to the Print.js third-party library in the viewer's page (above the reference to the viewer's JavaScript file).
- Copy the telerikReportViewer-x.x.x.x.js file locally and refer it in the page from the local source. For example, if the viewer is copied to the folder "(base application folder)/ReportViewer" the references may look like:
<head>
...
<script src="https://printjs-4de6.kxcdn.com/print.min.js"></script>
<script src="/ReportViewer/telerikReportViewer-13.2.19.918.js"></script>
...
- Modify the code of the telerikReportViewer-x.x.x.x.js file - function printDesktop(src). Its original implementation is:
function printDesktop(src) {
window.open(src, "_blank");
}
Change it to:
trv.printManager = function () {
var iframe;
function printDesktop(src) {
if (window.navigator.userAgent.toLowerCase().indexOf("chrome") > -1) {
printJS({ printable: src, type: 'pdf', showModal: true });
} else {
if (!iframe) {
iframe = document.createElement("IFRAME");
iframe.style = "position:absolute; left: -10000px; top: -10000px;";
}
iframe.src = src;
document.body.appendChild(iframe);
}
}
2. Setting FORCE_PDF_FILE printMode enumeration for the HTML5-based Report Viewers. This way, the widget will always export the report document to a PDF file which then could be printed.
We are sorry for the inconvenience caused. Please test it and let us know how it goes.
Best
Regards,
Silviya
Progress Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items