RadHTMLPlaceHolder Print Problems

3 posts, 0 answers
  1. Mike
    Mike avatar
    8 posts
    Member since:
    Feb 2011

    Posted 12 Jun 2012 Link to this post

    Because of printing problems/limitations in Silverlight we are using RadHTMLPlaceHolder to display and print content that may be printed in our application.  Each page that may be printed has a Print button that makes a javascript call to window.print.

    This working ok and everything looks good on the screen but when it is printed from the RadHTMLPlaceHolder control the font size in the printed document seems to scale down to a much smaller size than if you printed the same HTML from IE.  The size seems to vary randomly for the same HTML page depending on where it is printed from.

    Is there a way to correct this so that is scales correctly to the printer?

    Mike
  2. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 15 Jun 2012 Link to this post

    Hello Mike,

    When using the RadHtmlPlaceholder to display external pages, you need to keep in mind that the control basically creates an IFrame and displays it on top of the Silverlight plug-in. So in your case, if I understand your logic correctly, you're printing the content of the IFrame. However, it seems that the font-size issue is known when printing IFrame content - you can find more info here and here.

    Let me know if that info helps or if we can assist you further.

    All the best,
    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
  4. Mike
    Mike avatar
    8 posts
    Member since:
    Feb 2011

    Posted 15 Jun 2012 Link to this post

    I already had a print style sheet and this wasn't the issue.  You did turn me on to fact that the problem that it was with printing from an iFrame in Internet Explorer.  I researched it and found and implemented the following javascript function to print my pages and this fixed it.  If the browser isn't IE the first print will fail and the Catch will call window.print which should work fine for all other web browsers.

    Thanks, Mike

     

    function printMe() {
        try {
             document.execCommand('print', false, null);
            }
       catch(e) {
             window.print();
            }
     }
Back to Top