Reputation: 2088
I am trying to put a new line with the Magento function drawText();
I was trying the code below but it showing all statement like Line 1! \n Line 1!
Can anyone tell me how I can print multiple new lines using the following code.
$page->drawText(Mage::helper('sales')->__('Line 1! \n Line 1!'), 35, $this->y, 'UTF-8');
Upvotes: 1
Views: 1656
Reputation: 1435
Do a separate call to $page->drawText for each line, as per this - PHP + PDF Line Break
$textChunk = wordwrap($value, 20, "\n");
foreach(explode("\n", $textChunk) as $textLine){
if ($value!=='') {
$page->drawText(strip_tags(ltrim($textLine)), 75, $line, 'UTF-8');
$line -=14;
}
}
Upvotes: 1