From: Ben Pfaff Date: Sun, 27 Dec 2020 01:54:07 +0000 (-0800) Subject: cairo: Label pages in PDFs with page numbers. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=56a9bab76d340530048bf0dea1e858701299fa29;p=pspp cairo: Label pages in PDFs with page numbers. These normally wouldn't do much, but PSPP does support an "initial page number" setting, and if that is set to anything but 1 then it will make a difference. --- diff --git a/src/output/cairo-pager.c b/src/output/cairo-pager.c index 6249a3ab8e..1ab481f0c3 100644 --- a/src/output/cairo-pager.c +++ b/src/output/cairo-pager.c @@ -322,6 +322,14 @@ xr_pager_add_page (struct xr_pager *p, cairo_t *cr) fs->size[H], fs->size[V] + ps->object_spacing, fs->font_resolution); + cairo_surface_t *surface = cairo_get_target (cr); + if (cairo_surface_get_type (surface) == CAIRO_SURFACE_TYPE_PDF) + { + char *page_label = xasprintf ("%d", page_number); + cairo_pdf_surface_set_page_label (surface, page_label); + free (page_label); + } + xr_pager_run (p); }