简体   繁体   English

使用TCPDF生成的PDF中的文本溢出单元格

[英]Text overflowing cell in PDF generated using TCPDF

I have a issue trying to display large chunks of text coming from a sql table on a pdf file created with Tcpdf. 我尝试在使用Tcpdf创建的pdf文件上显示来自sql表的大量文本时遇到问题。 The layout of the pdf consists of a header, a footer and several cells of text. pdf的布局由页眉,页脚和几个文本单元组成。 When the last cell of text overflows the page, the next page shows the remaining text over the header of the next page. 当最后一个文本单元格使页面溢出时,下一页将在下一页的标题上方显示剩余的文本。 The problem is that the text isn't putted line by line on the file but it's dumped completely into the cell. 问题在于文本不是逐行放置在文件中,而是完全转储到单元格中。 Is there a way to prevent this behavior? 有没有办法防止这种行为? Any idea of how to trim the text so it can fix in two cells on two pages? 关于如何修剪文本以便可以将其固定在两页的两个单元中的任何想法?

Any help or idea will be appreciated. 任何帮助或想法将不胜感激。

Are you are using TCPDF's writeHTML() method to generate your PDF? 您是否正在使用TCPDF的writeHTML()方法生成PDF?

If so I'd highly recommend using TCPDF's built in functions for laying out your page - TCPDF is a decent library, but in my experience if you attempt to layout with a half implementation of HTML then it's always a headache. 如果是这样的话,我强烈建议使用TCPDF的内置函数来布局页面-TCPDF是一个不错的库,但是以我的经验,如果您尝试使用HTML的一半实现进行布局,那总是很头疼。

If you're not using html then try setting the page margins or split up your text using PHP's substr() and then set the AutoPageBreak in TCPDF 如果您不使用html,请尝试设置页面边距或使用PHP的substr()拆分文本,然后在TCPDF中设置AutoPageBreak

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

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