[英]How can I push the image in the cell PHP FPDF?
大家好,stackoverflow 中的每个人。 我今天整天都在努力解决这个问题。 正如您在下面的图像中看到的,二维码不在列中。 这发生在最后一行的所有页面上。 我还将附上我的代码。 请检查我的代码是否有问题。 计数器将显示一行三列相同的数据。
<?php
include('../Connection/connection.php');
require('../FPDF/fpdf.php');
$QueryCustomer = "SELECT cus_name, cus_qr FROM tbl_customer WHERE cus_status = 1 AND cus_type = 1";
$ResultQueryCustomer = mysqli_query($con,$QueryCustomer);
$RowQueryCustomer = mysqli_num_rows($ResultQueryCustomer);
$QueryWebConfig = "SELECT * FROM tbl_web_config";
$ResultQueryWebConfig = mysqli_query($con,$QueryWebConfig);
$RowQueryWebConfig = mysqli_num_rows($ResultQueryWebConfig);
$ResQueryWebConfig = mysqli_fetch_array($ResultQueryWebConfig);
$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','',8);
$counter = 0;
while($ResQueryCustomer = mysqli_fetch_array($ResultQueryCustomer)){
$pdf->Image("../CustomerQr/".$ResQueryCustomer['cus_qr'].".png", $pdf->GetX(), $pdf->GetY(), 40);
$pdf->Cell( 65, 80,$ResQueryCustomer['cus_name'],1);
$counter++;
if($counter % 3 == 0)
{
$pdf->Ln();
}
}
$pdf->Output();
?>
在 output 图像和单元格之前移动您的计数器并测试所需的新页面。 您还没有发布整页的样子,但看起来好像图像大到足以导致页面溢出,但您不会移动到新页面,直到它已经是 output。
while($ResQueryCustomer = mysqli_fetch_array($ResultQueryCustomer)){
$counter++;
if($counter % 3 == 0) {
$pdf->Ln();
}
$pdf->Image("../CustomerQr/".$ResQueryCustomer['cus_qr'].".png", $pdf->GetX(), $pdf->GetY(), 40);
$pdf->Cell( 65, 80,$ResQueryCustomer['cus_name'],1);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.