Print window content in EXT 4.2.1
Hello guys!
I'm trying to print the content of a ext window. In the window i have an iframe with a pdf.
I'm able to print the content on google chrome, but on IE the best i can get is the content of the parent window.
I send you my function.
Code:
clickRunReport:function(){
console.log("clickRunReport");
//report request
var request = frontController + 'report/test?'
+ "p_cod_opcao=873&p_cod_rep=873&p_cod_mod=INT&p_dta _inicial=12/12/2013&p_dta_final=12/12/2013&p_cod_dest=&p_cod_esp=&p_tipo_serv=F";
//destroy window
//Ext.WindowManager.each(function(cmp) { if (cmp.itemId === 'reportWindow') cmp.destroy(); });
//ext window with hidden iframe
var win = new Ext.Window ({
itemId: 'reportWindow',
width: 800,
height: 600,
title: 'Relatorio',
hidden:true,
modal:true,
html: '<iframe src="'+request+'" id="reportFrame" id="reportFrame" name="reportFrame" style="visibility:hidden;display:none" ></iframe>'
});
win.show();
//print works on CHROME
window.frames['reportFrame'].focus();
window.frames['reportFrame'].print();
}
Thank you for the attention hope you can help me!
please help me print pdf too..
look at this example.. but i dont know id my iframe after loader
Code:
<ext:Window ID="wndShowDoc" runat="server" Title="" Icon="UserHome" BodyPadding="0" AutoScroll="true" TagString="iframe"
Width="900" Height="600" Modal="true" Resizable="true" Closable="true" Hidden="true" Layout="Fit" CloseAction="Hide">
<Items>
<ext:Panel runat="server" ID="PanelView">
<Buttons>
<ext:Button ID="btPrints" runat="server" Text="Печать" Icon="Printer">
<Listeners>
<%-- <Click Handler="this.up('panel').getBody().print();" />--%> this good for print html file
<Click Handler="this.up('iframe').contentWindow.print();" />
</Listeners>
</ext:Button>
<ext:Button runat="server" Icon="Decline" Text="Закрыть" ID="btCloseView" >
<Listeners>
<Click Handler="this.up('window').hide();" />
</Listeners>
</ext:Button>
</Buttons>
<Loader ID="Loader1"
runat="server"
AutoLoad="false"
Url="~/Handler/Handler1.ashx"
Mode="Frame">
<Params>
<ext:Parameter Name="ext" Value="pdf" Mode="Value" />
<ext:Parameter Name="link" Value="c:\1\1.pdf" Mode="Value" />
<ext:Parameter Name="pathToImage" Value=".\Images\" Mode="Value" />
</Params>
</Loader>
</ext:Panel>
</Items>
</ext:Window>