Text without space isn't wrapped with getTextCell function
Describe the bug Text without spaces isn't wrapped in cell.
To Reproduce Steps to reproduce the behavior:
- Insert text without spaces with getTextCell
$pdf->getTextCell(
'GENTEST-CREATE-NEW-2-BIS-CA',
$docPosition['x'] + $label->getLeft(),
$docPosition['y'],
$label->getInnerWidth(),
$skuHeight, // float $height = 0,
0, // float $offset = 0,
0, // float $linespace = 0,
'T', // string $valign = 'C',
'L', // string $halign = 'C',
null, // ?array $cell = null,
[], // array $styles = [],
0, // float $strokewidth = 0,
0, // float $wordspacing = 0,
0, // float $leading = 0,
0, // float $rise = 0,
true, // bool $jlast = true,
true, // bool $fill = true,
false, // bool $stroke = false,
false, // bool $clip = false,
true, // bool $drawcell = true,
);
- PDF is stored in file :
$fs = new Filesystem();
$tempName = $fs->tempnam(\sys_get_temp_dir(), 'barcode_session_product_');
$fs->appendToFile($tempName, $pdf->getOutPDFString());
- Display PDF with Symfony's BinaryFileResponse :
$displayFile = u($session->getName())
->ensureStart('barcode_session_product_')->snake()->ensureEnd('.pdf')
->toString();
return $this->file($tempName, $displayFile, ResponseHeaderBag::DISPOSITION_INLINE);
Expected behavior Text has to be wrapped in cell to fit the width.
Environment:
- OS: macOS 13.6.7
- PHP version: 8.3.3
- Symfony version: 7.0.7
Additional context I want to edit labels (24 per page model) with SKU and barcode.
Since version 8.0.62 you can use the enableZeroWidthBreakPoints function as in the example: https://github.com/tecnickcom/tc-lib-pdf/blob/main/examples/index.php#L1299
This version also support text hyphenation (see the example).
Hello @nicolaasuni
Thanks for your reply, your patch seems OK.
I revert my code to TCPDF since my issue.
When do you think this project will be stable to use it in production ?
The current library is already usable. Some advanced features are yet to be ported. I have updated the README.md with some info...