I've been trying the following code to add a break line when a product title has more than 60 characters:
if ($item->getProductType() == 'bundle') {
foreach ($item->getChildren() as $child) {
$childProduct = $this->productRepositoryInterface->getById(
$child->getProductId(),
false,
$quote->getStoreId()
);
$childName = $childProduct->getName();
$bundleText[] = $childName;
}
$line[] = [
'text' => wordwrap($childName,60,"<br>\n"),
'feed' => $feed + 10,
'isProductLine' => true,
'addToTop' => 5,
'font' => 'regular',
'font_size' => $fontSize
];
}
$optionLineCount = 0;
if (isset($optionText)) {
$optionLineCount += count($optionText);
}
if (isset($bundleText)) {
$optionLineCount += count($bundleText);
}
The result of this is (unwanted result):
RSM-408A: 8-Port Real-time Redundant Ring Switch with metal<br> case (+12 ~ +48 VDC, non-isolation)
Instead of (the desired result):
RSM-408A: 8-Port Real-time Redundant Ring Switch with metal
case (+12 ~ +48 VDC, non-isolation)
Any ideas of what i'm still missing?
` does not work in pdf's. I'm quite sure you need to use `"\n"` – Andreas Nov 27 '19 at 07:58
` tag is, Maybe you looking for `\r` – slier Nov 27 '19 at 07:58
` – Shiz Nov 27 '19 at 07:59
still does not render the desired result – Julian Murillo Nov 27 '19 at 08:33