From 342e290e61b3c3288dbce8adf9b2b5f654e149ab Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Sun, 26 Nov 2017 20:43:15 +1030 Subject: [PATCH 6/8] cairo: when interactive and source has thumbs, write thumbs to output Bug #103912 --- poppler/CairoOutputDev.cc | 11 +++++++++++ utils/pdftocairo.1 | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc index b3d01326..1fd0fb48 100644 --- a/poppler/CairoOutputDev.cc +++ b/poppler/CairoOutputDev.cc @@ -382,6 +382,17 @@ void CairoOutputDev::startPage(int pageNum, GfxState *state, XRef *xrefA) { } } + // set thumbnail size + int width, height; + if (!doc->getPage(pageNum)->loadThumb(nullptr, &width, &height, nullptr)) { + width = 0; + height = 0; + } + +#if defined(CAIRO_HAS_PDF_SURFACE) && CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 15, 8) + cairo_pdf_surface_set_thumbnail_size (cairo_get_target (cairo), width, height); +#endif + // build list of link annotations if (annotations) delete annotations; diff --git a/utils/pdftocairo.1 b/utils/pdftocairo.1 index bded4875..cd966127 100644 --- a/utils/pdftocairo.1 +++ b/utils/pdftocairo.1 @@ -224,7 +224,7 @@ write this information to the output file (PDF only). .B \-inter If the input file contains interactive features, where supported by cairo, write this information to the output file (PDF only). Currently supported -features: page labels. +features: page labels, thumbnail images. .TP .B \-origpagesizes This option is the same as "\-paper match". -- 2.11.0