Click to See Complete Forum and Search --> : Web Printing Problem


Venissa
04-15-2004, 10:37 AM
??

Larzman
04-17-2004, 02:30 AM
in the <head> section add this javascript:

<script language="JavaScript">
<!--
var gAutoPrint = true; // Flag for whether or not to automatically call the print function

function printSpecial()
{
if (document.getElementById != null)
{
var html = '<HTML>\n<HEAD>\n';

if (document.getElementsByTagName != null)
{
var headTags = document.getElementsByTagName("head");
if (headTags.length > 0)
html += headTags[0].innerHTML;
}

html += '\n</HE>\n<BODY>\n';
var printReadyElem = document.getElementById("printReady");
if (printReadyElem != null)
{
html += printReadyElem.innerHTML;
}
else
{
alert("Could not find the printReady section in the HTML");
return;
}

html += '\n</BO>\n</HT>';
var printWin = window.open("","printSpecial");
printWin.document.open();
printWin.document.write(html);
printWin.document.close();
if (gAutoPrint)
printWin.print();
}
else
{
alert("Sorry, the print ready feature is only available in modern browsers.");
}
}
//-->
</script>

---------------------------
in the <body> section, use a <div> tag to identify the printable section of your page.

example:

<div id="printReady">

Whatever yyou want printed here

<form id="printMe" name="printMe">
<input type="button" name="printMe" onClick="printSpecial()" value="Print this page">
</form>
</div>

The <form> code will add a "Print this page" button to the page.

See wehre I used this on the web for a complete example: http://www.rauland.com/corporate/jobs/edu_IP_pm040309.htm

Venissa
04-19-2004, 08:33 AM
??

Larzman
04-20-2004, 09:01 PM
not that I know of. Anyone out here in the forum got ideas?