我正在使用Flying Saucer(将CSS/HTML转储到iText到PDF)创建PDF,我正在尝试使用CSS3将图像页眉和页脚应用到每个页面.
我基本上想把这个div放在每个页面的左上角:
<div id="pageHeader">
<img src="..." width="250" height="25"/>
</div>
Run Code Online (Sandbox Code Playgroud)
我的CSS看起来有点像这样:
@page {
size: 8.5in 11in;
margin: 0.5in;
@top-left {
content: "Hello";
}
}
Run Code Online (Sandbox Code Playgroud)
有没有办法让我把这个div放进去content?
我希望每个打印页面都重复我的表格标题,但似乎谷歌Chrome不能<thead>很好地支持标签......有没有办法解决这个问题?我正在使用Google Chrome v13.0.782.215.
表格代码非常简单......没什么特别的:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css" media="all">
@page {
size: landscape;
margin-top: 0;
margin-bottom: 1cm;
margin-left: 0;
margin-right: 0;
}
table {
border: .02em solid #666; border-collapse:collapse;
width:100%;
}
td, th {
border: .02em solid #666; font-size:12px; line-height: 12px;
vertical-align:middle; padding:5px; font-family:"Arial";
}
th { text-align:left; font-size:12px; font-weight:bold; }
h2 { margin-bottom: 0; }
</style>
</head>
<body>
<h2>Page Title</h2>
<table>
<thead>
<tr class="row1">
<th><strong>Heading 1</strong></th>
<th><strong>Heading 2</strong></th> …Run Code Online (Sandbox Code Playgroud) 有没有人有一个文章的链接或专门从Chrome重复页面页眉/页脚的工作示例?
背景:
我花了好几天没有运气,有几个Stack提出的解决方案,但似乎没有工作(在Chrome中).由于我们在工作中使用Chrome,我只在那里测试过,所以下面有很多人说Chrome不能做到,但也许我忽略了一些东西?
我试过这些Stack链接(..还有更多):
如果我不能,请使用重复的页眉/页脚...然后我的下一个想法是计算我的克隆对象中的行并让它以最大数量打破,创建一个新页面(强制高度)并再次启动循环另一个div的另一页.
我非常感谢有关运行页眉/页脚解决方案的任何建议,因为我的应用程序的重点是完成的打印提案.