Question about html printing

2 posts, 0 answers
  1. Kjell
    Kjell avatar
    283 posts
    Member since:
    Jun 2010

    Posted 02 Aug 2012 Link to this post

    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?

  2. Iva Toteva
    Iva Toteva avatar
    1319 posts

    Posted 03 Aug 2012 Link to this post

    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 to open the window that contains the print preview. As you may know, the way the 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.

Back to Top