Print button in Firefox starts PDF download

Thread is closed for posting
4 posts, 0 answers
  1. Volker
    Volker avatar
    3 posts
    Member since:
    Dec 2008

    Posted 26 Jun 2013 Link to this post

    Hello,

    I just updated a project to the new Q2 2013 release including the report viewer for ASP.NET. When I click the print button in Firefox (version 22), it starts a download of the PDF instead of displaying the print dialogue (no matter whether acrobat plugin or firefox PDF viewer is configured). In IE and Chrome everything works as expected. I have the same behavior when using the online demos of Telerik.

    Is direct printing in Firefox not supported anymore?
  2. Peter
    Admin
    Peter avatar
    1611 posts

    Posted 26 Jun 2013 Link to this post

    Hello Volker,

    In Firefox 19+ the default viewing option for PDF files is the PDF.js. However currently PDF.js is not supported and Firefox don't expose the content type viewing preferences. Thus the Adobe PDF plug-in is always active whether or not it is the preferred viewing option.

    Having the above in mind for Firefox 19+ we have decided to fallback the print operation to export operation and let the users to print the PDF document with the available at their disposal PDF viewing tools. Currently this is the only way we can guarantee an appropriate action for the PDF print operation. Still we are looking for a better solution and once we have one we will elaborate in the release notes.

    Update:
    Currently the PDF.js in Firefox 23 supports print but this functionality is still very unstable. However if you want to use the PDF.js for print or you want to alert the users in any way you can use the following JavaScript to override the Firefox plugin verification:

    <telerik:ReportViewer ID="ReportViewer1" runat="server"/>
        <script type="text/javascript">
            FireFoxHelper.prototype.PDFPluginPrintEnabled = function () {
                alert("Firefox");
                var pdfPlugins = navigator.mimeTypes["application/pdf"];
                var pdfPlugin = pdfPlugins != null ? pdfPlugins.enabledPlugin : null;
                var isEnabled = false;
                if (pdfPlugin)
                {
                    var description = pdfPlugin.description;
     
                    isEnabled = (description.indexOf("Adobe") != -1 &&
                                (description.indexOf("Version") == -1 || parseFloat(description.split("Version")[1]) >= 6));
                }
             
                return isEnabled;
            }
         </script>

    Update:
    Firefox have logged bug for exposing the PDF.js as plugin. Thus once they resolve this bug we will be able to detect the actual plugin in use and handle the print operation accordingly.

    Regards,
    Peter
    Telerik

    Have you tried the new visualization options in Telerik Reporting Q1 2013? You can get them from your account.

  3. DevCraft banner
  4. Jonah
    Jonah avatar
    29 posts
    Member since:
    Oct 2012

    Posted 02 Dec 2013 Link to this post

    I just started having this same issue with IE11. I am not sure when the issue started since I don't look at it every day but a customer noticed it this morning.
  5. Peter
    Admin
    Peter avatar
    1611 posts

    Posted 03 Dec 2013 Link to this post

    Hi Jonah,

    The reason for the issue is the new behavior of the browser described in details in the Compatibility changes in IE11 MSDN article. Currently IE11 represent itself by default with navigator.userAgent property value Mozilla/5.0. Generally we read this property to handle per browser the pdf plugin checks and print operation. Thus this new and unexpected IE 11 behavior causes the report viewer to misrecognize the client browser that results in incorrect PDF plugin resolution and the fallback to the export operation. 

    This issue is already fixed and we will introduce a fix with Q3 2013 SP1. This release is scheduled for the end of week.

    In the meantime you can override the browser detection as shown in the following example: 
    <telerik:ReportViewer ID="ReportViewer1" runat="server"/>
            <script type="text/javascript">
                GetBrowserHelper = function() {
                    if (window.navigator) {
                        var userAgent = window.navigator.userAgent.toLowerCase();
                        if (userAgent.indexOf("msie") > -1
                            || (userAgent.indexOf("mozilla") > -1 && userAgent.indexOf("trident") > -1))
                            return new IEBrowserHelper();
                        else if (userAgent.indexOf("firefox") > -1)
                            return new FireFoxHelper();
                        else if (userAgent.indexOf("chrome") > -1)
                            return new ChromeHelper();
                        else
                            return new OtherBrowsersHelper();
                    }
                    return null;
                }
            </script>

    Regards,
    Peter
    Telerik

    New HTML5/JS REPORT VIEWER with MOBILE AND TOUCH SUPPORT available in Telerik Reporting Q3 2013! Get the new Reporting version from your account or download a trial.

Back to Top