This function is not supported in "PDFlib Lite" extension which is mostly been used by PHP-programmers.
(PECL pdflib >= 2.0.0)
PDF_fit_textflow — Format textflow in rectangular area
string PDF_fit_textflow ( resource
Formats the next portion of a textflow into a rectangular area.
add a note User Contributed Notes PDF_fit_textflow - [3 notes]
5 years ago
ctemple at xadvance dot com ¶
6 years ago
This is an excerpt of code from the PDFlib Manual that has been modfied for PHP. It fulfills the very common need to have a textflow extend accross multiple pages.
$pdf is the PDF file resource. You may want to modify the page size (this is letter size) or the position of the textflow itself.
$thetext = "INSERT YOUR MULTI-PAGE TEXT HERE";
$textflow = PDF_create_textflow($pdf, $thetext, "fontname=Tahoma fontsize=9 encoding=winansi");
PDF_begin_page_ext($pdf, 612, 792, "");
$result = PDF_fit_textflow($pdf, $textflow, 50, 120, 550, 720, "");
} while (strcmp($result, "_stop"));
If you have any templates or pagination that need to be placed on each page, they can go within the do/while loop itself, between the begin_page and end_page functions.
7 years ago
to plant an singel line with an alignment
$textflow = pdf_create_textflow($pdf, "test 123\nfoo baaa", 'fontname=Helvetica fontsize=12 encoding=iso8859-1 alignment=right');
pdf_fit_textflow ($pdf, $textflow, 400, 100, 550, 200, '');