Am 01.02.2012 19:19, schrieb Albert Astals Cid:
El Dimecres, 1 de febrer de 2012, a les 18:32:45, Thomas Freitag va escriure:
Hi!

I was surprised that some guys are really using my small tools
pdfseparate and pdfunite. So here a small patch which is hopefully also
useful for them:

patch for psdseparate:
Produce  PDF/X conform pdf pages if the originally PDF was PDF/X conform.
I've commited it to trunk for 0.20 release, i have to confess i have not tried
to understand/regtest it.
You see me really contrite: Because of the discussion with Leonard I suddenly encountered that I forgot to merge an important change: Using markPageObjects now also with the catalog dict we need of course to remove the dict entries from catalog which refers to other pages as the one which should be separated. I forgot to merge this to my new git copy, therefore it wasn't part of the patch. But unfortunately without it a lot of PDF can no more be handled with pdfseparate, and a lot of PDF objects will be kept in the resulting file even if no more referenced. 'Cause You already committed my patch, here just the part which was missing.

Sorry for the inconvenience,
Thomas

Albert

Cheers,
Thomas
_______________________________________________
poppler mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/poppler

.


diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
index 0932d84..a0a19b9 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -1340,10 +1340,16 @@ void PDFDoc::replacePageDict(int pageNo, int rotate,
 
 void PDFDoc::markPageObjects(Dict *pageDict, XRef *xRef, XRef *countRef, Guint 
numOffset) 
 {
+  pageDict->remove("Names");
+  pageDict->remove("OpenAction");
+  pageDict->remove("Outlines");
+  pageDict->remove("StructTreeRoot");
+
   for (int n = 0; n < pageDict->getLength(); n++) {
     const char *key = pageDict->getKey(n);
     Object value; pageDict->getValNF(n, &value);
-    if (strcmp(key, "Parent") != 0) {
+    if (strcmp(key, "Parent") != 0 &&
+             strcmp(key, "Pages") != 0) {
       markObject(&value, xRef, countRef, numOffset);
     }
     value.free();
_______________________________________________
poppler mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to