[Poppler-bugs] [Bug 91734] pdfimages failed to list/extract image

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Wed Jul 20 11:54:13 UTC 2016


https://bugs.freedesktop.org/show_bug.cgi?id=91734

--- Comment #4 from a246246_246-kde at yahoo.co.jp ---
Quick fix for my case:

---cut here---
diff --git a/utils/ImageOutputDev.cc b/utils/ImageOutputDev.cc
index 5de51ad..cd8898c 100644
--- a/utils/ImageOutputDev.cc
+++ b/utils/ImageOutputDev.cc
@@ -46,6 +46,7 @@
 #include "goo/PNGWriter.h"
 #include "goo/TiffWriter.h"
 #include "Error.h"
+#include "Gfx.h"
 #include "GfxState.h"
 #include "Object.h"
 #include "Stream.h"
@@ -585,11 +586,21 @@ void ImageOutputDev::writeImage(GfxState *state, Object
*ref, Stream *str,
   }
 }

-GBool ImageOutputDev::tilingPatternFill(GfxState *state, Gfx *gfx, Catalog
*cat, Object *str,
+GBool ImageOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog
*cat, Object *str,
                                  double *pmat, int paintType, int tilingType,
Dict *resDict,
                                  double *mat, double *bbox,
                                  int x0, int y0, int x1, int y1,
                                  double xStep, double yStep) {
+  // In case Do operator for Image is in Pattern, need to retrieve it.
+  if (doc) {
+    PDFRectangle box;
+    Gfx *gfx;
+    box.x1 = bbox[0]; box.y1 = bbox[1];
+    box.x2 = bbox[2]; box.y2 = bbox[3];
+    gfx = new Gfx(doc, this, resDict, &box, NULL, NULL, NULL,
gfxA->getXRef());
+    gfx->display(str);
+    delete gfx;
+  }
   return gTrue;
   // do nothing -- this avoids the potentially slow loop in Gfx.cc
 }
diff --git a/utils/ImageOutputDev.h b/utils/ImageOutputDev.h
index a694bbc..da9e779 100644
--- a/utils/ImageOutputDev.h
+++ b/utils/ImageOutputDev.h
@@ -38,6 +38,7 @@
 #include "goo/gtypes.h"
 #include "goo/ImgWriter.h"
 #include "OutputDev.h"
+#include "PDFDoc.h"

 class GfxState;

@@ -71,6 +72,8 @@ public:
   // Destructor.
   virtual ~ImageOutputDev();

+  void setDoc(PDFDoc *docA) { doc = docA; }
+
   // Use PNG format for output
   void enablePNG(GBool png) { outputPNG = png; }

@@ -163,6 +166,7 @@ private:
   char *fileRoot;              // root of output file names
   char *fileName;              // buffer for output file names
   GBool listImages;            // list images instead of dumping
+  PDFDoc *doc;
   GBool dumpJPEG;              // set to dump native JPEG files
   GBool dumpJP2;               // set to dump native JPEG2000 files
   GBool dumpJBIG2;             // set to dump native JBIG2 files
diff --git a/utils/pdfimages.cc b/utils/pdfimages.cc
index 563839e..256158c 100644
--- a/utils/pdfimages.cc
+++ b/utils/pdfimages.cc
@@ -214,6 +214,7 @@ int main(int argc, char *argv[]) {
       imgOut->enableJBig2(dumpJBIG2);
       imgOut->enableCCITT(dumpCCITT);
     }
+    imgOut->setDoc(doc);
     doc->displayPages(imgOut, firstPage, lastPage, 72, 72, 0,
                       gTrue, gFalse, gFalse);
   }

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/poppler-bugs/attachments/20160720/b2987959/attachment.html>


More information about the Poppler-bugs mailing list