Support for read only changes and checkbox values in scripts
Closed, ResolvedPublic

Description

Some documents change the read only state of member fields. Okular currently does not support this and poppler does not expose setting the read only state. This makes such documents "unfillable" through Okular as fields that need to be filled are not fillable.

Here are two real world documents that do this:

And a more minimal test case that I built:

I was a bit unsure where to add the readOnly storage. It's not a widget annotation. The Adobe PDF spec 1.7 explicitly says that the ReadOnly Annotation is ignored for form fields as I understood it.

My first draft was to keep it completly internal to okular and not store the state on save (as it is calculated anyway). But this is kind of weird as we then have two read only values, one set from scripts in Okular and one from the document / poppler. So for the discussion here I'll attach a patch against poppler that exposes the fields setReadOnly. It's still not stored when the document is saved but as it's not an annotation I don't see how it should be saved. But I think exposing the poppler storage is the cleaner solution.

The result is pretty cool IMO:

It could be nicer e.g. that the changed readOnly state is rendered in the background of newly enabled checkboxes. But the documents can be used now and I think that this is a good first step for this feature.

P.S.
Sorry to mix in the Checkbox values here but having read only depend on checkbox values was in my examples and easiest for me to copy for a minimal testcase. It's also just a small additional patch.

aheinecke triaged this task as Wishlist priority.

Is there anything I can help with here?

Do you think the general approach to extend poppler is Ok, and should I try to get D10864 into Poppler?

aacid added a subscriber: aacid.Mar 18 2018, 11:17 PM

Did you see my comment on D10864?

Yes, but I wanted to look into it more before I could answer and don't really have a handle yet on how the Problem should be solved.

aheinecke closed this task as Resolved.Mar 21 2018, 6:36 AM

With the patches in, this can be resolved. :-)

aheinecke moved this task from Backlog to Done on the Okular board.Mar 23 2018, 6:43 AM