Bug 17901 - Support for writing Encrypted data
Summary: Support for writing Encrypted data
Status: RESOLVED MOVED
Alias: None
Product: poppler
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: poppler-bugs
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-04 09:10 UTC by Carlos Garcia Campos
Modified: 2018-08-21 10:39 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Carlos Garcia Campos 2008-10-04 09:10:38 UTC
Bug forwarded from Evince: http://bugzilla.gnome.org/show_bug.cgi?id=552875

"Please describe the problem:
Saving a copy of a PDF document works fine. But as soon as you enter something
into a form field and then save a copy, only the form fields including their
data are saved into the copy. The whole background is omitted however.

This might work for printing only the entered data but not for keeping the
document including the data. Without the background the document is useless

Steps to reproduce:
1. Open a PDF with forms
2. Enter something
3. Save a copy


Actual results:
Evince only saves form fields and data.

Expected results:
Evince should also save the background.

Does this happen every time?
Yes"

A test case can be found attached to the original bug report.
Comment 1 Albert Astals Cid 2008-10-04 10:28:45 UTC
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?
Comment 2 Albert Astals Cid 2008-10-04 10:51:04 UTC
Changing the subject, for now i've disabled saving when the object has an Encrypt, we need to work on writing encrypted data.
Comment 3 GitLab Migration User 2018-08-21 10:39:14 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/poppler/poppler/issues/308.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.