简体   繁体   English

PHP:从具有400-500页的HTML创建PDF

[英]PHP : Create PDF from html with 400-500 pages

I converted html to PDF file which contains 400-500 pages using wkhtmltopdf . 我使用wkhtmltopdf将html转换为包含400-500页的PDF文件。 But getting undesirable spaces after each 4 rows in table. 但是在表中的每4行之后会得到不想要的空间。 How to overcome this issue ? 如何克服这个问题? HTML is looks fine but PDF has spaces. HTML看起来不错,但PDF带有空格。

I use following things to create PDF. 我使用以下内容创建PDF。

  1. PHP => exec('/usr/bin/wkhtmltopdf temp.html temp.pdf 2>&1', $output); PHP => exec('/ usr / bin / wkhtmltopdf temp.html temp.pdf 2>&1',$ output);
  2. Style in HTML : HTML中的样式:

@media all { table { empty-cells: hide !important;} tr { page-break:avoid; @media all {table {空单元格:hide!important;} tr {page-break:avoid; page-break-inside: avoid; page-break-inside:避免; empty-cells:hide; 空单元格:隐藏; margin:0px; 保证金:0像素; padding:0px;} .pgBrk { page-break-after: always !important; padding:0px;} .pgBrk {page-break-after:always!important; page-break-inside:avoid !important;} tr.json-array-table { page-break-inside: avoid !important;} page-break-inside:避免!important;} tr.json-array-table {page-break-inside:避免!important;}

Please suggest. 请提出建议。

I have done this using TCPDF library. 我已经使用TCPDF库完成此操作。 wkhtmltopdf is fast execution but less customization. wkhtmltopdf执行速度快,但自定义程度较低。 TCPDF supports customization and a lot of key features when you work with the creation of PDF files. 当您创建PDF文件时,TCPDF支持自定义和许多关键功能。 We can checkout BEST library in php here . 我们可以在PHP中签最好的图书馆在这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM