Albert
Albert

Reputation: 1

PHP: word wrap the text inside the PDF?

Would you know how to word wrap the text inside the PDF? I am using an array like:

$email_message =" fax: ".clean_string($fax)."\n
"; $email_message .=" address: ".clean_string($address)."\n
"; $email_message .=" email: ".clean_string($email)."\n
";

but the break tags show up within the PDF, I would like each one to go on a new line. I am using FPDF & Pear's Mime classes to generate the PDF.

Upvotes: 0

Views: 1903

Answers (1)

ctrldel
ctrldel

Reputation: 33

with a loop you can go through the

$posY = $pdf->GetY();
$nl = 4.5;
$temptext = explode("\n",$email_message );
foreach($temptext as $newline) {
    $pdf->Text(10,$posY+$nl,$newline);
    $nl += 4.5;
}

Upvotes: 2

Related Questions