Opened 13 years ago

Last modified 12 years ago

#2541 assigned defect

Read can't save a PDF with a form

Reported by: godiard Owned by: godiard
Priority: Unspecified by Maintainer Milestone: Unspecified
Component: Read Version: Git as of bugdate
Severity: Unspecified Keywords:
Cc: godiard, sascha_silbe, humitos Distribution/OS:
Bug Status: New


Read can open a PDF with a form and write it, but can't save the modified file with the text added.

Tested in Sugar 0.84

The attached file can be used for testing

Attachments (1)

formulario.pdf (172.4 KB) - added by godiard 13 years ago.
PDF with a form

Download all attachments as: .zip

Change History (6)

Changed 13 years ago by godiard

PDF with a form

comment:1 Changed 13 years ago by sascha_silbe

  • Cc sascha_silbe added
  • Distribution/OS Unspecified deleted
  • Milestone changed from 0.84 to Unspecified by Release Team
  • Owner changed from sayamindu to godiard
  • Status changed from new to assigned
  • Version changed from Unspecified to Git as of bugdate

This is a limitation of PDF that we'd need to work around by

  1. saving the entered values as part of the metadata (=> not preserved outside of Sugar) and
  2. saving a permanently modified version.
  1. requires upstream (i.e. libevview) support first.
  2. would need to be an explicit user action since the original document wouldn't be recoverable from the filled-out version. But unlike 1. it can be implemented using the current evince API: by "printing" to a file.

Note that at least evince 2.30.2 has a bug that causes it to not render fields that have been filled out, but not "left" (by clicking on a different part of the document) before printing. We might need to work around this in Read.

In theory 1. would be an enhancement, but since not preserving changes across Stop/resume is violating the HIG I'll leave it marked as defect.

comment:2 Changed 13 years ago by sascha_silbe

I just discovered that Okular (the PDF viewer shipped with KDE) is able to save a filled-in PDF form that can be modified again. So it seems there is some way to do that in the PDF format; my original analysis was incorrect.
Even better, evince apparently already supports it (|Gnome#480668. Just checked with evince 2.30.3-2 (Debian Squeeze) and using "Save a copy" indeed saves the filled-out form values, too! (when it doesn't segfault, that is :-/ )

We probably only need to use the function instead of the hard linking trick in readactivity.ReadActivity.write_file().

comment:3 Changed 12 years ago by humitos

  • Cc humitos added

comment:4 Changed 12 years ago by humitos

Well, I used pdfinfo command to get some information about "formulario.pdf":

[humitos] [~]$ pdfinfo formulario.pdf 
Producer:       Python PDF Library -
CreationDate:   Sat Oct 23 16:09:11 2010
ModDate:        Sun Dec  5 20:23:18 2010
Tagged:         no
Pages:          3
Encrypted:      no
Page size:      611.827 x 791.841 pts
File size:      176528 bytes
Optimized:      yes
PDF version:    1.6
[humitos] [~]$

I found this file was created with pyPdf, so should be there a way to extract the filled in information. I'm researching about this.

Note: See TracTickets for help on using tickets.