javascript - FPDF 将图像放入 CELL 时出现奇怪的错误

标签 javascript php html pdf fpdf

我不知道为什么图像不符合要求

这是结果

enter image description here

这是我的代码

        $fpdf->Cell(65,30,$fpdf->Image('assets/images/qrcodes/qrcodse.png', $fpdf->GetX(), $fpdf->GetY(), 30),1,0,'',false);
            $fpdf->cell(10,30,'',0,0,'');
        $fpdf->Cell(65,30,$fpdf->Image('assets/images/qrcodes/qrcodse.png', $fpdf->GetX(), $fpdf->GetY(), 30),1,0,'',false);
            $fpdf->Ln(33);

        $fpdf->Cell(65,30,$fpdf->Image('assets/images/qrcodes/qrcodse.png', $fpdf->GetX(), $fpdf->GetY(), 30),1,0,'',false);
            $fpdf->cell(10,30,'',0,0,'');
        $fpdf->Cell(65,30,$fpdf->Image('assets/images/qrcodes/qrcodse.png', $fpdf->GetX(), $fpdf->GetY(), 30),1,0,'',false);
            $fpdf->Ln(33);

        $fpdf->Cell(65,30,$fpdf->Image('assets/images/qrcodes/qrcodse.png', $fpdf->GetX(), $fpdf->GetY(), 30),1,0,'',false);
            $fpdf->cell(10,30,'',0,0,'');
        $fpdf->Cell(65,30,$fpdf->Image('assets/images/qrcodes/qrcodse.png', $fpdf->GetX(), $fpdf->GetY(), 30),1,0,'',false);
            $fpdf->Ln(33);

        $fpdf->Cell(65,30,$fpdf->Image('assets/images/qrcodes/qrcodse.png', $fpdf->GetX(), $fpdf->GetY(), 30),1,0,'',false);
            $fpdf->cell(10,30,'',0,0,'');
        $fpdf->Cell(65,30,$fpdf->Image('assets/images/qrcodes/qrcodse.png', $fpdf->GetX(), $fpdf->GetY(), 30),1,0,'',false);
            $fpdf->Ln(33);

它只是循环相同的 CELL 函数

谢谢!!!

最佳答案

Cell() 方法需要一个字符串作为其第三个参数。而 Image() 方法不返回任何内容。

该文字:您不能以这种方式将图像放入单元格中。它没有达到您的预期。

只需将 Image() 调用移到每个 Cell() 调用之前,您将看不到任何差异。

您看到的分页符被触发,因为后面的 Cell() 调用正在触发它。您可以禁用它或通过SetAutoPageBreak()设置另一个底部边距值。方法:

$fpdf->SetAutoPageBreak(false);
// or
$fpdf->SetAutoPageBreak(true, 0);

如果禁用它,您将需要自己添加页面。

关于javascript - FPDF 将图像放入 CELL 时出现奇怪的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48931347/

相关文章:

javascript - div 的响应能力

javascript - 将值传递给nodejs中的回调

javascript - 如何在 JavaScript 中的浏览器中检查 pdf 文件是否为美国法律或美国信函格式

php - WordPress 页面内容风格与编辑器风格不同

php - mysqli_fetch_array在已部署的服务器上不起作用

php - 在mysql数据库中存储值时改变盐的值

从一个边缘到另一个边缘的 CSS 过渡位置绝对

javascript - 如何使用 Node.js Request 模块处理对 Github API 的多页请求?

html - CSS 媒体查询是否加载所有引用的 css?

javascript - 对复选框执行操作