saving a copy of a pdf form deletes all content excepting filled fields

Bug #299409 reported by Emmanuel DA MOTA on 2008-11-18
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Evince
Unknown
Medium
poppler (Ubuntu)
Low
Ubuntu Desktop Bugs

Bug Description

Binary package hint: evince

Ubuntu 8.10
evince 2.24.1

i have to fill a pdf form, when i save a copy of this file whitout filling any field then all the content is save. When i save a copy with one ore more fields filled, only filled fields are saved and all other content is lost.

ProblemType: Bug
Architecture: i386
DistroRelease: Ubuntu 8.10
ExecutablePath: /usr/bin/evince
NonfreeKernelModules: nvidia
Package: evince 2.24.1-0ubuntu1
ProcEnviron:
 SHELL=/bin/bash
 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
 LANG=fr_FR.UTF-8
SourcePackage: evince
Uname: Linux 2.6.27-7-generic i686

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?

Changing the subject, for now i've disabled saving when the object has an Encrypt, we need to work on writing encrypted data.

Binary package hint: evince

Ubuntu 8.10
evince 2.24.1

i have to fill a pdf form, when i save a copy of this file whitout filling any field then all the content is save. When i save a copy with one ore more fields filled, only filled fields are saved and all other content is lost.

ProblemType: Bug
Architecture: i386
DistroRelease: Ubuntu 8.10
ExecutablePath: /usr/bin/evince
NonfreeKernelModules: nvidia
Package: evince 2.24.1-0ubuntu1
ProcEnviron:
 SHELL=/bin/bash
 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
 LANG=fr_FR.UTF-8
SourcePackage: evince
Uname: Linux 2.6.27-7-generic i686

copy of the source field whithout modification

copy of the source file with one modification

Pedro Villavicencio (pedro) wrote :

confirmed, will look upstream, thanks for the report.

Changed in evince:
assignee: nobody → desktop-bugs
importance: Undecided → Low
status: New → Confirmed
Pedro Villavicencio (pedro) wrote :

Thanks for your bug report. This bug has been reported to the developers of the software. You can track it and make comments here: http://bugzilla.gnome.org/show_bug.cgi?id=561356

Changed in evince:
status: Confirmed → Triaged
Pedro Villavicencio (pedro) wrote :

according to upstream this is a poppler issue, reassigning, thanks.

Changed in evince:
status: Unknown → Confirmed
Changed in evince:
importance: Unknown → Medium
Changed in evince:
importance: Medium → Unknown
Changed in evince:
importance: Unknown → Medium

I needed a fix for this, so I made the attached bash script. Open your PDF files with this script and it will decrypt the file (overwriting the original) and open the decrypted file. Forms on decrypted PDFs can be saved.

I wish Evince did the same, if saving encrypted data isn't possible.

Originally posted here: https://bugs.launchpad.net/ubuntu/+source/evince/+bug/492959/comments/19

-- 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.

Changed in evince:
status: Confirmed → Unknown
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.