View Single Post
  #9 (permalink)  
Old 02-24-2007, 08:12 PM
drummin drummin is offline
WebProWorld Pro
 
Join Date: Aug 2003
Location: California,USA
Posts: 294
drummin RepRank 0
Default

Looks like your original question was regarding printing from your web page.

I use this all the time. Once you have these two "pages", you can add print to any section of text.
Make a page called, popup.js and use the following code.
function popup_print(printtable)
{
window.open('print.php?printtable='+printtable,'Pr int','width=600,height=710,toolbar=no, location=no,directories=no,status=no,menubar=no,sc rollbars=yes,copyhistory=yes,resizable=yes')
}
***
You can change popup size but I've found this works great for printing.
***
Make a page called print.php and use the following code.
<?
$printtable=$_REQUEST['printtable'];
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<TITLE> Print Document </TITLE>
<link rel="stylesheet" type="text/css" href="../css/printstyle.css">
</head>
<body>
<script>
document.write(window.opener.document.getElementBy Id("<?=$printtable;?>").innerHTML);
window.print();
</script>
</body>
</html>
***
As you can see, you can make style sheet for printing.
***
You will need to link to your js popup file on your main site pages. You can then surround any text to print with "printtable" id's. Here's a sample.

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title></title>
<script src="js/popup.js" language="javascript" type="text/javascript"></script>
</head>
<body>
<input type="button" name="print" value="Print" onclick="popup_print('printtable1')">
<div id="printtable1">Text on page.</div>
<input type="button" name="print" value="Print" onclick="popup_print('printtable2')">
<div id="printtable2">Text2 on page.</div>
</body>
</html>
Reply With Quote