如何在tcpdf中将数据库表拆分为页面

0mkxixxg  于 2021-06-23  发布在  Mysql
关注(0)|答案(0)|浏览(268)

我正在为我的客户制作一个小型的pdf生成工具。我使用tcpdf,因为我们需要在它使用阿拉伯语字体。我正在从数据库得到结果。现在客户端要求每页20个结果。我在网上查了很多。但我什么也没找到。这是我的密码,请看一下。

$pdf->SetFont('dejavusans', '', 18);
$pdf->Ln(40);
$content = '';

$content .='
<table>
';

$counter=0;
$result = mysqli_query($db,"SELECT * FROM record");
while($row = mysqli_fetch_array($result))
{
    $counter++;

    $name = $row['rname'];
        $country = $row['rcountry'];
        $uid = $row['ruid'];

        $content .='

        <tr>
            <td>'.$name.'</td>
            <td>'.$country.'</td>
            <td>'.$uid.'</td>
        </tr>';
}

$content .='</table>';

$pdf->WriteHTML($content, true, 0, true, 0);

我也尝试了下面的解决方案,但是它没有在x行数之后显示任何结果拆分表&在while循环中添加文本(使用tcpdf)

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题