tags:

views:

325

answers:

1

I have a very specific 2 column layout I'm trying to set up for a client using TCPDF. AutoPageBreak works fine if you're sending text to a page with writeHTML and multiCell at the default width of the page. When I set a narrower width for a multiCell TCPDF doesn't know when to page break. This is driving me insane.

Here's super simple example set up here:

http://www.artworknotavailable.com/temp/tcpdf/

A: 

Oh. God. I think I just figured it out. I'm gonna shoot myself now.

int MultiCell( float $w, float $h, string $txt, 
              [mixed $border = 0], [string $align = 'J'], [int $fill = 0], 
              [int $ln = 1], [float $x = ''], [float $y = ''], 
              [boolean $reseth = true], [int $stretch = 0], 
              [boolean $ishtml = false], [boolean $autopadding = true], 
              [float $maxh = 0])

I've been setting $ln to 0 because I've just been passing null values like so.

bad:

$pdf->MultiCell(100,'',$page1,0,'R','','','','','','',true);

better:

$pdf->MultiCell(100,'2',$page1,1,'L','',1,'','','','',true);
kenitech
TCPDF is a bit rickety. The function (MultiCell) with 14 arguments should give that away. It's a smell called "Long Parameter List" (See http://wiki.java.net/bin/view/People/SmellsToRefactorings.)
Ewan Todd