Olá pessoal!
Eu resolvi esta questão:
Peguei em um fórum estrangeiro um código exemplo e coloquei na minha biblioteca externa:
[code]public function MultiRow($columnsArray) {
$page_start = $this->getPage();
$y_start = $this->GetY();
$pageArray = array();
$yArray = array();
// traverse through array and print one column at a time.
$columnCount = count($columnsArray);
for($i=0; $i<$columnCount; $i++)
{
if($i+1 < $columnCount)
{
// Current column is not the last column in the row.
// After printing, the pointer will be moved down to
// the right-bottom of the column - from where the
// next multiCell in the following loop will use it
// via $this->GetX().
$ln = 2;
}
else
{
// Current column is the last column in the row.
// After printing, the pointer will be moved to new line.
$ln = 1;
}
$this->MultiCell($width = 200,
$heigth = 0,
$text = $columnsArray[$i],
$border = 0,
$align = 'L',
$fill = false,
$ln = $ln,
$x = $this->GetX(),
$y = $y_start,
$reseth = true,
$stretch = 0,
$ishtml = false,
$autopadding = true,
$maxh = 0,
$valign = 'T',
$fitcell = false
);
$pageArray[$i] = $this->getPage();
$yArray[$i] = $this->GetY();
// Go to page where the row started - to print the
// next column (if any).
$this->setPage($page_start);
}
// Test if all columns ended on the same page
$samePage = true;
foreach ($pageArray as $val) {
if($val != $pageArray['0'])
{
$samePage = false;
break;
}
}
// Set the new page and row position by case
if($samePage == true)
{
// All columns ended on the same page.
// Get the longest column.
$newY = max($yArray);
}
else
{
// Some columns ended on different pages.
// Get the array-keys (not the values) of all columns that
// ended on the last page.
$endPageKeys = array_keys($pageArray, max($pageArray));
// Get the Y values of all columns that ended on the last page,
// i.e. get the Y values of all columns with keys in $endPageKeys.
$yValues = array();
foreach($endPageKeys as $key)
{
$yValues[] = $yArray[$key];
}
// Get the largest Y value of all columns that ended on
// the last page.
$newY = max($yValues);
}
// Go to the last page and start at its largets Y value
$this->setPage(max($pageArray));
$this->SetXY($this->GetX(),$newY);
}
[/code]
Depois utilizei assim:
$var_OrcObs_array = array($var_OrcObs);
$pdf->MultiRow($var_OrcObs_array);
onde o $var_OrcObs é um campo tipo text na base de dados MySql.
Este exemplo tem apenas para uma coluna, que no meu caso era isso que precisava.
Segue abaixo o link onde consegui o código:
http://stackoverflow.com/questions/1078729/how-to-calculate-the-height-of-a-multicell-writehtmlcell-in-tcpdf