[英]Print dompdf table issue
Print dompdf table issue: DomPDF table goes out of pdf while printing. 打印dompdf表问题:DomPDF表在打印时超出了pdf格式。 Can anyone help me in this.
谁能帮我这个忙。 I am in need to break the table width according to content.
我需要根据内容打破桌子的宽度。
This is one of the problems with DOMPDF, and there is no work-around, except for you controlling how much content can be on a page, and creatively using CSS to break your content up so that it doesn't overlap pages. 这是DOMPDF的问题之一,没有解决方法,除了您控制页面上可以容纳多少内容,并创造性地使用CSS分解内容以使其不与页面重叠。 You must break your tables into more than one table, then tell DOMPDF where your page breaks are.
您必须将表分成多个表,然后告诉DOMPDF分页符在哪里。
In my own DOMPDF usage, I include CSS styles at the top of the HTML. 在我自己的DOMPDF用法中,我在HTML顶部包含CSS样式。 Notice the CSS "page-break-before" property:
注意CSS的“ page-break-before”属性:
<!doctype html>
<html>
<head>
<title>Dynamically Generated PDF</title>
<style>
#page_break{
page-break-before:always;
}
</style>
</head>
<body>
<!-- Contents of PDF -->
</body>
</html>
There is another CSS property you can use to break up page, "page-break-after". 您可以使用另一个CSS属性来拆分页面,即“ page-break-after”。
You use this CSS and apply it to elements where you know you want a page break, for instance: 您使用此CSS并将其应用于您知道要分页的元素,例如:
<h2 id="page_break">Table 1:</h2>
<table>
<!-- table content -->
</table>
<h2 id="page_break">Table 1 (continued):</h2>
<table>
<!-- table content -->
</table>
This breaks the content into pages, and in this case this H2 tags would be at the top of the pages. 这会将内容分成页面,在这种情况下,此H2标签将位于页面顶部。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.