Bug Report T814122
Visible to All Users

ASPxDocumentViewer - Print Report button does not work after Google Chrome Update 76.0.3809.132

created 6 years ago

Hi team,

After the Google Chrome update 76.0.3809.132 of September 10th, the Print Report button of every of our Web Sites are no longer working.

The workaround we have found is to export the report to PDF then print the PDF file afterward.

Are you aware of this issue and would it be possible to be fixed? Is this change of Google Chrome will prevent this functionality for ever working again?

Regards.

Show previous comments (15)
DevExpress Support Team 5 years ago

    Hello Joe,

    Would you please share your web page markup where the Document Viewer is located? This will make the situation clearer.

    Thanks,
    Elliot

      I just upgraded from 14.2.13 to 18.1.12. That did not fix it.
      I've tried replacing ReportViewer with ASPxWebDocumentViewer
      I now get an error on this this.ReportViewer1.Report= myReport;

      C#
      <%-- <dx:ReportViewer ID="ReportViewer1" runat="server"> </dx:ReportViewer>--%> <dx:ASPxWebDocumentViewer ID="ReportViewer1" runat="server"></dx:ASPxWebDocumentViewer>

      I have over 75 reports where the print button no longer prints in Chrome.

      Vasily (DevExpress Support) 5 years ago

        Hi Joe,

        It looks like we are already discussing this issue in the Unknown server tag 'dx:ASPxDocumentViewer' in version 18.1.8.0 thread, that you raised earlier. So, to avoid discussing the same issue in multiple threads, let's continue our conversation in that thread. We greatly appreciate your understanding,

        Answers approved by DevExpress Support

        created 6 years ago (modified 5 years ago)

        We have fixed the issue described in this ticket and will include the fix in our next maintenance update. To apply this solution before the official update, request a hotfix by clicking the corresponding link for product versions you require.

        Note: Hotfixes may be unavailable for beta versions and updates that are about to be released.

        Additional information:

        Printing functionality stopped working in the Chrome browser of version 76+

          Show previous comments (5)
          DevExpress Support Team 5 years ago

            Hello,

            I've created a separate ticket on your behalf (T820506: A java script error when printing a report from the ASPxDocumentViewer control in Chrome v77). It has been placed in our processing queue and will be answered shortly.

              Hi, Can you create a fix for 19.1.5 version (We need a fix for production server without going to 19.1.6 version) ?

              Yaroslav (DevExpress Support) 5 years ago

                @Artem
                Here, at DevExpress, we follow the continuous integration model. A new build gets released and its version number is incremented. A hotfix is just an intermediate build that we provide for those who don't like waiting for the next official release that will incorporate all necessary changes (that would be version 19.1.7). The current hotfix version is 19.1.6.19280. This is the version you need to update. If you can't update, consider using the workaround provided below.

                created 6 years ago (modified 5 years ago)

                To whom it may concern:
                If you're still an old version of our components (any version up to v15.1) and updating is not possible/desired, consider using the following workaround:
                ASP.NET WebForms

                ASPx
                <dx:ASPxDocumentViewer ID="ASPxDocumentViewer1" runat="server" Height="763px" ReportTypeName="XtraReport1"> <ClientSideEvents Init="init" /> </dx:ASPxDocumentViewer>

                ASP.NET MVC

                Razor
                @model XtraReport @Html.DevExpress().DocumentViewer(settings => { settings.Name = "documentViewer"; settings.Report = Model; settings.CallbackRouteValues = new { Controller = "Home", Action = "DocumentViewerPartial" }; settings.ExportRouteValues = new { Controller = "Home", Action = "DocumentViewerExport" }; settings.ClientSideEvents.Init = "init"; }).GetHtml()

                where the Init function is declared as follows:

                ASPx
                <script type="text/javascript"> function init(s) { var createFrameElement = s.viewer.printHelper.createFrameElement; s.viewer.printHelper.createFrameElement = function (name) { var frameElement = createFrameElement.call(this, name); if(ASPx.Browser.Chrome) { frameElement.addEventListener("load", function (e) { if (frameElement.contentDocument && frameElement.contentDocument.contentType !== "text/html") frameElement.contentWindow.print(); }); } return frameElement; } } </script>

                If you're using the old ReportViewer (with or without ReportToolbar), change the handler as follows:

                ASPx
                <dx:ReportViewer ID="RepViewer" runat="server" PageByPage="True"> <ClientSideEvents PageLoad="init"/> </dx:ReportViewer> <script type="text/javascript"> function init(s) { var isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor); var createFrameElement = s.printHelper.createFrameElement; s.printHelper.createFrameElement = function (name) { var frameElement = createFrameElement.call(this, name); if(isChrome) { frameElement.addEventListener("load", function (e) { if (frameElement.contentDocument.contentType !== "text/html") frameElement.contentWindow.print(); }); } return frameElement; } } </script>

                Please try it out and let us know your results.

                  Show previous comments (48)
                  Yaroslav (DevExpress Support) 4 years ago

                    Hi Thameemul,

                    I attached a web reporting project v19.1. It uses the same script and works well on my side in the latest Google Chrome build. Could you please try the same and share your results with us? If my demo works, please modify it to reproduce the issue.

                    Regards,
                    Yaroslav

                    TA TA
                    Thameemul Anzari 4 years ago

                      Hi Yaroslav,

                      Actually I am using the devexpress version 19.1.6. But 19.1.7 is used in the demo you have provided. I have attached a sample reporting project which is using devx version 19.1.6 and the report printing is not working even after I have added the init script. Can you please confirm the script fix would work with the version 19.1.6?

                      Here is the chrome settings which is causing the issue.
                      chrome settings.png

                      Thanks

                      Thameem

                      Yaroslav (DevExpress Support) 4 years ago

                        My apologies for getting the version wrong. I confirm that your project works with the workaround in v19.1.6. But the option you mentioned does make a difference. If we were to print a web page, that wouldn't be a reliable document representation as each browser renders HTML elements differently. Thus, we export a report to PDF and print it instead. When the option is enabled, however, it breaks the printing of an invisible iframe. Unfortunately, I don't see a way to disable this option for end-users programmatically. May I know why you enabled it? It should be disabled by default. If you can't revert the default value for any reason, I can offer two alternatives:

                        1. Replace ASPxDocumentViewer with ASPxWebDocumentViewer. This new viewer will open the printed report copy in a new tab and it will be then downloaded to the tray. Of course, there'll be no actual printing within the browser.
                        2. Stick with the old viewer by hiding the print bar items. Instruct the end-user to export a report to PDF and print it manually (e.g., with the help of Adobe Reader or Chrome's built-in PDF viewer).

                        Let me know what you think.

                        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

                        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.