Print window content

  1. #1

    Print window content

    Hello,everyone.

    I need to print the html contained within a window.

    I already researched some threads in the forum related, however i could not solve my problem with any of them.

    In this thread: http://forums.ext.net/showthread.php...indow-Contents I saw that a possible solution would be the following javascript code:

    <ext:Button runat="server" Text="Print" Icon="Printer">
          <Listeners>
                 <Click Handler="#{Window1}.getBody().print()" />
           </Listeners>
    </ext:Button>
    But this code give me the following javascript error: "in res://ieframe.dll/preview.js 0x80070057 - javascript runtime error"

    i am use IE11...

    This is my full example code:

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="PrintDemo.WebForm1" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <!DOCTYPE html>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>TestPrint</title>    
    </head>
    <body>
        <form id="form1" runat="server">
            <ext:ResourceManager ID="ResourceManager1" runat="server" />        
            <ext:Window ID="Window1" runat="server" Title="Window" Width="400" Height="400">
                <AutoLoad Url="print.aspx" Mode="IFrame" >
                    <Params>
                        <ext:Parameter Name="id" Value="11" Mode="Value" />
                    </Params>
                </AutoLoad>
                <BottomBar>
                    <ext:Toolbar ID="Toolbar1" runat="server">
                        <Items>
                            <ext:Button ID="Button1" runat="server" Text="Print" Icon="Printer">
                                <Listeners>
                                    <Click Handler="#{Window1}.getBody().print();" />
                                </Listeners>
                            </ext:Button>
                        </Items>
                    </ext:Toolbar>
                </BottomBar>
            </ext:Window>
        </form>
    </body>
    </html>
    Thanks.
    Attached Thumbnails Click image for larger version. 

Name:	MyCatch.jpg 
Views:	21 
Size:	56.7 KB 
ID:	10831  
  2. #2
    Hi @lxp1116,

    Welcome to the Ext.NET forums!

    What is the content of print.aspx?
  3. #3
    Thanks, Daniil. The problem solved.The issue occurs when the printer spooler service isn't running.So,start the service,printing...

Similar Threads

  1. Print window content in EXT 4.2.1
    By GusMartins in forum 2.x Help
    Replies: 12
    Last Post: Feb 07, 2014, 8:30 AM
  2. [CLOSED] Print window content
    By avante in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Jan 17, 2014, 6:32 PM
  3. [CLOSED] How I print ext:Window content?
    By supera in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Feb 29, 2012, 4:00 PM
  4. Replies: 6
    Last Post: Feb 18, 2011, 2:12 PM
  5. Print content inside a panel
    By Nagaraj K Hebbar in forum 1.x Help
    Replies: 0
    Last Post: May 19, 2009, 2:14 AM

Posting Permissions