[poppler] Branch 'poppler-0.20' - poppler/PDFDoc.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Sun Jun 24 11:22:20 PDT 2012


 poppler/PDFDoc.cc |   16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

New commits:
commit c87738ee234aafc6eda5a263ad789205037020e1
Author: Thomas Freitag <Thomas.Freitag at alfa.de>
Date:   Sun Jun 24 20:20:38 2012 +0200

    copy resources content defined in the pages dict
    
    Fixes bug #51369

diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
index 2dc1ac8..ce01ca3 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -661,9 +661,14 @@ int PDFDoc::savePageAs(GooString *name, int pageNo)
   infoObj.free();
   
   // get and mark output intents etc.
-  Object catObj;
+  Object catObj, pagesObj, resourcesObj;
   getXRef()->getCatalog(&catObj);
   Dict *catDict = catObj.getDict();
+  catDict->lookup("Pages", &pagesObj);
+  Dict *pagesDict = pagesObj.getDict();
+  pagesDict->lookup("Resources", &resourcesObj);
+  if (resourcesObj.isDict())
+    markPageObjects(resourcesObj.getDict(), yRef, countRef, 0);
   markPageObjects(catDict, yRef, countRef, 0);
 
   Dict *pageDict = page.getDict();
@@ -687,12 +692,19 @@ int PDFDoc::savePageAs(GooString *name, int pageNo)
     }
   }
   catObj.free();
+  pagesObj.free();
   outStr->printf(">>\nendobj\n");
   objectsCount++;
 
   yRef->add(rootNum + 1,0,outStr->getPos(),gTrue);
   outStr->printf("%d 0 obj\n", rootNum + 1);
-  outStr->printf("<< /Type /Pages /Kids [ %d 0 R ] /Count 1 >>\n", rootNum + 2);
+  outStr->printf("<< /Type /Pages /Kids [ %d 0 R ] /Count 1 ", rootNum + 2);
+  if (resourcesObj.isDict()) {
+    outStr->printf("/Resources ");
+    writeObject(&resourcesObj, NULL, outStr, getXRef(), 0);
+    resourcesObj.free();
+  }
+  outStr->printf(">>\n");
   outStr->printf("endobj\n");
   objectsCount++;
 


More information about the poppler mailing list