Page 1 of 1

[SOLVED]TCPDF alignment issue

Posted: Wed Nov 05, 2008 1:35 am
by Rovas
I work the TCPDF "library" to make a pdf with a certain layout: two tables that contain data and between them a text line. Similar to this:

Code: Select all

   Table 1:   | image | | first section of data | | second section of data | 
                                   | centered text | 
    Table 2:        
                   | cell 1 data | | cell 2 data | | cell 3 data |   
                   | cell 4 data | | cell 5 data | | cell 5 data |   
                    .......other cells.....
 
The problem is that the line of text, represented in the figure by |centered text|, isn' t centered but is in the right side of the page.
The code is the following

Code: Select all

 
//Begin Table 1
//the image 
$pdf->Image($logo,9,10); 
// first section of data  
$pdf->setLeftMargin(35); 
$pdf->MultiCell(80,10,$addr,"",2,"L",0); 
// second section of data  
$pdf->setLeftMargin(110); 
$pdf->MultiCell(100,16,$text_2,0,"L",0,2,'','',true,0,false); 
//End Table1
//title 
$heightClient=round($pdf->getLastH()); 
$itiermarg=$heightClient+13; 
$pdf->setY($itiermarg); 
$pdf->setLeftMargin(0); 
$pdf->Cell(200,20,$title,"",0,"C","0","",0); 
//Table 2 
$itiermarg=$itiermarg+17;
$pdf->setMargins(31,10,0);
$pdf->setY($itiermarg);
$pdf->Cell(120,0,$servi,"LTRB",0,"C","0","",0);
$pdf->Cell(15,0,$tim,"LTRB",0,"C","0","",0);
$pdf->Cell(20,0,$value,"LTRB",0,"C","0","",0);
//and the following rows that are in a similar manner
 
EDIT Solve changing to MultiCell and positioning it:

Code: Select all

 
        //to better position it
    $pdf->setLeftMargin(0);
    $pdf->setRightMargin(120);
        $pdf->MultiCell((200,20,$title);