The PDF is encrypted ( /Encrypt 954 0 R ) and we don't take that into account it, so that's why the rest of the document "disappears", with
iff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc index 19bb933..6c79fb6 100644 --- a/poppler/PDFDoc.cc +++ b/poppler/PDFDoc.cc @@ -836,7 +836,7 @@ void PDFDoc::writeTrailer (Guint uxrefOffset, int uxrefSize, OutStream* outStr, obj1.initString(new GooString((const char*)digest, 16));
//create ID array - Object obj2,obj3,obj4; + Object obj2,obj3,obj4,obj5; obj2.initArray(xref);
if (incrUpdate) { @@ -868,6 +868,12 @@ void PDFDoc::writeTrailer (Guint uxrefOffset, int uxrefSize, OutStream* outStr, if (incrUpdate) { obj1.initInt(xref->getLastXRefPos()); trailerDict->set("Prev", &obj1); + + xref->getTrailerDict()->dictLookupNF("Encrypt", &obj5); + if (!obj5.isNull()) + { + trailerDict->set("Encrypt", &obj5); + } } outStr->printf( "trailer\r\n"); writeDictionnary(trailerDict, outStr);
the effect is exactly the opposite, the PDF is not destroyed, but our added things don't get rendered because they are not encrypted.
We might want to just "return false" if the PDF is encrypted, at least don't destroy the docuemnt, what do you say?
The PDF is encrypted ( /Encrypt 954 0 R ) and we don't take that into account it, so that's why the rest of the document "disappears", with
iff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc :writeTrailer (Guint uxrefOffset, int uxrefSize, OutStream* outStr, initString( new GooString((const char*)digest, 16));
index 19bb933..6c79fb6 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -836,7 +836,7 @@ void PDFDoc:
obj1.
//create ID array obj4,obj5; initArray( xref);
- Object obj2,obj3,obj4;
+ Object obj2,obj3,
obj2.
if (incrUpdate) { :writeTrailer (Guint uxrefOffset, int uxrefSize, OutStream* outStr, initInt( xref->getLastXR efPos() ); t->set( "Prev", &obj1); rDict() ->dictLookupNF( "Encrypt" , &obj5); >set("Encrypt" , &obj5); nary(trailerDic t, outStr);
@@ -868,6 +868,12 @@ void PDFDoc:
if (incrUpdate) {
obj1.
trailerDic
+
+ xref->getTraile
+ if (!obj5.isNull())
+ {
+ trailerDict-
+ }
}
outStr->printf( "trailer\r\n");
writeDiction
the effect is exactly the opposite, the PDF is not destroyed, but our added things don't get rendered because they are not encrypted.
We might want to just "return false" if the PDF is encrypted, at least don't destroy the docuemnt, what do you say?