I am trying to new line with magento function drawText(); I was tried below code but it showing all statement like Line 1! \n Line 1!

can any body tell me how do i print multiple new lines using below code.

 $page->drawText(Mage::helper('sales')->__('Line 1! \n Line 1!'), 35, $this->y, 'UTF-8');

do a separate call to $page->drawText for each line.

So for example something like this.

$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;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.