开发者

fpdf alignment of cells

I'm trying to generate a PDF using fpdf and I'm having a small problem

I need to 开发者_如何转开发have 2 cells, like the following:

-------------------------  -------------------------
|  Address Line 1          |       Version         |
|  Address Line 2          |         1.0           |
|  City                    |       06/05/2011      | 
-------------------------  -------------------------

I've tried using MultiCell() but with no luck.

$address = '
    Address Line 1
    Address Line 2
    City
    Postcode';
$pdf->MultiCell(133.5, 2.7, $address, 'L', 'L');

$version = '
    Version 
    1.0
    06/05/2011';
$pdf->MultiCell(53.5, 2.7, $version, 'R', 'R');

I thought that I could possibly set the 'float' as it was left or right, which is what the docs say, but this doesn't seem to work. It just lists the Version multicell below the address and not to the right of it.

Does anyone have any idea why this would be?

Thanks


http://www.fpdf.org/en/tutorial/tuto5.htm:

Just use:

$pdf->Cell(width, height, text, border, position-next-cell, alignment);

So this means, to add a column afterwards 'position-next-cell' should be 0 what you're looking for is probably:

$pdf->Cell(133.5, 2.7, $address, 0, 0, 'L');
$pdf->Cell(53.5, 2.7, $version, 0, 1, 'L');

After the 2nd call you noticed the 1 which means a next cell is being placed underneath and not after (which the 0 would do.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜