Click on a button or link to print another page, that is, print a URL.
Page Add a LINK element This method is simpler, in fact, you can do a hidden frame on the page to implement, but more than the above method to be stupid
Here's an example of printing a URL using hidden frames:
function Printurl (URL) {
if (window.print && window.frames && window.frames.printerIframe) {
var html = ';
HTML + = ' html + + ' <body onload= ' parent.printframe (window.frames.urlToPrint); " > ';
html + + ' <iframe name= ' urltoprint ' src= ' + URL + ' ><\/iframe> ';
HTML + = ' <\/body><\/html> ';
var ifd = window.frames.printerIframe.document;
Ifd.open ();
Ifd.write (HTML);
Ifd.close ();
}
}
function Printframe (frame) {
if (frame.print) {
Frame.focus ();
Window.print (); Use Print for a page
}
}
Then look at a hidden frame using the print of the plugin
function Printurl (URL) {
if (window.print && window.frames && window.frames.printerIframe) {
var html = ';
HTML + = ' html + + ' <body onload= ' parent.printframe (window.frames.urlToPrint); " > ';
html = ' <object style= ' display:none ' id= ' oprintctl ' classid= ' clsid:ca03a5a8-9890-49be-ba4a-8c524eb06441 ' Codebase= "eprintdemo.cab#version=3,0,0,9" viewastext></object> ";
html + + ' <iframe name= ' urltoprint ' src= ' + URL + ' ><\/iframe> ';
HTML + = ' <\/body><\/html> ';
var ifd = window.frames.printerIframe.document;
Ifd.open ();
Ifd.write (HTML);
Ifd.close ();
}
}
function Printframe (frame) {
if (frame.print) {
Frame.focus ();
Window.frames.printerIframe.document.oPrintCtl.Preview ();
Window.frames.printerIframe.document.oPrintCtl.Print ();
Window.frames.printerIframe.document.oPrintCtl.Print (TRUE);
}
Use the plug-in preview, printing and other functions to achieve.