php-tcpdfHow do I set footer data using PHP TCPDF?
To set footer data using PHP TCPDF, first we need to create a new TCPDF instance by passing the page size, orientation and unit.
$pdf = new TCPDF('P', 'mm', 'A4', true, 'UTF-8', false);
Then we need to set the PDF's page margins.
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
After that, we can set the header and footer by using the setHeaderData() and setFooterData() methods.
// set header data
$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 001', PDF_HEADER_STRING);
// set footer data
$pdf->setFooterData(array(0,64,0), array(0,64,128));
The setHeaderData() and setFooterData() methods take two parameters. The first parameter is an array of RGB values for the background color. The second parameter is an array of RGB values for the text color.
Finally, we can set the font for the footer data.
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
Helpful links
More of Php Tcpdf
- How can I generate a QR code using PHP and TCPDF?
- How can I use TCPDF's writeHTML() function in PHP?
- How do I install TCPDF using Yum on a PHP server?
- How can I use PHP and TCPDF to read a PDF?
- How can I output a PDF file using PHP and TCPDF?
- How do I set the margins using PHP TCPDF?
- How do I create a table in TCPDF using MySQL data?
- How can I use PHP and TCPDF to merge multiple PDFs into one?
- How do I install TCPDF with Composer in a PHP project?
- How do I use the setxy function in PHP TCPDF?
See more codes...