桌面底部中断并在下一页打印,如何解决?

时间:2017-10-18 09:34:54

标签: java itext

我使用itext + xmlworker(v.5.5.12)来制作来自html内容的pdf,并经常在下一页的底部边框中断和显示。怎么修好?

我尝试将splitLate用于PdfPTable实例,但它选项(setSplitLate(true))修复了边框问题,但它在表中创建了新的“崩溃”数据。该表有colspan / rowspan和setSplitLate(true)移动文本及其样式(参见图片上的箭头)。

我可以做些什么来修复它?可能需要从com.itextpdf.tool.xml.html.table.Table扩展并修补它..

PS。对不起图片我不能附上它

broken table

<html>
	<body>
		<p class="caption">
			<b>aaaaaaa
			</b>
		</p>
		<table class="table">
			<tr>
				<td class="tdlbg" width="20%">
					<b>Bltynbabrfnjh Ntcnjdjuj ckexfz:</b>
				</td>
				<td class="td" width="80%" colspan="4">TC-IMA-007 (2)</td>
			</tr>
			<tr>
				<td class="tdlbg">
					<b>Yjvth g/g/ GB:</b>
				</td>
				<td class="td" colspan="4"> 42.00-2</td>
			</tr>
			<tr>
				<td class="tdlbg">
					<b>Gjlndth;ltybt Cjjndtncndbz:</b>
				</td>
				<td class="td" colspan="4"> 25.1309(c)</td>
			</tr>
			<tr>
				<td class="tdlbg">
					<b>Wtkm ntcnbhjdfybz:</b>
				</td>
				<td class="td" colspan="4">
					<p>
						<span>Ghjdthrf hf,jnjcgjcj,yjcnb cbcntvs BVF.</span>
					</p><p>
						<span>Ghjdthrf ghtljcnfdktybz 'rbgf;e</span>
						<span style="color: #000000"> </span>
						<span style="color: #000000">ntrcnjdjuj</span>
						<span style="color: #000000"> </span>
						<span style="color: #000000">ghtleght;lf.otuj cjj,otybz </span>
						<span>ghb jnrk.xtybb WD "CPIOM 1С asada asda sdasd ad".</span>
					</p>
				</td>
			</tr>
			<tr>
				<td class="tdlbg" rowspan="2">
					<b>Ytj,[jlbvjcnm bvbnfwbb jnrfpjd:</b>
				</td>
				<td class="tdmbg" width="5%">
					<b>G/gs</b>
				</td>
				<td class="tdmbg" width="25%" colspan="2">
					<b>Yfpdfybt</b>
				</td>
				<td class="tdmbg" width="50%">
					<b>Jgbcfybt jnrfpf</b>
				</td>
			</tr>
			<tr>
				<td class="tdc">1.</td>
				<td class="td" colspan="2"> Jnrfp CPIOM 1C</td>
				<td class="td">
					<p>Nbg jnrfpf^ 'ktrnhbxtcrbq</p><p>
						<span>Cbuyfk/zkjr/Hfp]`v/Rjynfrn</span>
					</p><p>
						<span>CPIOM</span>
						<span> 1</span>
						<span>C</span>
						<span>/ </span>
						<span>ESS</span>
						<span>-</span>
						<span>LPDB</span>
						<span>/-/ </span>
						<span>C</span>
						<span>9</span>
					</p>
				</td>
			</tr>
			<tr>
				<td class="tdlbg">
					<b>J;blftvsq htpekmnfn:</b>
				</td>
				<td class="td" colspan="4">
               								D cjjndtncndbb c nf,kbwtq

				</td>
			</tr>
			<tr>
				<td class="tdlbg">
					<b>Ntcnjdfz ghjwtlehf:</b>
				</td>
				<td class="td" colspan="4">Cvjnhb nf,kbwe dfhbfynjd Ntcnjdjuj ckexfz</td>
			</tr>
			<tr>
				<td class="tdlbg">
					<b>Rjvtynfhbq:</b>
				</td>
				<td class="td" colspan="4"/>
			</tr>
		</table>
		<p> </p>
		<table class="table">
			<tr>
				<td class="tdmbg" colspan="4">
					<b>Dfhbfyns NC/J;blftvst htpekmnfns</b>
				</td>
			</tr>
			<tr>
				<td class="tdmbg" width="5%">
					<b>G/g</b>
				</td>
				<td class="tdmbg" width="33%">
					<b>TC</b>
				</td>
				<td class="tdmbg" width="33%">
					<b>Gjkj;tybt cfvjk`nf</b>
				</td>
				<td class="tdmbg" width="33%">
					<b>ТP</b>
				</td>
			</tr>
			<tr>
				<td class="tdmbg">1</td>
				<td class="tdmbg"> TC-IMA-007.001</td>
				<td class="tdmbg"> yf ptvkt (WOW=True)</td>
				<td class="tdmbg"> TP-IMA-004</td>
			</tr>
			<tr>
				<td class="tdc" width="20%" colspan="2" rowspan="5">
					<b>J;blftvsq htpekmnfn</b>
				</td>
				<td class="tdc" width="10%">J,sxysq</td>
				<td class="td" width="70%" colspan="1">
					<p>
						<span style="color: #000000">Yf cbuyfkmyjv gjkt rflhf </span>
						<span style="color: #000000">EWD</span>
						<span style="color: #000000"> bylbwbhetncz</span>
						<span style="color: #E36C0A"> </span>
						<span style="color: #000000">ntrcnjdjt</span>
						<span style="color: #E36C0A"> </span>
						<span style="color: #000000">ghtleght;lf.ott cjj,otybt rfntujhbb Caution</span>
						<span> </span>
						<span style="color:#FF8C00">SWS 1 FAULT</span>
						<span style="color: #000000"> zynfhyjuj wdtnf.</span>
					</p>
				</td>
			</tr>
			<tr>
				<td class="tdc" width="10%">J,sxysq</td>
				<td class="td" width="70%" colspan="1">
					<p>
						<span style="color: #000000">Yf cbuyfkmyjv gjkt rflhf </span>
						<span style="color: #000000">EWD</span>
						<span style="color: #000000"> bylbwbhetncz</span>
						<span style="color: #E36C0A"> </span>
						<span style="color: #000000">ntrcnjdjt</span>
						<span style="color: #E36C0A"> </span>
						<span style="color: #000000">ghtleght;lf.ott cjj,otybt rfntujhbb Caution</span>
						<span> </span>
						<span style="color:#FF8C00">FWS 1 FAULT</span>
						<span style="color: #000000"> zynfhyjuj wdtnf.</span>
					</p>
				</td>
			</tr>
			<tr>
				<td class="tdc" width="10%">
							zCNJ</td>
				<td class="td" width="70%" colspan="1">
					<p>
						<span style="color: #4F81BD">
											zCNJ: </span>
						<span style="color: #4F81BD">Ntrcn jnrfpf </span>
						<span style="color: #FF0000">TBD</span>
						<span style="color: #FF0000">,</span>
						<span style="color: #4F81BD"> rjl jnrfpf </span>
						<span style="color: #FF0000">TBD</span>
						<span style="color: #4F81BD"> bylbwbhetncz yf vytvjrflht </span>
						<span style="color: #4F81BD">БСТО</span>
					</p>
				</td>
			</tr>
			<tr>
				<td class="tdc" width="10%">BCCRJH</td>
				<td class="td" width="70%" colspan="1">
					<p>
						<span style="color: #4F81BD">BCCRJH: </span>
						<span style="color: #4F81BD">Byajhvfwbz</span>
						<span style="color: #FF0000"> </span>
						<span>jnrfp cbcntvs ghtleght;ltybz j cdfkbdfybb</span>
						<span style="color: #FF0000"> </span>
						<span>(</span>
						<span>SWS</span>
						<span> </span>
						<span>is</span>
						<span> </span>
						<span>fault</span>
						<span>)</span>
						<span style="color: #4F81BD">, </span>
						<span style="color: #4F81BD">byltrc byajhvfwbb </span>
						<span>1.5.3</span>
						<span style="color: #4F81BD"> pfhtubcnhbhjdfyf</span>
						<span style="color: #4F81BD"> </span>
						<span style="color: #4F81BD">d </span>
						<span style="color: #4F81BD">BCCRJH</span>
					</p>
				</td>
			</tr>
			<tr>
				<td class="tdc" width="10%">BCCRJH</td>
				<td class="td" width="70%" colspan="1">
					<p>
						<span style="color: #4F81BD">BCCRJH: </span>
						<span style="color: #4F81BD">Byajhvfwbz</span>
						<span style="color: #FF0000"> CAS_MES_</span>
						<span style="color: #FF0000">TBD</span>
						<span style="color: #FF0000"> </span>
						<span style="color: #4F81BD">byltrc byajhvfwbb </span>
						<span style="color: #FF0000">1.11.</span>
						<span style="color: #FF0000">TBD</span>
						<span style="color: #4F81BD"> pfhtubcnhbhjdfyf</span>
						<span style="color: #4F81BD"> </span>
						<span style="color: #4F81BD">d </span>
						<span style="color: #4F81BD">BCCRJH</span>
						<span style="color: #4F81BD"> (ghjcvjnh gjckt bcgsnfybz)</span>
					</p>
				</td>
			</tr>
			<tr>
				<td class="tdmbg">2</td>
				<td class="tdmbg"> TC-IMA-007.002</td>
				<td class="tdmbg"> D djple[t (WOW=FALSE)</td>
				<td class="tdmbg"> TP-IMA-008</td>
			</tr>
			<tr>
				<td class="tdc" width="20%" colspan="2" rowspan="5">
					<b>J;blftvsq htpekmnfn</b>
				</td>
				<td class="tdc" width="10%">J,sxysq</td>
				<td class="td" width="70%" colspan="1">
					<p>
						<span>Yf cbuyfkmyjv gjkt rflhf </span>
						<span>EWD</span>
						<span> bylbwbhetncz ntrcnjdjt ghtleght;lf.ott cjj,otybt rfntujhbb </span>
						<span>Caution</span>
						<span> </span>
						<span style="color:#FF8C00">SWS 1 FAULT</span>
						<span> янтарного цвета</span>
					</p>
				</td>
			</tr>
			<tr>
				<td class="tdc" width="10%">J,sxysq</td>
				<td class="td" width="70%" colspan="1">
					<p>
						<span>Yf cbuyfkmyjv gjkt rflhf </span>
						<span>EWD</span>
						<span> bylbwbhetncz ntrcnjdjt ghtleght;lf.ott cjj,otybt rfntujhbb </span>
						<span>Caution</span>
						<span> </span>
						<span style="color:#FF8C00">FWS 1 FAULT</span>
						<span> янтарного цвета</span>
					</p>
				</td>
			</tr>
			<tr>
				<td class="tdc" width="10%">
											zCNJ</td>
				<td class="td" width="70%" colspan="1">
					<p>
						<span>
															zCNJ^ Ntrcn jnrfpf </span>
						<span>TBD</span>
						<span>, rjl jnrfpf </span>
						<span>TBD</span>
						<span> bylbwbhetncz yf vytvjrflht zCNJ</span>
					</p>
				</td>
			</tr>
			<tr>
				<td class="tdc" width="10%">BCCRJH</td>
				<td class="td" width="70%" colspan="1">
					<p>
						<span style="color: #4F81BD">BCCRJH: </span>
						<span style="color: #4F81BD">Byajhvfwbz</span>
						<span style="color: #FF0000"> </span>
						<span>jnrfp cbcntvs ghtleght;ltybz j cdfkbdfybb</span>
						<span style="color: #FF0000"> </span>
						<span>(</span>
						<span>SWS</span>
						<span> </span>
						<span>is</span>
						<span> </span>
						<span>fault</span>
						<span>)</span>
						<span style="color: #4F81BD">, </span>
						<span style="color: #4F81BD">byltrc byajhvfwbb </span>
						<span>1.5.3</span>
						<span style="color: #4F81BD"> pfhtubcnhbhjdfyf</span>
						<span style="color: #4F81BD"> </span>
						<span style="color: #4F81BD">d </span>
						<span style="color: #4F81BD">BCCRJH</span>
					</p>
				</td>
			</tr>
			<tr>
				<td class="tdc" width="10%">BCCRJH</td>
				<td class="td" width="70%" colspan="1">
					<p>
						<span style="color: #4F81BD">BCCRJH: </span>
						<span style="color: #4F81BD">Byajhvfwbz</span>
						<span style="color: #FF0000"> CAS_MES_</span>
						<span style="color: #FF0000">TBD</span>
						<span style="color: #FF0000"> </span>
						<span style="color: #4F81BD">byltrc byajhvfwbb </span>
						<span style="color: #FF0000">1.11.</span>
						<span style="color: #FF0000">TBD</span>
						<span style="color: #4F81BD"> pfhtubcnhbhjdfyf</span>
						<span style="color: #4F81BD"> </span>
						<span style="color: #4F81BD">d </span>
						<span style="color: #4F81BD">BCCRJH</span>
						<span style="color: #4F81BD"> (ghjcvjnh gjckt bcgsnfybz)</span>
					</p>
				</td>
			</tr>
		</table>
		<p>§</p>
	</body>
</html>

body {
	font-family: "Times New Roman";
}

.table {
	width: 100%;
	border: 0px outset;
	border-bottom-width: 1px;
	border-left-width: 1px;
	border-collapse: collapse;
	font-size: 11px;
}

.td > table {
	width: 100%;
	border: 0px outset;
	border-bottom-width: 1px;
	border-left-width: 1px;
	border-collapse: collapse;
	font-size: 11px;
}

.th, .td {
	border-width: 1px 1px 0px 0px;
	border-style: inset;
	border-color: #000000;
	padding: 5px;
	vertical-align: middle;
}

.td > th, td {
	border-width: 1px 1px 0px 0px;
	border-style: inset;
	border-color: #000000;
	padding: 5px;
	vertical-align: middle;
}

.tdc {
	border-width: 1px 1px 0px 0px;
	border-style: inset;
	border-color: #000000;
	padding: 5px;
	vertical-align: middle;
	text-align: center;
}

.tdwu {
	border-width: 0px 1px 0px 0px; 
	border-style: inset;
	border-color: #000000;
	padding: 5px;
	vertical-align: middle;
}

.tdm {
	border-width: 1px 1px 0px 0px;
	border-style: inset;
	border-color: #000000;
	padding: 5px;
	text-align: center;
}

.tdmbg {
	border-width: 1px 1px 0px 0px;
	border-style: inset;
	border-color: #000000;
	background: #F2F2F2;
	padding: 5px;
	text-align: center;
}

.tdlbg {
	border-width: 1px 1px 0px 0px;
	border-style: inset;
	border-color: #000000;
	background: #F2F2F2;
	padding: 5px;
	text-align: left;
}

.text {
	padding: 5px;
	text-align: justify;
	font-size: 11px;
}

p {
	padding: 5px;
}

.caption {
	font-size: 14px;
	font-weight: bold;
	padding: 5px;
}

.text > table > tr > th {
	text-align: center;
	font-weight: bold;
	padding: 10px;
	background: #F2F2F2;
	vertical-align: bottom;
}

.text > table {
	width: 100%;
	border: 0px outset;
	border-bottom-width: 1px;
	border-left-width: 1px;
	border-collapse: collapse;
	font-size: 11px;
}

.text > table > tr > th, td {
	border-width: 1px 1px 0px 0px;
	border-style: inset;
	border-color: #000000;
	padding: 5px;
	text-align: left;
}

.fix {
	color: red;
}

0 个答案:

没有答案