Jump to content

FPDF Help


bornaway

Recommended Posts

Hi All,

 

New here to PHP. Was designing a pdf file using FPDF. Here is my problem:

 

I want to display a table. I want to have rows and columns. For example the code below gives me one row perfectly:

 


$this->SetFont('Arial','',10);

            // Logo
            //$this->Image(SETTING_MAIN_URL . 'images/logo.png',10,19,33);
            $this->Image($this->image_folder . 'pdf_logo.png',10,5,33);
            
            // Right hand header
            $this->SetFont('Arial','B',13);
            $this->Text(45,14,"test test test");
            $this->SetFont('','',10);
             
            $this->Text(10,22,"Account: ");
            $this->Text(25,22,Sessionmanager::getUser()->getAccount());
            $this->Text(10,27,"Date: ");
            $this->Text(20,27,$today = date("m.d.y"));
            $this->Ln(20);
        
            $this->Cell(30,7,"Number",1,0,'L');
            $this->Cell(33,7,"NAME",1);
            $this->Cell(33,7,"address",1);
            $this->Cell(33,7,"address2",1);
            $this->Cell(33,7,"address3",1);
            $this->Cell(33,7,"country",1);

            $this->Ln(10);
             $i=0;
             $this->SetFont('Arial','B',5);
             for($i=0;$i<sizeof($this->list);$i++)
             {
               $consignment= $this->list[$i];
               $this->Cell(33,7,$consignment->getBIll(),1,'L');
               $this->Cell(33,7,"asdfasdfasdf",1,'L');
               $this->MultiCell(33,7,$consignment->getCom()."\n".$consignment->AddressLine1()."\n".$consignment->getAddressLine2()."\n".$consignment->getCity()."\n".$consignment->getCountry(),1,'L'); 
              $this->Ln(1);  



 

Now When I add this line to the code just before $this->Ln(1)

             

$this->Cell(33,7,"test 4",'L');

 

It goes to a new line for some reason even before i call the $this->Ln().

 

Any ideas? I want to display the "test4" in the same row too.

 

So i guess my question basically is that i dont understand how fpdf distinguishes between when to switch to a new row and when to keep on adding to the same row.

 

Thank you very much for your help.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.