This is a migrated thread and some comments may be shown as answers.

Printing from Report Viewer - opens pdf

8 Answers 1334 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Tim
Top achievements
Rank 1
Tim asked on 25 Sep 2019, 06:49 PM

There seems to be a recent change in how printing from the report viewer works. The used to open the print dialog and you could print from there. Now when you click print on the report viewer the browser prompts you to save as pdf.

I've noticed this is happening on Telerik's demo page. 

Is it a browser setting? Is anyone else having this issue?

Thanks.

 

 

8 Answers, 1 is accepted

Sort by
0
James
Top achievements
Rank 1
answered on 25 Sep 2019, 08:06 PM

Yes we are having the same issue after updating to Chrome 77, except it doesn't save as PDF and instead we just get a quick message that it's preparing the document, and then nothing happens.

 

We took a machine with Chrome 76 installed, tested and verified that the functionality works correctly, then updated that same machine to Chrome 77, and the functionality was broken.  So Chrome 77 is definitely what broke it.

0
Jose
Top achievements
Rank 1
answered on 26 Sep 2019, 01:41 PM

Having similar issue, latest chrome version (77) when hitting the print button, nothing happens. But on an older chrome version (76), It prompts users to print the Report. 

Current Work around is just to have users export it out in PDF and then print from there.

But would like to see if there is a work around or fix coming soon.

 

Thank You.

0
Tim
Top achievements
Rank 1
answered on 26 Sep 2019, 02:49 PM
If Chrome isn't prompting you to save you need to turn "Download PDF files instead of automatically opening them in Chrome" ON in the setting dialog.
0
Silviya
Telerik team
answered on 27 Sep 2019, 07:55 AM

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
0
Okov
Top achievements
Rank 1
answered on 27 Sep 2019, 09:35 AM

Hi Silviya,

it works perfect (with print.js). Thanks.

0
Okov
Top achievements
Rank 1
answered on 27 Sep 2019, 11:00 AM

More simple solution from  "Print Dialog doesn't appear in Google Chrome 77.0.3865.75" thread

Just add:

frame.contentWindow.focus();
frame.contentWindow.print();

after document.body.appendChild(frame);

 

or 

t.contentWindow.focus();t.contentWindow.print(); after t.src=e;o.body.appendChild(t); in telerikReportViewer.min.js

0
Tim
Top achievements
Rank 1
answered on 30 Sep 2019, 10:56 PM

Thanks Silviya. Are you planning to provide a fix for the older WebForms viewer? I upgraded to R3 2019, but the WebForms viewer still has the problem.

Thanks.

 

0
Nasko
Telerik team
answered on 03 Oct 2019, 12:13 PM

Hi Tim,

 

The older WebForms viewer is no longer actively supported. However, you can still fix the Chrome print issue on your end by following the Workaround for the obsolete ASP.NET Web Forms Report Viewer.

 

Regards,
Nasko
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
Tags
General Discussions
Asked by
Tim
Top achievements
Rank 1
Answers by
James
Top achievements
Rank 1
Jose
Top achievements
Rank 1
Tim
Top achievements
Rank 1
Silviya
Telerik team
Okov
Top achievements
Rank 1
Nasko
Telerik team
Share this question
or