读书人

用css回控制打印的pdf样式

发布时间: 2012-06-27 14:20:09 作者: rapoo

用css来控制打印的pdf样式

@page {?

?size: A4 landscape;

?margin-left:10px;

?margin-right:10px;?

?margin-top:37px;

?margin-bottom:20px;

?@top-center { content: element(header) };

?@bottom-center { content: element(footer) } ;

}

?

.header {

?position: running(header);

?text-align:left;

}

.footer {

?position: running(footer);

?font-size: 90%;

?text-align:center;

}

.content{}

#pagenumber:before {

?content: counter(page);?

}

#pagecount:before {

?content: counter(pages); ?

}

?

html里的写法:

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title>Component Associations Report</title>

<link href="css/pdf.css" rel="stylesheet" type="text/css" media="print" />

</head>

<body>

<div ><img src="img/argusLogo.GIF"/></div>

<div class="footer"> Page <span id="pagenumber"/></div>

?

?

</body>

</html>

?

拓展阅读:http://blog.csdn.net/shanliangliuxing/article/details/6833471

读书人网 >PowerDesigner

热点推荐