...

View Full Version : Printing



ledzep
06-18-2002, 03:57 AM
I would like to be able to print a selection of an HTML page rather than the whole page. is there a way to achieve this?
Thanks for any help

mordred
06-18-2002, 08:55 AM
You would have to grab the desired elements and by some DHTML functionality and pass them to a new blank document, which you have opened in a new window or in a frame. Perhaps it's even possible to do this in a hidden <iframe>.
Then you only have call the window.print() method of that new document.

brothercake
06-18-2002, 01:31 PM
<style type="text/css" media="screen">

img { display:inline; }

</style>
<style type="text/css" media="print">

img { display:none; }

</style>


This simple example will declare that all IMG tags do not print. By extending this method, you can specify any area of the page to print or not print

ledzep
06-18-2002, 07:54 PM
Hi

Thanks guys for the help. I will look into these options

jalarie
06-19-2002, 02:48 PM
Sel='';
function PrintSelected() {
if (window.frames.length == 0){
Sel=document.getSelection();
} else {
for (iy=0;iy<window.frames.length;iy++){
Fm=window.frames[iy];
Sel=Sel+Fm.document.getSelection();
}
}
var Opts='width=100,height=100'; PS_Pop=window.open('','PrintSel',Opts);
PS_Pop.document.write(Sel);
PS_Pop.document.close();
this.window.focus();
PS_Time=setTimeout("PrintSelected2()",1000);
}
function PrintSelected2() {
PS_Pop.window.print();
PS_Time=setTimeout("PrintSelected3()",5000);
}
function PrintSelected3() {
PS_Pop.window.close();
}

ledzep
06-19-2002, 06:55 PM
Thanks Jalarie for your solution which I will try out



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum