summaryrefslogtreecommitdiff
path: root/src/cairo-pdf-surface.c
diff options
context:
space:
mode:
authorAdrian Johnson <ajohnson@redneon.com>2021-07-24 21:26:22 +0930
committerAdrian Johnson <ajohnson@redneon.com>2021-07-24 21:33:09 +0930
commitf7c7bcb6030aa36677adcc4887c8f9f8964431d6 (patch)
tree50c40a46d769f202e239263a99d0f43080f70104 /src/cairo-pdf-surface.c
parent994eccefc0a778d291a8dbbb4143280b38a7ad80 (diff)
downloadcairo-f7c7bcb6030aa36677adcc4887c8f9f8964431d6.tar.gz
tags: allow links to page numbers not yet created
Previously, forward references were required to use named destinations. This patch is based on the patch in #336 by Guillaume Ayoub <guillaume.ayoub@kozea.fr> that converted all links to indirect objects written at the end of the document. I have reworked the patch so that only forward references to future page numbers are written as indirect objects. Backward references and named destinations remain as they are. This is to minimize the number of objects written to the PDF file. Fixes #336
Diffstat (limited to 'src/cairo-pdf-surface.c')
-rw-r--r--src/cairo-pdf-surface.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index f2463a8c3..a9caed8ff 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -493,6 +493,7 @@ _cairo_pdf_surface_create_for_stream_internal (cairo_output_stream_t *output,
surface->page_parent_tree = -1;
_cairo_array_init (&surface->page_annots, sizeof (cairo_pdf_resource_t));
+ _cairo_array_init (&surface->forward_links, sizeof (cairo_pdf_forward_link_t));
surface->tagged = FALSE;
surface->current_page_label = NULL;
_cairo_array_init (&surface->page_labels, sizeof (char *));
@@ -2304,6 +2305,7 @@ _cairo_pdf_surface_finish (void *abstract_surface)
_cairo_array_fini (&surface->fonts);
_cairo_array_fini (&surface->knockout_group);
_cairo_array_fini (&surface->page_annots);
+ _cairo_array_fini (&surface->forward_links);
if (surface->font_subsets) {
_cairo_scaled_font_subsets_destroy (surface->font_subsets);