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

Question about html printing

1 Answer 45 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Kjell
Top achievements
Rank 1
Kjell asked on 02 Aug 2012, 05:19 AM

I am printing the contents of my richtextbox via the following line

txtDesc.Print("SmartTime Report", Telerik.Windows.Documents.UI.PrintMode.Html);

:

I get the contents of the box in a new window and then the print dialog.  I've been asked if that new window which pops up briefily can be in an IE tab instead, is that possible?


1 Answer, 1 is accepted

Sort by
0
Iva Toteva
Telerik team
answered on 03 Aug 2012, 02:52 PM
Hi Kjell,

Let me first briefly explain how HTML printing works.

When you trigger the command, the document is exported to HTML and is printed using the Print functionality of the browser. This is done by creating a javascript and passing it to HtmlPage.Window.Eval method.

The javascript function uses window.open to open the window that contains the print preview. As you may know, the way the window.open method works is to open a new tab or window depending on the user preferences in the browser. Therefore, if the user has specified that pop-ups should be opened in a new tab, the preview will be opened in a new tab. Otherwise (if the choice is left to the browser or a new window is specified), IE will open a new window. A quick search of the way the open method works will show you that there is no reliable method to override the user's preferences and it is not considered a good practice.

You can test how setting the way webpages are displayed changes the way HTML printing works. In order to do that, apply the following setting in your browser:
Internet Options -> General
In the "Tabs" section choose "Settings" -> "When a pop-up is encountered: Always open pop-ups in a new tab".

I hope this answers your question.

All the best,
Iva Toteva
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
RichTextBox
Asked by
Kjell
Top achievements
Rank 1
Answers by
Iva Toteva
Telerik team
Share this question
or