PHP 7.1.18 Released


(PECL pdflib >= 2.1.0)

PDF_info_textlineLlevar a cabo el formateo textline y preguntar por las métricas


float PDF_info_textline ( resource $pdfdoc , string $text , string $keyword , string $optlist )

Lleva a cabo el formateo textline y pregunta por las métricas resultantes.

add a note add a note

User Contributed Notes 1 note

8 years ago
You can use PDF_info_textline to center some text in the page.

Here's a little function

// Parameters:
// $p -> the PDF handle
// $text -> the text to center
// $posy -> the vertical position of the text
// $pageWidth -> the width of the page, defaults to 595 (A4)
function center_text($p, $text, $posy, $pageWidth=595)
$width = PDF_info_textline($p, $text, 'width', '');
PDF_fit_textline($p, $text, ($pageWidth-$width)/2, $posy, '');
To Top