Heads up!
This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or 3rd party development.
This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or 3rd party development.
Use this hook to handle PDF pagination.
Usage
add_action( 'frm_pdfs_after_render', 'pdfs_add_pagination' );
Parameters
- $dompdf (object)
Examples
Add custom pagination
Use this code example to customize the pagination. When customizing, you will need to read the DOMPDF documentation.
add_action( 'frm_pdfs_after_render', 'pdfs_add_pagination' );
function pdfs_add_pagination( $dompdf ) {
$canvas = $dompdf->getCanvas(); // get the canvas
// Add the page number and total number of pages
$canvas->page_script('
$text = "$PAGE_NUM / $PAGE_COUNT";
$pdf->text(35, 15, $text, \'Helvetica\', 10, array(0,0,0));
');
}