dongweihuai5601 2015-06-17 21:48
浏览 54
已采纳

如果当前td具有长文本,则TCPDF忽略先前td的宽度

I came across a weird problem when trying to use TCPDF to create pdf off of my html. I am using

$pdf->writeHTML($myHTML, true, 0, true, 0);

to write my html content and within the pdf enter image description here

<tr>
    <td style="width: 2%"></td>
    <td style="width: 48%;text-align: left;">
        <?php echo $text; ?>            
        <br />
        <table>
            <tr>
                <td style="width:10px;"></td>
                <td style="font-size: 22px;"><?php echo $comment;?></td>
            </tr>
        </table>            
    </td>
    <td style="width: 8%;"><?php echo $dur?></td>
    <td style="width: 8%;"><?php echo ''; ?></td>
    <td style="width: 12%;"><?php echo $xyz; ?></td>
    <td style="width: 11%;"><?php echo Price(); ?></td>
    <td style="width: 11%;"><?php echo new_Price() : ''; ?></td>
</tr>

Here we can see in image, When the text in the cell is longer than width; line breaks, and disregards the td with width 2% in this case before "Successful".

Same goes for another text below in $comment, before "nothing" it disregards the td.

how can I make it all align properly.

  • 写回答

1条回答 默认 最新

  • dousui6488 2015-06-18 08:50
    关注

    Still open for an answer

    I still haven't been able to find a definite better answer. I am posting this answer incase someone else is facing the same problem and is looking for urgent solution.

    <td style="width: 48%;text-align: left;">
        <?php echo wordwrap($text, '70',"<br \>
     &nbsp;&nbsp;&nbsp;"); ?>            
            <br />
            <table>
                <tr>
                    <td style="width:10px;"></td>
                    <td style="font-size: 22px;"><?php echo wordwrap($comment, '70',"<br \>
     &nbsp;&nbsp;&nbsp;"); ?></td>
                </tr>
            </table>
    </td>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)
  • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
  • ¥15 路易威登官网 里边的参数逆向
  • ¥15 Arduino无法同时连接多个hx711模块,如何解决?
  • ¥50 需求一个up主付费课程