GSoC/2024/StatusReports/PrathamGandhi: Difference between revisions

From KDE Community Wiki
< GSoC‎ | 2024‎ | StatusReports
No edit summary
(Update for the 4th blog and language and formatting fixes.)
 
Line 4: Line 4:
This project aims to improving the support for PDF forms in Okular as much as possible and make the feature set more consistent with Adobe Acrobat.  
This project aims to improving the support for PDF forms in Okular as much as possible and make the feature set more consistent with Adobe Acrobat.  
== Work report ==
== Work report ==
The following is the list of bug fixes or new features added during the GSoC period.
Below is the list of bug fixes and new features added during the GSoC 2024 period:
* Added support for the following Acrobat pre-defined methods. This would allow for correct processing of text fields.
 
* '''Support for Acrobat Pre-Defined Methods''': 
Added support for key Acrobat methods, enabling correct processing of text fields:
# AFNumber_Keystroke
# AFNumber_Keystroke
# AFSpecial_Keystroke
# AFSpecial_Keystroke
Line 15: Line 17:
# AFPercent_Keystroke
# AFPercent_Keystroke


* Added implementation for ''selStart'' and ''selEnd'' event properties.
* '''Implementation of Event Properties''': 
* ''change'' event property was fixed to correctly handle for Unicode characters.
# Implemented ''selStart'' and ''selEnd'' properties for event handling.
* Incorrect cursor position calculation was fixed.
# Fixed the ''change'' event property to correctly handle Unicode characters.
* Following document level events were implemented.
# Fixed incorrect cursor position calculations during text entry.
# DocOpen
 
# DocWillClose
* '''Mouse Events Support''': 
# DocWillPrint
# Added support for generating event objects for ''MouseDown'', ''MouseEnter'', and ''MouseExit'' events. This improves form interactivity.   
# DocDidPrint
 
# DocWillSave
* '''Combobox Events Support''': 
# DocDidSave
# Implemented ''Keystroke'', ''Validate'', ''Calculate'', and ''Format'' events for comboboxes, which were previously not triggered. 
* Fixed the execution of validation events bug.
 
* Refresh functions were added for RadioButton, ListEdit and ComboEdit.
* '''Fixes for Form Field Event Execution''':
* A basic implementation of the ''global'' object was rolled out.
# Earlier validation events were not being executed. Fixed this bug.
* Added the feature where values in fields are committed upon being accepted and can be reverted back to this committed value in case the newly entered value is rejected.
# Corrected the execution order of ''Keystroke'', ''Validate'', ''Calculate'', and ''Format'' events, especially during undo/redo actions or when modified via JavaScript. These actions are now triggered only when a field value is committed, ensuring proper functionality and improved keyboard usability.
* Fixed bugs that caused incorrect calculation upon using different locales because of using incorrect numerical interpretation.
* '''Global Object implementation''':
* Fixed the size of checkboxes and radiobuttons and made them zoomable.
# A basic implementation of the global object was rolled out. This allows for document level use of a global object.
* Implemented ''value'' (getter), ''numItems'', ''currentValueIndices'' properties and ''getItemAt'' function for FormFieldChoices.
* '''Document-Level Event Support''': 
* Added the feature for resetting PDF forms in Okular.
Implemented support for the following document-level events, improving overall document interaction:
# ''DocOpen''
# ''DocWillClose''
# ''DocWillPrint''
# ''DocDidPrint''
# ''DocWillSave''
# ''DocDidSave''
 
* '''SubmitForm Functionality''': 
# Added support for reading the ''SubmitForm'' action in Poppler. While Okular doesn’t yet implement form submission, this lays the foundation for future integration.
 
* '''Appearance Stream set support for Form Fields''': 
# Implemented a feature in Poppler allowing modification of appearance stream text in form fields without changing the underlying value, enhancing flexibility when working with form elements.
 
* '''Reset Form Functionality''': 
# Added a reset feature for forms in Okular, allowing users to clear fields or revert them to their default values.
 
* '''Form Field Enhancements''': 
# Implemented the '''value'' (getter), ''numItems'', ''currentValueIndices'' properties, and the ''getItemAt'' function for ''FormFieldChoices''.
# Adjusted the size of checkboxes and radio buttons, making them scalable during zoom.
# implemented refresh functions for ''RadioButton'', ''ListEdit'', and ''ComboEdit'' fields.
# Ability to revert an unacceptable field value back to the original committed value.
 
* '''Bug Fixes for Locale-Specific Calculations''': 
# Fixed incorrect numerical interpretation in form calculations when using different locales, improving the accuracy of form-based computations.


== Links to Blogs and other writing ==
== Links to Blogs and other writing ==
Line 39: Line 65:
* https://prathamgandhi.github.io/posts/gsoc24-update2
* https://prathamgandhi.github.io/posts/gsoc24-update2
* https://prathamgandhi.github.io/posts/gsoc24-update3
* https://prathamgandhi.github.io/posts/gsoc24-update3
* https://prathamgandhi.github.io/posts/gsoc24-update4

Latest revision as of 18:23, 20 October 2024

Forms/Javascript support improvement for Okular

Okular, the document viewer supports PDFs with forms. These forms often use Javascript to make forms more convenient for its users. However, as of today, the support for Javascript within Okular is quite lacking with large number of open bugs.

This project aims to improving the support for PDF forms in Okular as much as possible and make the feature set more consistent with Adobe Acrobat.

Work report

Below is the list of bug fixes and new features added during the GSoC 2024 period:

  • Support for Acrobat Pre-Defined Methods:

Added support for key Acrobat methods, enabling correct processing of text fields:

  1. AFNumber_Keystroke
  2. AFSpecial_Keystroke
  3. AFMerge_Change
  4. AFTime_Keystroke
  5. AFDate_FormatEx
  6. AFDate_KeystrokeEx
  7. AFPercent_Format
  8. AFPercent_Keystroke
  • Implementation of Event Properties:
  1. Implemented selStart and selEnd properties for event handling.
  2. Fixed the change event property to correctly handle Unicode characters.
  3. Fixed incorrect cursor position calculations during text entry.
  • Mouse Events Support:
  1. Added support for generating event objects for MouseDown, MouseEnter, and MouseExit events. This improves form interactivity.
  • Combobox Events Support:
  1. Implemented Keystroke, Validate, Calculate, and Format events for comboboxes, which were previously not triggered.
  • Fixes for Form Field Event Execution:
  1. Earlier validation events were not being executed. Fixed this bug.
  2. Corrected the execution order of Keystroke, Validate, Calculate, and Format events, especially during undo/redo actions or when modified via JavaScript. These actions are now triggered only when a field value is committed, ensuring proper functionality and improved keyboard usability.
  • Global Object implementation:
  1. A basic implementation of the global object was rolled out. This allows for document level use of a global object.
  • Document-Level Event Support:

Implemented support for the following document-level events, improving overall document interaction:

  1. DocOpen
  2. DocWillClose
  3. DocWillPrint
  4. DocDidPrint
  5. DocWillSave
  6. DocDidSave
  • SubmitForm Functionality:
  1. Added support for reading the SubmitForm action in Poppler. While Okular doesn’t yet implement form submission, this lays the foundation for future integration.
  • Appearance Stream set support for Form Fields:
  1. Implemented a feature in Poppler allowing modification of appearance stream text in form fields without changing the underlying value, enhancing flexibility when working with form elements.
  • Reset Form Functionality:
  1. Added a reset feature for forms in Okular, allowing users to clear fields or revert them to their default values.
  • Form Field Enhancements:
  1. Implemented the 'value (getter), numItems, currentValueIndices properties, and the getItemAt function for FormFieldChoices.
  2. Adjusted the size of checkboxes and radio buttons, making them scalable during zoom.
  3. implemented refresh functions for RadioButton, ListEdit, and ComboEdit fields.
  4. Ability to revert an unacceptable field value back to the original committed value.
  • Bug Fixes for Locale-Specific Calculations:
  1. Fixed incorrect numerical interpretation in form calculations when using different locales, improving the accuracy of form-based computations.

Links to Blogs and other writing

More details about every feature/bug fix and the relevant MR can be found on my blog posts: