From 904ecd929c6acbbad6d782b950c53c0a80e1f39c Mon Sep 17 00:00:00 2001 From: Carlos Garcia Campos Date: Thu, 17 Dec 2009 12:49:20 +0100 Subject: [PATCH 07/11] [annots] Fix memory leaks --- poppler/Annot.cc | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/poppler/Annot.cc b/poppler/Annot.cc index 6fdf8c5..6d2bcf3 100644 --- a/poppler/Annot.cc +++ b/poppler/Annot.cc @@ -1894,6 +1894,7 @@ void AnnotText::draw(Gfx *gfx, GBool printing) { MemStream *appearStream = new MemStream(copyString(appearBuf->getCString()), 0, appearBuf->getLength(), &appearDict); + appearStream->setNeedFree(gTrue); appearance.initStream(appearStream); delete appearBuf; } @@ -2365,6 +2366,7 @@ void AnnotLine::draw(Gfx *gfx, GBool printing) { MemStream *appearStream = new MemStream(copyString(appearBuf->getCString()), 0, appearBuf->getLength(), &appearDict); + appearStream->setNeedFree(gTrue); appearance.initStream(appearStream); delete appearBuf; } @@ -4372,7 +4374,8 @@ void AnnotGeometry::draw(Gfx *gfx, GBool printing) { appearDict.dictSet("BBox", &obj1); MemStream *appearStream = new MemStream(copyString(appearBuf->getCString()), 0, - appearBuf->getLength(), &appearDict); + appearBuf->getLength(), &appearDict); + appearStream->setNeedFree(gTrue); appearance.initStream(appearStream); delete appearBuf; } @@ -4758,6 +4761,7 @@ void AnnotFileAttachment::draw(Gfx *gfx, GBool printing) { MemStream *appearStream = new MemStream(copyString(appearBuf->getCString()), 0, appearBuf->getLength(), &appearDict); + appearStream->setNeedFree(gTrue); appearance.initStream(appearStream); delete appearBuf; } -- 1.6.3.3 From 86c871cc625d00b8ee7f93dc8c0f9ef8462bba5a Mon Sep 17 00:00:00 2001 From: Carlos Garcia Campos Date: Thu, 17 Dec 2009 17:05:45 +0100 Subject: [PATCH 08/11] [annots] Create appearance stream for Text Markup Annotations when not defined Highlight annotations are an exception, we always ignore the appearance stream to use our own, since for most of the documents the appearance stream provided by the annotation is not enough. That's why it's currently broken. This is what acroread does indeed and Leonard Rosenthol recommended us to do the same. See bug #23108. --- poppler/Annot.cc | 199 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ poppler/Annot.h | 2 + 2 files changed, 201 insertions(+), 0 deletions(-) diff --git a/poppler/Annot.cc b/poppler/Annot.cc index 6d2bcf3..32cdb6c 100644 --- a/poppler/Annot.cc +++ b/poppler/Annot.cc @@ -2462,6 +2462,205 @@ AnnotTextMarkup::~AnnotTextMarkup() { } } +void AnnotTextMarkup::draw(Gfx *gfx, GBool printing) { + Object obj; + double ca = 1; + int i; + Object obj1, obj2; + Object formDict, resDict; + MemStream *mStream; + + if (!isVisible (printing)) + return; + + if (appearance.isNull() || type == typeHighlight) { + ca = opacity; + + appearBuf = new GooString (); + + switch (type) { + case typeUnderline: + if (color) { + setColor(color, gFalse); + setColor(color, gTrue); + } + + for (i = 0; i < quadrilaterals->getQuadrilateralsLength(); ++i) { + double x1, y1, x2, y2, x3, y3; + double x, y; + + x1 = quadrilaterals->getX1(i); + y1 = quadrilaterals->getY1(i); + x2 = quadrilaterals->getX2(i); + y2 = quadrilaterals->getY2(i); + x3 = quadrilaterals->getX3(i); + y3 = quadrilaterals->getY3(i); + + x = x1 - rect->x1; + y = y3 - rect->y1; + appearBuf->append ("[]0 d 2 w\n"); + appearBuf->appendf ("{0:.2f} {1:.2f} m\n", x, y); + appearBuf->appendf ("{0:.2f} {1:.2f} l\n", x + (x2 - x1), y); + appearBuf->append ("S\n"); + } + break; + case typeStrikeOut: + if (color) { + setColor(color, gFalse); + setColor(color, gTrue); + } + + for (i = 0; i < quadrilaterals->getQuadrilateralsLength(); ++i) { + double x1, y1, x2, y2, x3, y3; + double x, y; + double h2; + + x1 = quadrilaterals->getX1(i); + y1 = quadrilaterals->getY1(i); + x2 = quadrilaterals->getX2(i); + y2 = quadrilaterals->getY2(i); + x3 = quadrilaterals->getX3(i); + y3 = quadrilaterals->getY3(i); + h2 = (y1 - y3) / 2.0; + + x = x1 - rect->x1; + y = (y3 - rect->y1) + h2; + appearBuf->append ("[]0 d 2 w\n"); + appearBuf->appendf ("{0:.2f} {1:.2f} m\n", x, y); + appearBuf->appendf ("{0:.2f} {1:.2f} l\n", x + (x2 - x1), y); + appearBuf->append ("S\n"); + } + break; + case typeSquiggly: + // TODO + default: + case typeHighlight: + appearance.free(); + + if (color) + setColor(color, gTrue); + + for (i = 0; i < quadrilaterals->getQuadrilateralsLength(); ++i) { + double x1, y1, x2, y2, x3, y3, x4, y4; + double h4; + + x1 = quadrilaterals->getX1(i); + y1 = quadrilaterals->getY1(i); + x2 = quadrilaterals->getX2(i); + y2 = quadrilaterals->getY2(i); + x3 = quadrilaterals->getX3(i); + y3 = quadrilaterals->getY3(i); + x4 = quadrilaterals->getX4(i); + y4 = quadrilaterals->getY4(i); + h4 = (y1 - y3) / 4.0; + + appearBuf->appendf ("{0:.2f} {1:.2f} m\n", x3, y3); + appearBuf->appendf ("{0:.2f} {1:.2f} {2:.2f} {3:.2f} {4:.2f} {5:.2f} c\n", + x3 - h4, y3 + h4, x1 - h4, y1 - h4, x1, y1); + appearBuf->appendf ("{0:.2f} {1:.2f} l\n", x2, y2); + appearBuf->appendf ("{0:.2f} {1:.2f} {2:.2f} {3:.2f} {4:.2f} {5:.2f} c\n", + x2 + h4, y2 - h4, x4 + h4, y4 + h4, x4, y4); + appearBuf->append ("f\n"); + } + + Object appearDict; + appearDict.initDict(xref); + appearDict.dictSet("Length", obj1.initInt(appearBuf->getLength())); + appearDict.dictSet("Subtype", obj1.initName("Form")); + obj1.initArray(xref); + obj1.arrayAdd(obj2.initReal(rect->x1)); + obj1.arrayAdd(obj2.initReal(rect->y1)); + obj1.arrayAdd(obj2.initReal(rect->x2)); + obj1.arrayAdd(obj2.initReal(rect->y2)); + appearDict.dictSet("BBox", &obj1); + obj1.initArray(xref); + obj1.arrayAdd(obj2.initReal(1)); + obj1.arrayAdd(obj2.initReal(0)); + obj1.arrayAdd(obj2.initReal(0)); + obj1.arrayAdd(obj2.initReal(1)); + obj1.arrayAdd(obj2.initReal(-rect->x1)); + obj1.arrayAdd(obj2.initReal(-rect->y1)); + appearDict.dictSet("Matrix", &obj1); + + Object aStream; + mStream = new MemStream(copyString(appearBuf->getCString()), 0, + appearBuf->getLength(), &appearDict); + mStream->setNeedFree(gTrue); + aStream.initStream(mStream); + delete appearBuf; + + Object transDict; + formDict.initDict(xref); + formDict.dictSet ("Form", &aStream); + resDict.initDict(xref); + resDict.dictSet ("XObject", &formDict); + + transDict.initDict(xref); + transDict.dictSet ("S", obj1.initName("Transparency")); + + appearBuf = new GooString ("/Form Do"); + + formDict.initDict(xref); + formDict.dictSet("Length", obj1.initInt(appearBuf->getLength())); + formDict.dictSet("Subtype", obj1.initName("Form")); + formDict.dictSet("Group", &transDict); + formDict.dictSet("Resources", &resDict); + obj1.initArray(xref); + obj1.arrayAdd(obj2.initReal(0)); + obj1.arrayAdd(obj2.initReal(0)); + obj1.arrayAdd(obj2.initReal(rect->x2 - rect->x1)); + obj1.arrayAdd(obj2.initReal(rect->y2 - rect->y1)); + formDict.dictSet("BBox", &obj1); + + mStream = new MemStream(copyString(appearBuf->getCString()), 0, + appearBuf->getLength(), &formDict); + mStream->setNeedFree(gTrue); + aStream.initStream(mStream); + delete appearBuf; + + Object stateDict; + + formDict.initDict(xref); + formDict.dictSet ("HAForm", &aStream); + transDict.initDict(xref); + transDict.dictSet ("BM", obj1.initName("Multiply")); + stateDict.initDict(xref); + stateDict.dictSet ("R0", &transDict); + resDict.initDict(xref); + resDict.dictSet ("XObject", &formDict); + resDict.dictSet ("ExtGState", &stateDict); + + appearBuf = new GooString ("/R0 gs\n/HAForm Do"); + + break; + } + + formDict.initDict(xref); + formDict.dictSet("Length", obj1.initInt(appearBuf->getLength())); + formDict.dictSet("Subtype", obj1.initName("Form")); + if (type == typeHighlight) + formDict.dictSet("Resources", &resDict); + obj1.initArray(xref); + obj1.arrayAdd(obj2.initReal(0)); + obj1.arrayAdd(obj2.initReal(0)); + obj1.arrayAdd(obj2.initReal(rect->x2 - rect->x1)); + obj1.arrayAdd(obj2.initReal(rect->y2 - rect->y1)); + formDict.dictSet("BBox", &obj1); + + mStream = new MemStream(copyString(appearBuf->getCString()), 0, + appearBuf->getLength(), &formDict); + mStream->setNeedFree(gTrue); + appearance.initStream(mStream); + delete appearBuf; + } + + // draw the appearance stream + appearance.fetch(xref, &obj); + gfx->drawAnnot(&obj, (AnnotBorder *)NULL, color, ca, + rect->x1, rect->y1, rect->x2, rect->y2); + obj.free(); +} + //------------------------------------------------------------------------ // AnnotWidget //------------------------------------------------------------------------ diff --git a/poppler/Annot.h b/poppler/Annot.h index eacb752..e87e269 100644 --- a/poppler/Annot.h +++ b/poppler/Annot.h @@ -984,6 +984,8 @@ public: AnnotTextMarkup(XRef *xrefA, Dict *dict, Catalog *catalog, Object *obj); virtual ~AnnotTextMarkup(); + virtual void draw(Gfx *gfx, GBool printing); + AnnotQuadrilaterals *getQuadrilaterals() const { return quadrilaterals; } protected: -- 1.6.3.3 From e4f5a78a853b88b1586ef59fc8893a321ea23736 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Campos Date: Thu, 17 Dec 2009 17:39:39 +0100 Subject: [PATCH 09/11] [annots] Add Tag and Graph icons for File Attachment annotations See bug #23108. --- poppler/Annot.cc | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 70 insertions(+), 0 deletions(-) diff --git a/poppler/Annot.cc b/poppler/Annot.cc index 32cdb6c..45afbea 100644 --- a/poppler/Annot.cc +++ b/poppler/Annot.cc @@ -4923,6 +4923,72 @@ void AnnotFileAttachment::initialize(XRef *xrefA, Catalog *catalog, Dict* dict) "4.82 6.25 3.566 4.324 5.461 c 3 7.395 3.383 12.438 4.711 13.801 c 9.648\n" \ "18.887 l S\n" +#define ANNOT_FILE_ATTACHMENT_AP_GRAPH \ + "4.301 23 m 19.699 23 l 21.523 23 23 21.523 23 19.699 c 23 4.301 l 23\n" \ + "2.477 21.523 1 19.699 1 c 4.301 1 l 2.477 1 1 2.477 1 4.301 c 1 19.699\n" \ + "l 1 21.523 2.477 23 4.301 23 c h\n" \ + "4.301 23 m f\n" \ + "0.533333 0.541176 0.521569 RG 1 w\n" \ + "1 J\n" \ + "0 j\n" \ + "[] 0.0 d\n" \ + "4 M 18.5 15.5 m 18.5 13.086 l 16.086 15.5 l 18.5 15.5 l h\n" \ + "18.5 15.5 m S\n" \ + "7 7 m 10 11 l 13 9 l 18 15 l S\n" \ + "0.729412 0.741176 0.713725 RG 7 8 m 10 12 l 13 10 l 18 16 l S\n" \ + "18.5 16.5 m 18.5 14.086 l 16.086 16.5 l 18.5 16.5 l h\n" \ + "18.5 16.5 m S\n" \ + "0.533333 0.541176 0.521569 RG 2 w\n" \ + "1 j\n" \ + "3 19 m 3 3 l 21 3 l S\n" \ + "0.729412 0.741176 0.713725 RG 3 20 m 3 4 l 21 4 l S\n" + +#define ANNOT_FILE_ATTACHMENT_AP_TAG \ + "4.301 23 m 19.699 23 l 21.523 23 23 21.523 23 19.699 c 23 4.301 l 23\n" \ + "2.477 21.523 1 19.699 1 c 4.301 1 l 2.477 1 1 2.477 1 4.301 c 1 19.699\n" \ + "l 1 21.523 2.477 23 4.301 23 c h\n" \ + "4.301 23 m f\n" \ + "0.533333 0.541176 0.521569 RG 0.999781 w\n" \ + "1 J\n" \ + "1 j\n" \ + "[] 0.0 d\n" \ + "4 M q 1 0 0 -1 0 24 cm\n" \ + "8.492 8.707 m 8.492 9.535 7.82 10.207 6.992 10.207 c 6.164 10.207 5.492\n" \ + "9.535 5.492 8.707 c 5.492 7.879 6.164 7.207 6.992 7.207 c 7.82 7.207\n" \ + "8.492 7.879 8.492 8.707 c h\n" \ + "8.492 8.707 m S Q\n" \ + "2 w\n" \ + "20.078 11.414 m 20.891 10.602 20.785 9.293 20.078 8.586 c 14.422 2.93 l\n" \ + "13.715 2.223 12.301 2.223 11.594 2.93 c 3.816 10.707 l 3.109 11.414\n" \ + "2.402 17.781 3.816 19.195 c 5.23 20.609 11.594 19.902 12.301 19.195 c\n" \ + "20.078 11.414 l h\n" \ + "20.078 11.414 m S\n" \ + "0.729412 0.741176 0.713725 RG 20.078 12.414 m\n" \ + "20.891 11.605 20.785 10.293 20.078 9.586 c 14.422 3.93 l\n" \ + "13.715 3.223 12.301 3.223 11.594 3.93 c 3.816 11.707 l 3.109 12.414\n" \ + "2.402 18.781 3.816 20.195 c 5.23 21.609 11.594 20.902 12.301 20.195 c\n" \ + "20.078 12.414 l h\n" \ + "20.078 12.414 m S\n" \ + "0.533333 0.541176 0.521569 RG 1 w\n" \ + "0 j\n" \ + "11.949 13.184 m 16.191 8.941 l S\n" \ + "0.729412 0.741176 0.713725 RG 11.949 14.184 m 16.191 9.941 l S\n" \ + "0.533333 0.541176 0.521569 RG 14.07 6.82 m 9.828 11.062 l S\n" \ + "0.729412 0.741176 0.713725 RG 14.07 7.82 m 9.828 12.062 l S\n" \ + "0.533333 0.541176 0.521569 RG 6.93 15.141 m 8 20 14.27 20.5 16 20.5 c\n" \ + "18.094 20.504 19.5 20 19.5 18 c 19.5 16.699 20.91 16.418 22.5 16.5 c S\n" \ + "0.729412 0.741176 0.713725 RG 0.999781 w\n" \ + "1 j\n" \ + "q 1 0 0 -1 0 24 cm\n" \ + "8.492 7.707 m 8.492 8.535 7.82 9.207 6.992 9.207 c 6.164 9.207 5.492\n" \ + "8.535 5.492 7.707 c 5.492 6.879 6.164 6.207 6.992 6.207 c 7.82 6.207\n" \ + "8.492 6.879 8.492 7.707 c h\n" \ + "8.492 7.707 m S Q\n" \ + "1 w\n" \ + "0 j\n" \ + "6.93 16.141 m 8 21 14.27 21.5 16 21.5 c 18.094 21.504 19.5 21 19.5 19 c\n" \ + "19.5 17.699 20.91 17.418 22.5 17.5 c S\n" + void AnnotFileAttachment::draw(Gfx *gfx, GBool printing) { Object obj; double ca = 1; @@ -4944,6 +5010,10 @@ void AnnotFileAttachment::draw(Gfx *gfx, GBool printing) { appearBuf->append (ANNOT_FILE_ATTACHMENT_AP_PUSHPIN); else if (!name->cmp("Paperclip")) appearBuf->append (ANNOT_FILE_ATTACHMENT_AP_PAPERCLIP); + else if (!name->cmp("Graph")) + appearBuf->append (ANNOT_FILE_ATTACHMENT_AP_GRAPH); + else if (!name->cmp("Tag")) + appearBuf->append (ANNOT_FILE_ATTACHMENT_AP_TAG); appearBuf->append ("Q\n"); Object appearDict, obj1, obj2; -- 1.6.3.3 From 39dc99431b3ea9e00f6f645dd7169c0319571dc9 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Campos Date: Thu, 17 Dec 2009 18:17:20 +0100 Subject: [PATCH 10/11] [annots] Create appearance stream for Sound Annotations when not defined See bug #23108. --- poppler/Annot.cc | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ poppler/Annot.h | 2 + 2 files changed, 114 insertions(+), 0 deletions(-) diff --git a/poppler/Annot.cc b/poppler/Annot.cc index 45afbea..efc4776 100644 --- a/poppler/Annot.cc +++ b/poppler/Annot.cc @@ -5092,6 +5092,118 @@ void AnnotSound::initialize(XRef *xrefA, Catalog *catalog, Dict* dict) { obj1.free(); } +#define ANNOT_SOUND_AP_SPEAKER \ + "4.301 23 m 19.699 23 l 21.523 23 23 21.523 23 19.699 c 23 4.301 l 23\n" \ + "2.477 21.523 1 19.699 1 c 4.301 1 l 2.477 1 1 2.477 1 4.301 c 1 19.699\n" \ + "l 1 21.523 2.477 23 4.301 23 c h\n" \ + "4.301 23 m f\n" \ + "0.533333 0.541176 0.521569 RG 2 w\n" \ + "0 J\n" \ + "1 j\n" \ + "[] 0.0 d\n" \ + "4 M 4 14 m 4.086 8.043 l 7 8 l 11 4 l 11 18 l 7 14 l 4 14 l h\n" \ + "4 14 m S\n" \ + "1 w\n" \ + "1 J\n" \ + "0 j\n" \ + "13.699 15.398 m 14.699 13.398 14.699 9.398 13.699 7.398 c S\n" \ + "18.199 19.398 m 21.199 17.398 21.199 5.398 18.199 3.398 c S\n" \ + "16 17.398 m 18 16.398 18 7.398 16 5.398 c S\n" \ + "0.729412 0.741176 0.713725 RG 2 w\n" \ + "0 J\n" \ + "1 j\n" \ + "4 15 m 4.086 9.043 l 7 9 l 11 5 l 11 19 l 7 15 l 4 15 l h\n" \ + "4 15 m S\n" \ + "1 w\n" \ + "1 J\n" \ + "0 j\n" \ + "13.699 16 m 14.699 14 14.699 10 13.699 8 c S\n" \ + "18.199 20 m 21.199 18 21.199 6 18.199 4 c S\n" \ + "16 18 m 18 17 18 8 16 6 c S\n" + +#define ANNOT_SOUND_AP_MIC \ + "4.301 23 m 19.699 23 l 21.523 23 23 21.523 23 19.699 c 23 4.301 l 23\n" \ + "2.477 21.523 1 19.699 1 c 4.301 1 l 2.477 1 1 2.477 1 4.301 c 1 19.699\n" \ + "l 1 21.523 2.477 23 4.301 23 c h\n" \ + "4.301 23 m f\n" \ + "0.533333 0.541176 0.521569 RG 2 w\n" \ + "1 J\n" \ + "0 j\n" \ + "[] 0.0 d\n" \ + "4 M 12 20 m 12 20 l 13.656 20 15 18.656 15 17 c 15 13 l 15 11.344 13.656 10\n" \ + "12 10 c 12 10 l 10.344 10 9 11.344 9 13 c 9 17 l 9 18.656 10.344 20 12\n" \ + "20 c h\n" \ + "12 20 m S\n" \ + "1 w\n" \ + "17.5 14.5 m 17.5 11.973 l 17.5 8.941 15.047 6.5 12 6.5 c 8.953 6.5 6.5\n" \ + "8.941 6.5 11.973 c 6.5 14.5 l S\n" \ + "2 w\n" \ + "0 J\n" \ + "12 6.52 m 12 3 l S\n" \ + "1 J\n" \ + "8 3 m 16 3 l S\n" \ + "0.729412 0.741176 0.713725 RG 12 21 m 12 21 l 13.656 21 15 19.656 15 18 c\n" \ + "15 14 l 15 12.344 13.656 11 12 11 c 12 11 l 10.344 11 9 12.344 9 14 c\n" \ + "9 18 l 9 19.656 10.344 21 12 21 c h\n" \ + "12 21 m S\n" \ + "1 w\n" \ + "17.5 15.5 m 17.5 12.973 l 17.5 9.941 15.047 7.5 12 7.5 c 8.953 7.5 6.5\n" \ + "9.941 6.5 12.973 c 6.5 15.5 l S\n" \ + "2 w\n" \ + "0 J\n" \ + "12 7.52 m 12 4 l S\n" \ + "1 J\n" \ + "8 4 m 16 4 l S\n" + +void AnnotSound::draw(Gfx *gfx, GBool printing) { + Object obj; + double ca = 1; + + if (!isVisible (printing)) + return; + + if (appearance.isNull()) { + ca = opacity; + + appearBuf = new GooString (); + + appearBuf->append ("q\n"); + if (color) + setColor(color, gTrue); + else + appearBuf->append ("1 1 1 rg\n"); + if (!name->cmp("Speaker")) + appearBuf->append (ANNOT_SOUND_AP_SPEAKER); + else if (!name->cmp("Mic")) + appearBuf->append (ANNOT_SOUND_AP_MIC); + appearBuf->append ("Q\n"); + + Object appearDict, obj1, obj2; + + appearDict.initDict(xref); + appearDict.dictSet("Length", obj1.initInt(appearBuf->getLength())); + appearDict.dictSet("Subtype", obj1.initName("Form")); + obj1.initArray(xref); + obj1.arrayAdd(obj2.initReal(0)); + obj1.arrayAdd(obj2.initReal(0)); + obj1.arrayAdd(obj2.initReal(24)); + obj1.arrayAdd(obj2.initReal(24)); + appearDict.dictSet("BBox", &obj1); + + MemStream *appearStream = new MemStream(copyString(appearBuf->getCString()), 0, + appearBuf->getLength(), &appearDict); + appearStream->setNeedFree(gTrue); + appearance.initStream(appearStream); + delete appearBuf; + } + + // draw the appearance stream + appearance.fetch(xref, &obj); + gfx->drawAnnot(&obj, border, color, ca, + rect->x1, rect->y1, rect->x2, rect->y2); + obj.free(); +} + //------------------------------------------------------------------------ // Annot3D //------------------------------------------------------------------------ diff --git a/poppler/Annot.h b/poppler/Annot.h index e87e269..0059845 100644 --- a/poppler/Annot.h +++ b/poppler/Annot.h @@ -1182,6 +1182,8 @@ public: AnnotSound(XRef *xrefA, Dict *dict, Catalog *catalog, Object *obj); ~AnnotSound(); + virtual void draw(Gfx *gfx, GBool printing); + // getters Sound *getSound() { return sound; } GooString *getName() const { return name; } -- 1.6.3.3 From ab88a02f7efefc950a316d7a5edf88dad8f3e4d0 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Campos Date: Thu, 17 Dec 2009 18:24:20 +0100 Subject: [PATCH 11/11] [annots] QuadPoints is required in Text Markup annotations Show an error message and mark annotation as invalid when it's missing. --- poppler/Annot.cc | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/poppler/Annot.cc b/poppler/Annot.cc index efc4776..16eea0d 100644 --- a/poppler/Annot.cc +++ b/poppler/Annot.cc @@ -2451,7 +2451,9 @@ void AnnotTextMarkup::initialize(XRef *xrefA, Catalog *catalog, Dict *dict) { if(dict->lookup("QuadPoints", &obj1)->isArray()) { quadrilaterals = new AnnotQuadrilaterals(obj1.getArray(), rect); } else { + error(-1, "Bad Annot Text Markup QuadPoints"); quadrilaterals = NULL; + ok = gFalse; } obj1.free(); } -- 1.6.3.3