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>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度