Skip to content
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

Question on adding multiple text parts with automatic page break #119

Open
gruberroland opened this issue Oct 29, 2024 · 0 comments
Open

Comments

@gruberroland
Copy link

Hi,

I need to dynamically add several text cells on the page. The cells should be one after the other with automatic page breaking when the page ends. How is this typically done with the new library? So far, I tried adding text cells with "posy" = last bbox' "y" + "h" values. But this does not trigger a page break.

$bbox = $pdf->getLastBBox();
$text = $pdf->getTextCell(
	"$i Lorem ipsum dolor sit amet, consetetur sadipscing elitr.",
	15,
	($bbox['y'] + $bbox['h'] + $pdf->toUnit($font['ascent']))
);
$pdf->page->addContent($text);

To activate automatic page breaking I use this:

$pageFormat = [
	'format' => 'A4',
	'orientation' => 'P',
	'autobreak' => true,
	'margin' => [
		'PL' => 10,
		'PR' => 35,
		'PT' => 10
	]
];
$pdf->addPage($pageFormat);

Do I use the page format in a wrong way?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant