简体   繁体   English

如何用 PHP 以字母格式(纸张大小)显示和打印数据?

[英]How to display and print data with PHP in a letter format (paper size)?

I have an issue trying to print a report (in the server side), I'm using wkthtmltopdf libraries to print a specific report using the internal URL, the problem is that when I try to print this report in a letter format (and portrait)most of the times the report has more lines, so at the end my PDF report is out of format.我在尝试打印报告(在服务器端)时遇到问题,我正在使用 wkthtmltopdf 库使用内部 URL 打印特定报告,问题是当我尝试以字母格式(和纵向)打印此报告时)大多数时候报告有更多的行,所以最后我的 PDF 报告格式不正确。

I tried to count the height lines in a regular letter page and then display my data in too columns if it's necessary, but this is not working for all the situations (there are over 300 reports).我尝试计算常规字母页面中的高度线,然后在必要时将我的数据显示在太列中,但这不适用于所有情况(有超过 300 份报告)。

How do you guys print reports using PHP?你们如何使用 PHP 打印报告? or How do you guys set a letter page in PHP?或者你们如何在 PHP 中设置字母页?

Thanks in advance!提前致谢!

I will typically just render the page in HTML then make a special CSS import with media="print" attribute.我通常只会在 HTML 中呈现页面,然后使用 media="print" 属性进行特殊的 CSS 导入。 Then you can use plain CSS to format the page.然后你可以使用普通的 CSS 来格式化页面。

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

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