diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc index 71a1efe..5093710 100644 --- a/poppler/PDFDoc.cc +++ b/poppler/PDFDoc.cc @@ -1000,7 +1000,8 @@ void PDFDoc::writeDictionnary (Dict* dict, OutStream* outStr, XRef *xRef, Guint GooString *keyNameToPrint = keyName.sanitizedName(gFalse /* non ps mode */); outStr->printf("/%s ", keyNameToPrint->getCString()); delete keyNameToPrint; - writeObject(dict->getValNF(i, &obj1), outStr, xRef, numOffset, fileKey, encAlgorithm, keyLength, objNum, objGen); + Object *val = dict->getValNF(i, &obj1); + writeObject(val, outStr, xRef, (keyName.cmp("OC") != 0 || val->getType() != objRef) ? numOffset : 0, fileKey, encAlgorithm, keyLength, objNum, objGen); obj1.free(); } outStr->printf(">> ");