summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--poppler/PDFDoc.cc6
-rw-r--r--poppler/PDFDoc.h4
-rw-r--r--utils/pdfunite.cc4
3 files changed, 8 insertions, 6 deletions
diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
index f307890a..0d78588c 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -1526,7 +1526,7 @@ void PDFDoc::markPageObjects(Dict *pageDict, XRef *xRef, XRef *countRef, Guint n
}
}
-Guint PDFDoc::writePageObjects(OutStream *outStr, XRef *xRef, Guint numOffset)
+Guint PDFDoc::writePageObjects(OutStream *outStr, XRef *xRef, Guint numOffset, GBool combine)
{
Guint objectsCount = 0; //count the number of objects in the XRef(s)
Guchar *fileKey;
@@ -1543,7 +1543,9 @@ Guint PDFDoc::writePageObjects(OutStream *outStr, XRef *xRef, Guint numOffset)
objectsCount++;
getXRef()->fetch(ref.num - numOffset, ref.gen, &obj);
Guint offset = writeObjectHeader(&ref, outStr);
- if (xRef->getEntry(n)->getFlag(XRefEntry::Unencrypted)) {
+ if (combine) {
+ writeObject(&obj, outStr, getXRef(), numOffset, NULL, cryptRC4, 0, 0, 0);
+ } else if (xRef->getEntry(n)->getFlag(XRefEntry::Unencrypted)) {
writeObject(&obj, outStr, NULL, cryptRC4, 0, 0, 0);
} else {
writeObject(&obj, outStr, fileKey, encAlgorithm, keyLength, ref.num, ref.gen);
diff --git a/poppler/PDFDoc.h b/poppler/PDFDoc.h
index f3e9f68b..45623465 100644
--- a/poppler/PDFDoc.h
+++ b/poppler/PDFDoc.h
@@ -22,7 +22,7 @@
// Copyright (C) 2009 Kovid Goyal <kovid@kovidgoyal.net>
// Copyright (C) 2010 Hib Eris <hib@hiberis.nl>
// Copyright (C) 2010 Srinivas Adicherla <srinivas.adicherla@geodesic.com>
-// Copyright (C) 2011 Thomas Freitag <Thomas.Freitag@alfa.de>
+// Copyright (C) 2011, 2012 Thomas Freitag <Thomas.Freitag@alfa.de>
// Copyright (C) 2012 Fabio D'Urso <fabiodurso@hotmail.it>
//
// To see a description of the changes please see the Changelog file that
@@ -243,7 +243,7 @@ public:
void replacePageDict(int pageNo, int rotate, PDFRectangle *mediaBox, PDFRectangle *cropBox, Object *pageCTM);
void markPageObjects(Dict *pageDict, XRef *xRef, XRef *countRef, Guint numOffset);
// write all objects used by pageDict to outStr
- Guint writePageObjects(OutStream *outStr, XRef *xRef, Guint numOffset);
+ Guint writePageObjects(OutStream *outStr, XRef *xRef, Guint numOffset, GBool combine = gFalse);
static void writeObject (Object *obj, OutStream* outStr, XRef *xref, Guint numOffset, Guchar *fileKey,
CryptAlgorithm encAlgorithm, int keyLength, int objNum, int objGen);
static void writeHeader(OutStream *outStr, int major, int minor);
diff --git a/utils/pdfunite.cc b/utils/pdfunite.cc
index 65022599..79d05f04 100644
--- a/utils/pdfunite.cc
+++ b/utils/pdfunite.cc
@@ -4,7 +4,7 @@
//
// This file is licensed under the GPLv2 or later
//
-// Copyright (C) 2011 Thomas Freitag <Thomas.Freitag@alfa.de>
+// Copyright (C) 2011, 2012 Thomas Freitag <Thomas.Freitag@alfa.de>
// Copyright (C) 2012 Arseny Solokha <asolokha@gmx.com>
// Copyright (C) 2012 Fabio D'Urso <fabiodurso@hotmail.it>
// Copyright (C) 2012 Albert Astals Cid <aacid@kde.org>
@@ -122,7 +122,7 @@ int main (int argc, char *argv[])
Dict *pageDict = page.getDict();
docs[i]->markPageObjects(pageDict, yRef, countRef, numOffset);
}
- objectsCount += docs[i]->writePageObjects(outStr, yRef, numOffset);
+ objectsCount += docs[i]->writePageObjects(outStr, yRef, numOffset, gTrue);
numOffset = yRef->getNumObjects() + 1;
}