We help IT Professionals succeed at work.
Get Started

FPDF word wrapping?

musickmann asked
Last Modified: 2012-05-09
I've got this employment application with some fields that vary in length with each application. I have a previous employee section where the applicant lists their duties, this can be some long text of course, so I'm trying to get the FPDF that is created from the application to expand as necessary and insert line returns as needed as well.

Right now, I've set up the cell to be taller than the others, a text box if you will, but the program puts the response on one line that just runs out of the side of the box. How can I get the FPDF program to accommodate the extra lines properly?

I'm attaching the code that goes with the section of the form I'm having a problem with, FPDF is sorta new to me. I'm also attaching the section of the generated PDF so you can see the issue.  page2.pdf

Thanks for any help here!
$count = count($_POST['PrevEmpName1']);
        while($x < $count){
        if($count == 1){
          $emp = $_POST['PrevEmpName1'];
          $emploc = $_POST['PrevEmpLoc1'];
          $empphone = $_POST['PrevEmpPhone1'];
          $empdf = $_POST['PrevEmpDateFrom1'];
          $empdt = $_POST['PrevEmpDateTo1'];
          $empsup = $_POST['PrevEmpSuper1'];
          $empjo = $_POST['PrevEmpJob1'];
          $empjd = $_POST['PrevEmpJobDuty1'];
          $emplv = $_POST['PrevEmpLeave1'];
          $emp = $_POST['PrevEmpName1'][$x];
          $emploc = $_POST['PrevEmpLoc1'][$x];
          $empphone = $_POST['PrevEmpPhone1'][$x];
          $empdf = $_POST['PrevEmpDateFrom1'][$x];
          $empdt = $_POST['PrevEmpDateTo1'][$x];
          $empsup = $_POST['PrevEmpSuper1'][$x];
          $empjo = $_POST['PrevEmpJob1'][$x];
          $empjd = $_POST['PrevEmpJobDuty1'][$x];
          $emplv = $_POST['PrevEmpLeave1'][$x];
        $this->Cell(40,6,'Employer Name',1);
        $this->Cell(20,6,'From Date',1);
        $this->Cell(20,6,'To Date',1);
        $this->Cell(60,6,'Reason for leaving',1);

Open in new window

Watch Question
This problem has been solved!
Unlock 1 Answer and 7 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE