0

I have displayed a pdf in iframe which is in aspx page. I am working on IE6 browser. I use the following html and javascript code.

<iframe id = "frame_singleCheque" src = "../pdf/SingleCheque.pdf" runat = "server" style ="height:400px; width: 750px; overflow:scroll;" />


function printDoc()
{
      window.frames['ctl00_contPlcHdrMasterHolder_frame_singleCheque'].focus();
      window.frames['ctl00_contPlcHdrMasterHolder_frame_singleCheque'].print();
}

<input type="button" id = "btnCPrint" value = "Print" onclick="javascript:printDoc()" />

If press print button it shows print dialog. but whenever I press print button it doesn't print any thing. It doesn't print event a blank page. How can I print it?

1 Answers1

0

Try this:

function printDoc() {
   document.getElementById('frame_singleCheque').focus(); 
   document.getElementById('frame_singleCheque').contentWindow.print();
}

EDIT: Have a look at this as well.

Community
  • 1
  • 1
Behrang
  • 46,888
  • 25
  • 118
  • 160