-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Write() does not wrap if the line ends with bold text just before the specified page margin. #650
Comments
Basically, it boils down to the |
I have a similar issue, but it doesn't require any text formatting at the end of the line. Text of a certain size will get up to the boundary of the max page width (less margins) and not trigger wrapping. All remaining text vanishes. Doing something to purposely trigger a word wrap, such as adding extra spaces, will fix the issue. Similarly, disabling line 6448 (6.7.5) solves the issue, but as @DerPapst says, it must be there for a reason and removing it may cause other issues. |
This will reproduce the issue without any formatting changes. I think the formatting changes are potentially a red herring: <?php
require_once(__DIR__.'/vendor/autoload.php');
$content = [
['Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmodx', ''],
['tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.', ''],
];
$pdf = new TCPDF();
$pdf->setLeftMargin(26);
$pdf->setRightMargin(26);
$pdf->addPage();
foreach ($content as $item) {
$pdf->Write($pdf->getFontSizePt() / 2, $item[0]);
}
$pdf->Output(); |
You can change Exhibits the issue: $content = [
['Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmodxl', ''],
['tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.', ''],
]; Does NOT exhibit the issue: $content = [
['Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmodxll', ''],
['tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.', ''],
]; |
This seems like some sort of boundary edge case. |
@williamdes @nicolaasuni possible to get someone to take a look and at least verify it is reproducible by others? |
When a line ends just before the specified page margin with bold text, additional text appended with Write() is clipped.
Steps to reproduce this issue (include TCPDF with composer):
Result:
Expected result:
![should be](https://private-user-images.githubusercontent.com/2511615/272013633-ec953ff5-babd-44c5-a73e-92bbc5d36e9b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjEzOTg3MTYsIm5iZiI6MTcyMTM5ODQxNiwicGF0aCI6Ii8yNTExNjE1LzI3MjAxMzYzMy1lYzk1M2ZmNS1iYWJkLTQ0YzUtYTczZS05MmJiYzVkMzZlOWIucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDcxOSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA3MTlUMTQxMzM2WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NmM0MjA1NTI5ZGMyNzA1ZTQ0ZDM5NmFmODBmNTE2YjI1YzE4MDg0YzJhNjNjYmJlOGVhNTFmNmE4OTk2YmU5MyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.alByyNY75-7Q1504lQ3AHWZLdeJAf4ZCaHT9M6OmVmY)
The text was updated successfully, but these errors were encountered: