[poppler] poppler/PDFDoc.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Sun Dec 28 15:32:51 PST 2008


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

New commits:
commit aba0aaa896d634a51fbb3a3e6eae411be462f930
Author: Albert Astals Cid <aacid at kde.org>
Date:   Mon Dec 29 00:31:18 2008 +0100

    More improvements in document writing
    
    Dictionary keys are names so need to be sanitized
    Add a space after num gen obj

diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
index c2d03fe..056d0f4 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -635,7 +635,10 @@ void PDFDoc::writeDictionnary (Dict* dict, OutStream* outStr)
   Object obj1;
   outStr->printf("<<");
   for (int i=0; i<dict->getLength(); i++) {
-    outStr->printf("/%s ", dict->getKey(i));
+    GooString keyName(dict->getKey(i));
+    GooString *keyNameToPrint = keyName.sanitizedName(gFalse /* non ps mode */);
+    outStr->printf("/%s ", keyNameToPrint->getCString());
+    delete keyNameToPrint;
     writeObject(dict->getValNF(i, &obj1), NULL, outStr);
     obj1.free();
   }
@@ -711,7 +714,7 @@ Guint PDFDoc::writeObject (Object* obj, Ref* ref, OutStream* outStr)
   int tmp;
 
   if(ref) 
-    outStr->printf("%i %i obj", ref->num, ref->gen);
+    outStr->printf("%i %i obj ", ref->num, ref->gen);
 
   switch (obj->getType()) {
     case objBool:


More information about the poppler mailing list