Print from RadWindow Titlebar IE11

6 posts, 1 answers
  1. Glenn
    Glenn avatar
    47 posts
    Member since:
    Nov 2011

    Posted 24 Aug 2014 Link to this post

    Had the following example working fine to print contents of a Radwindow from the title bar:  http://www.telerik.com/support/kb/aspnet-ajax/window/details/adding-a-custom-button-to-radwindow-titlebar

    However now using IE11 it prints the entire page behind the window as well.
    In Firefox works fine and only prints the contents of the Radwindow.

    Would appreciate and any.

    Thanks

    Glenn
  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3858 posts

    Posted 26 Aug 2014 Link to this post

    Hello  Glenn,

    What is important is that the correct context is used when the print() command is executed. The browser detemines this and prints that page. The sample shows how to get the RadWindow iframe's object and this article expands on the matter of calling functions in the different contexts: http://www.telerik.com/help/aspnet-ajax/window-programming-calling-functions.html.

    You may also find useful the examples from this KB article as well because it treats printing in more detail: http://www.telerik.com/support/kb/aspnet-ajax/window/details/printing-the-contents-of-a-radwindow. What is important is that we do not and cannot control the way the browser interprets this command and the best advice I can provide is to test out this KB too and to see how your IE behaves with a simple iframe instead of a RadWindow.


    Regards,

    Marin Bratanov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. Glenn
    Glenn avatar
    47 posts
    Member since:
    Nov 2011

    Posted 27 Aug 2014 in reply to Marin Bratanov Link to this post

    Seems it's an IE11 problem as per this:
    if(document.all)
     {
         //IE 6/7/8/9/10 will run this
     }
     else
     {
         //chrome, firefox, IE11 will run that
     }

    FROM: http://www.julien-manici.com/blog/important-compatibility-changes-in-IE11-on-Windows-8-1/

    Seems working now on IE11 and Firefox by changing to:
    function CheckIsIE11() {
           if (Object.hasOwnProperty.call(window, "ActiveXObject") && !window.ActiveXObject) {
               // is IE11
               alert("true");
               return true;
           }
           alert('false');
           return false;
       }
     
       function printWin(e) {
           var oManager = GetRadWindowManager();
           var oWnd = oManager.GetWindowByName("RadWindowPreview");
           var content = oWnd.GetContentFrame().contentWindow;
           var printDocument = content.document;
           if (document.all || CheckIsIE11()) {
               alert('ie');
               printDocument.execCommand("Print");
           }
           else {
               alert('other');
               content.print();
           }
           //Cancel event! 
           if (!e) e = window.event;
           return $telerik.cancelRawEvent(e);
       }

    Can you see any issue using this change?

    Thanks

  4. Answer
    Marin Bratanov
    Admin
    Marin Bratanov avatar
    3858 posts

    Posted 29 Aug 2014 Link to this post

    Hello Glenn,

    As long as the browser detection you have in place work for your needs, I do not see issues with the approach.


    Regards,

    Marin Bratanov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  5. Matt
    Matt avatar
    33 posts
    Member since:
    May 2013

    Posted 07 Nov 2014 in reply to Glenn Link to this post

    I wish I could have found this post easier.  Please link it to the KB article about adding a print button to a RadWindow.

    Thanks!
  6. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3858 posts

    Posted 10 Nov 2014 Link to this post

    Hi Matt,

    Here is the KB: http://www.telerik.com/support/kb/aspnet-ajax/window/details/adding-a-custom-button-to-radwindow-titlebar. You can use that button to call the functions that will print the needed contents: http://www.telerik.com/support/kb/aspnet-ajax/window/details/printing-the-contents-of-a-radwindow.


    Regards,

    Marin Bratanov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top