Adding page numbers in footer in pdf

Created on 29 October 2016, about 8 years ago
Updated 9 May 2024, 7 months ago

I think that It would be nice if there si posible to add page numbers in footer for dompdf.

My suggestion is that there is an option in the configuration (check box) if you want to have page number or no.

Also to have a drop-down list to position page number (center, left, right)

Or maybe It is better to create a template entity-print-footer.html.twig where you would stype your page number.

Because dompdf is:

dompdf is an HTML to PDF converter. At its heart, dompdf is (mostly) CSS2.1 compliant HTML layout and rendering engine written in PHP. It is a style-driven renderer: it will download and read external stylesheets, inline style tags, and the style attributes of individual HTML elements. It also supports most presentational HTML attributes.

it's probably best that its done through template.

$dompdf = new DOMPDF();
$domdpf->load_html($html);
$dompdf->render();

$font = Font_Metrics::get_font("helvetica", "bold");
$dompdf->get_canvas()->page_text(72, 18, "Header: {PAGE_NUM} of {PAGE_COUNT}", $font, 6, array(0,0,0));

$dompdf->stream();

What do you think of my idea?

Feature request
Status

Active

Version

2.0

Component

Code

Created by

🇷🇸Serbia SakaSerbia

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024