Support for PDF form visibility changes
Closed, ResolvedPublic

Description

Another form improvement to make more PDF forms usable with Free Software :-)

A real world example is a german tax form, which uses two hide actioins for the user to confirm that a notice was read. Confirming through the button click hides the notice and opens up editing of the fields below the buttons: Veraeusserungsanzeige.pdf

Visibility changes can be done either through JavaScript or through a Hide Action.
I've created an example containing both:

Here is how it looks in Adobe:

And here is how it looks in Okular after the Differantials I will now
attach:

As you can see hiding through actions only works for the first element. This is because Poppler does not parse action chains (Next Actions). Next actions allow for multiple actions executed in a row, which is used in the example documents.

I'll look into parsing / handling the Next Actions, but IMO this patchset is already a nice improvement and can be reviewed as is.

To avoid code duplication in Okular I did not create a new Okular::HideAction but instead used a JavaScript action to implement it.
This reuses the updateField / refreshFormWidget infrastructure.

aheinecke triaged this task as Wishlist priority.
aheinecke closed this task as Resolved.Mon, Apr 30, 12:38 PM

All done :-)

aheinecke moved this task from Backlog to Done on the Okular board.Mon, Apr 30, 12:38 PM

Thank you so much for your work to improve form handling in Okular. This effort is hugely relevant to our Usabiliuty & Productivity goal (T6831: Top-notch usability and productivity for basic software) and I plan on featuring in next week's weekly status report (https://pointieststick.wordpress.com/category/usability-productivity/). Better form support is something that has the promise to make Okular even more popular and become a strategic advantage.

If I might be so bold, here are some other form-related tasks that could really improve Okular, if you're interested in continuing along the same lines:

Thanks :-)
I'll keep the issues you mention in mind, but my current work is for a customer so I'll have to prioritize issues for them.
But I will also look at some other bugs / issues, like the focus in / out thing and stick around as a KDE developer even after the current work is done. Although my main focus is and will be Kleopatra. ;-)

My next plans are:

  • Some basic support for formatting, most importantly AF_NumberFormat (we Germans need a comma as decimal separator ;-) )
  • Support for "generic children" or call it "Fields with the same Name" ( https://bugs.kde.org/show_bug.cgi?id=344776 ) This is very important on some large forms like the Veraeusserungsanzeige.pdf here. I have a prototype for this already but it needs some more work.
  • Focus In / Out Actions ( https://bugs.kde.org/show_bug.cgi?id=307304 ) and improve the dynamic visibility by adding a display object.

(closed https://bugs.kde.org/show_bug.cgi?id=306818 ) which I think is resolved with this task.

Thanks anyway, that sounds like a good set of improvements!