1

イメージと詳細の両方が並べて表示されるように、イメージを含むセルを、イメージに関連する詳細を含むマルチセルと整列させようとしています。Webを検索した後、私はそれを行ういくつかの方法を見つけました。(データベースから詳細を呼び出しました):

$pdf = new PDF();
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFont('Times','',12);
$image_height = 37;
$image_width = 37;


foreach($inventories as $key => $inventories) :

    $image = $inventories['image'];
    $resourceID = $inventories['resourceID'];
    $learningcentre = $inventories['learningcentre'];
    $title = $inventories['title'];
    $quantity = $inventories['quantity'];
    $description = $inventories['description'];

  $pdf->Cell( 40, 20, $pdf->Image($imagesDirectory.$image, $pdf->GetX(), $pdf->GetY(), $image_height, $image_width), 0, 0, 'L');
  $pdf->MultiCell(140,8,$resourceID."\n".$title."\n".$learningcentre."\n".$quantity."\n".$description, 1,1);
  $pdf->Ln();

 endforeach; 

ただし、結果がページの最後に達すると、下の図に示すように、画像が途切れて詳細セルが次のページにプッシュされます。

出力画像

私は FPDF を初めて使用し、解決策を探していましたが、役に立ちませんでした。どんな助けでも大歓迎です.Thanks!

4

1 に答える 1

0

私自身は FPDF 初心者ですが、AcceptPageBreak 関数を試しましたか?

このようなもの(fpdf Webサイトからコピー):

function AcceptPageBreak()
{
    // Method accepting or not automatic page break
    if($this->col<2)
    {
    // Go to next column
    $this->SetCol($this->col+1);
    // Set ordinate to top
    $this->SetY($this->y0);
    // Keep on page
    return false;
    }
    else
    {
    // Go back to first column
    $this->SetCol(0);
    // Page break
    return true;
    }
}

参考として、fpdf チュートリアルは非常に役に立ちます。特にこれは、あなたがしていることに役立つと思います。

于 2013-09-05T19:41:44.150 に答える