From 5265303eee1f82813e868c2391f09a6007ad51fd Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Sun, 26 Nov 2017 20:43:15 +1030 Subject: [PATCH 5/8] cairo: only output link annotations when setInteractive(true) Bug #103912 --- poppler/CairoOutputDev.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc index 1fc184a7..b3d01326 100644 --- a/poppler/CairoOutputDev.cc +++ b/poppler/CairoOutputDev.cc @@ -323,7 +323,7 @@ void CairoOutputDev::startFirstPage(int pageNum, GfxState *state, XRef *xrefA) xref = xrefA; } - if (logicalStruct && isPDF()) { + if (interactive && isPDF()) { int numDests = doc->getCatalog()->numDestNameTree(); for (int i = 0; i < numDests; i++) { GooString *name = doc->getCatalog()->getDestNameTreeName(i); @@ -370,6 +370,7 @@ void CairoOutputDev::startPage(int pageNum, GfxState *state, XRef *xrefA) { cairoPageNum++; if (interactive && isPDF()) { + // emit page labels GooString label; if (doc->getCatalog()->indexToLabel(pageNum-1, &label, gTrue)) { char *utf8 = TextStringToUtf8 (&label); @@ -380,9 +381,8 @@ void CairoOutputDev::startPage(int pageNum, GfxState *state, XRef *xrefA) { gfree (utf8); } } - } - if (logicalStruct && isPDF()) { + // build list of link annotations if (annotations) delete annotations; Object obj = doc->getPage(pageNum)->getAnnotsObject(xref); @@ -428,7 +428,7 @@ void CairoOutputDev::endPage(GfxState *state) { text->coalesce(gTrue, 0, gFalse); } - if (logicalStruct && annotations && isPDF()) { + if (interactive && annotations && isPDF()) { for (int i = 0; i < annotations->getNumAnnots(); i++) { Annot *annot = annotations->getAnnot(i); if (annot->getType() == Annot::typeLink) { @@ -3652,7 +3652,7 @@ void CairoOutputDev::beginMarkedContent(GfxState *state, char *name, Dict *prope // open noncommon elemStack tags while (i < elemStack.size()) { - if (elemStack[i]->getType() == StructElement::Link) { + if (interactive && elemStack[i]->getType() == StructElement::Link) { beginLink(state, elemStack[i]); } else { #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 15, 8) -- 2.11.0