寻求精确打印方案 不小心按了回车用CSS可以很精确的控制打印时候的尺寸,包括字体阿,线宽阿,表格尺寸阿,等等。可以设定屏幕显示和打印使用两套CSS具体参见CSS语法咯不过计算起来好像也挺麻烦的,对兼容性要求也挺高的 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 PHP也可以使用XML啊~~你继续套用你原来的XML的打印就可以了~~~ <? //从环境变量中得到文件的相对路径 $page=substr($SCRIPT_NAME,1); // 显示一个图标并连接到Printer Friendly Pages // 便于打印页面的生成程序pfp.php ?> <a href="pfp.php?page=<?=$page?>">; <img src="printer.gif" width="36" height="36" border="0" alt="Click here to produce a printer friendly page"> <font face="arial, helvetica" size="2"> Printer Friendly Version </font> </a> 把当前页面的名称传递到pfp.php程序中,这个程序使用PHP的“file”函数把页面作为一个字符串来处理。当这个页面被载入的时候,程序就可以增加、改写或删除HTML片段。 <? ereg('^.*/',$SCRIPT_FILENAME,$tmp); $page_path = substr($tmp[0],0,-1); ?> <html> <head> <base href="http://<? echo $HTTP_HOST ?>/"> <meta name="robots" content="no index, no follow"> <title>Printer Friendly Page</title> </head> <body bgcolor="white"> <font face="Arial,Helvetica"> <table border="0" cellpadding="5" cellspacing="0" width="630" > <tr> <td valign="top"> <? // check if the filename for the page exists if (!file_exists("$page.inc")) { echo "<strong>Error - The page <?=$page?>". "does not exist on this site.</strong>"; } else { // 得到页面的内容并把它放到一个字符串中 $fcontents = join('', file("$page.inc")); // 忽略颜色属性,转换以’ignore’替代’color’ $fcontents = ereg_replace('color','ignore',$fcontents); // 去除超链接中的 “_blank” $fcontents = ereg_replace('target=\"_blank\"','',$fcontents); // 替换</a>标记 $fcontents = ereg_replace('</a>','',$fcontents); // 显示URL的绝对地址 $fcontents = ereg_replace('<a[^h]*href="(http://[^"]*)"[^>]*>;([^]*)', '<strong>\\2</strong><em>(\\1)</em>',$fcontents); // 把相对链接转为绝对链接 $fcontents = ereg_replace( '<a[^h]*href="([^"]*)"[^>]*>([^]*)', "<strong>\\2</strong><em>(http://$HTTP_HOST/\\1)</em>";, $fcontents); // 背景颜色改回白色 $fcontents = ereg_replace('<body bgignore','<body bgcolor', $fcontents); // if any ers left restore link end element $fcontents = ereg_replace('','</a>',$fcontents); // 输出页面 echo $fcontents; } ?> </td> </tr> <tr> <td align="center"><hr width="90%"></td> </tr> <tr> <td align="center"> <? include("$page_path/footer.inc"); ?> </td> </tr> </table> </font> </body> </html> 如何用php来截取网也的一部分 未审核的帖子在首页显示出来了 想要几个函数,大虾们拿出你的资料吧 大家说说这个网站这么多html页面怎么管理的? Include 找不到图片路径 如何利用网页打开浏览者硬盘中的指定文件 再次请教动态生成页面? 在 pws 下我能用php_gd.dll中的圖像函數,但在 apache 下不能用,我還要注意那些設置??? /usr/bin/php /www/x.php @c /www/x.ini @d 2 高手进来帮帮忙吧,实在是找不着了, 请教各位,怎样实现php的打印功能呀? 有谁研究Typo3吗?
//从环境变量中得到文件的相对路径
$page=substr($SCRIPT_NAME,1); // 显示一个图标并连接到Printer Friendly Pages
// 便于打印页面的生成程序pfp.php
?>
<a href="pfp.php?page=<?=$page?>">;
<img src="printer.gif" width="36" height="36" border="0"
alt="Click here to produce a printer friendly page"> <font face="arial, helvetica" size="2">
Printer Friendly Version
</font>
</a>
把当前页面的名称传递到pfp.php程序中,这个程序使用PHP的“file”函数把页面作为一个字符串来处理。当这个页面被载入的时候,程序就可以增加、改写或删除HTML片段。 <?
ereg('^.*/',$SCRIPT_FILENAME,$tmp);
$page_path = substr($tmp[0],0,-1);
?> <html> <head>
<base href="http://<? echo $HTTP_HOST ?>/">
<meta name="robots" content="no index, no follow">
<title>Printer Friendly Page</title>
</head> <body bgcolor="white"> <font face="Arial,Helvetica"> <table border="0" cellpadding="5" cellspacing="0" width="630" > <tr>
<td valign="top">
<?
// check if the filename for the page exists
if (!file_exists("$page.inc"))
{
echo "<strong>Error - The page <?=$page?>".
"does not exist on this site.</strong>";
}
else
{
// 得到页面的内容并把它放到一个字符串中
$fcontents = join('', file("$page.inc")); // 忽略颜色属性,转换以’ignore’替代’color’
$fcontents = ereg_replace('color','ignore',$fcontents); // 去除超链接中的 “_blank”
$fcontents = ereg_replace('target=\"_blank\"','',$fcontents); // 替换</a>标记
$fcontents = ereg_replace('</a>','',$fcontents); // 显示URL的绝对地址
$fcontents = ereg_replace('<a[^h]*href="(http://[^"]*)"[^>]*>;([^]*)',
'<strong>\\2</strong><em>(\\1)</em>',$fcontents); // 把相对链接转为绝对链接
$fcontents = ereg_replace(
'<a[^h]*href="([^"]*)"[^>]*>([^]*)',
"<strong>\\2</strong><em>(http://$HTTP_HOST/\\1)</em>";,
$fcontents); // 背景颜色改回白色
$fcontents = ereg_replace('<body bgignore','<body bgcolor', $fcontents); // if any ers left restore link end element
$fcontents = ereg_replace('','</a>',$fcontents); // 输出页面
echo $fcontents;
}
?>
</td>
</tr> <tr>
<td align="center"><hr width="90%"></td>
</tr>
<tr>
<td align="center">
<? include("$page_path/footer.inc"); ?>
</td>
</tr>
</table>
</font>
</body>
</html>