简体   繁体   English

TCPDF:多单元内的更多图像

[英]TCPDF: more image inside multicell

is it possible to put multiple images inside a MultiCell in TCPDF? 是否可以在TCPDF的MultiCell中放置多个图像? i tried with this code: 我尝试使用此代码:

$imgArray = array();
for ($i = 0; $i < 4; $i++) {
    $imgArray[] = $pdf->Image(IMGS . 'nd.jpg', '', '', 39, 40);
}
$pdf->MultiCell($wLeft, $hRows, implode($imgArray), 0, 'L', FALSE, 0, '', '', TRUE);

but i see only one image, and at the top of the image there are three zeros. 但我只看到一张图片,在图片的顶部有三个零。 i didn't find any example on the web! 我在网上找不到任何示例!

You can use writeHTMLCell() and <img /> tag like this : 您可以像这样使用writeHTMLCell()<img />标签:

for ($i = 0; $i < 4; $i++) 
    $imgs .= '<img src="'.IMGS.'nd.jpg"/>';

$pdf->writeHTMLCell(170, null, 10, 10, $imgs."\n");

If you want to use Image() , set position of each image : 如果要使用Image() ,请设置每个图像的位置:

for ($i = 0; $i < 4; $i++) {
    $pdf->Image(IMGS . 'nd.jpg', ($i * 39), 10, 39, 40);

In this example, you use $i to set horizontal (x) position. 在此示例中,使用$i设置水平(x)位置。 If your image width is 39, each image will be side by side. 如果您的图像宽度为39,则每张图像将并排放置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM