如何在 magento 中用 drawText() 写新行?
How to write new line with drawText() in magento?
我正在尝试使用 Magento 函数换行 drawText();
我正在尝试下面的代码,但它显示了所有语句,例如 Line 1! \n Line 1!
谁能告诉我如何使用以下代码打印多个新行。
$page->drawText(Mage::helper('sales')->__('Line 1! \n Line 1!'), 35, $this->y, 'UTF-8');
按照此 - PHP + PDF Line Break
为每一行单独调用 $page->drawText
$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;
}
}
我正在尝试使用 Magento 函数换行 drawText();
我正在尝试下面的代码,但它显示了所有语句,例如 Line 1! \n Line 1!
谁能告诉我如何使用以下代码打印多个新行。
$page->drawText(Mage::helper('sales')->__('Line 1! \n Line 1!'), 35, $this->y, 'UTF-8');
按照此 - PHP + PDF Line Break
为每一行单独调用 $page->drawText $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;
}
}