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

RadHTMLPlaceHolder Print Problems

2 Answers 65 Views
HTMLPlaceHolder
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 12 Jun 2012, 08:19 PM
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 Answers, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 15 Jun 2012, 02:39 PM
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 >>

0
Mike
Top achievements
Rank 1
answered on 15 Jun 2012, 10:14 PM
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();
        }
 }
Tags
HTMLPlaceHolder
Asked by
Mike
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Mike
Top achievements
Rank 1
Share this question
or