簡體   English   中英

如何將圖像推送到單元格 PHP FPDF 中?

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM