2014-04-01 125 views
1

我有TCPDF和SVG圖像的問題。PHP - tcpdf multiCell image

我需要視野圖像中細胞作爲表(例如3個COLS和許多行)。在生成的PDF

圖像上新的生產線,而不是掌握。

我的代碼:

public function addImage($fileName){ 
    $this->x=$this->_pdfObject->getX(); 
    $this->y=$this->_pdfObject->getY(); 

    $this->_pdfObject->setXY($this->x, $this->y); 

    $this->_pdfObject->MultiCell(0, 0, '<img src="'.$fileName.'">', 0, 'L', 0, 1, '', '', true, null, true); 

}

你能幫助我嗎? 謝謝。

回答

0

您在單元寫入PDF文件,你可以讓引擎知道應該在哪裏新的細胞被寫入(或者你想要的指針去)每次。 和MultiCell()中的屬性$ln正在控制這一點。有三種可能的值是:

0 - leave the pointer after the written cell 
1 - move to new line and to the left side of page (or right in RTL documents) 
2 - move the pointer below 

Cell()功能的默認值是0,在MultiCell()默認爲1

所以寫在一行多個mulitcell你應該使用:

$this->_pdfObject->MultiCell(0, 0, '<img src="'.$fileName.'">', 0, 'L', 0, 0, '', '', true, null, true); 

注意0作爲第七參數。

一旦在一行上寫入不同的單元格,您可以使用Ln()將指針移至新行並向左(或在RTL模式下右移)。