Skip to content

Draft: Edit free text annotations within papers

lbaudin requested to merge lbaudin/papers-freetextannotation:main-freetext into main

This branch is a draft that aims to add free text annotations editing. This is a long standing issue #129 and is particularly useful to complete documents such as administrative forms.

Poppler The glib poppler bindings needs to be updated before this branch can be a candidate for merging, thus the draft. I just wanted to give an opportunity for feedback before I attempt to send a merge request to poppler.

Design Contrary to some pdf viewers (at least okular and the pdf editor of ipads), here, free text annotations are not designed to be fixed width, i.e. there is no line wrapping. Instead, users can manually break lines. This seems easier to me, otherwise the UI must let users resize the annotation rectangle (which is what okular does) and I don't think it is particularly useful (since, in my opinion, most use cases are completing forms). We could add a fixed-width mode later on if it appears that it is needed.

GtkTextView When the user edits an annotation, the annotation is hidden and a GtkTextView is put over the PpsView.

The positioning of the annotation and the one of the GtkTextView are not exactly the same. There are two reasons for that :

  • first, GtkTextViews seems to round line positions to integer values, while poppler does not (both for very understandable reason), thus it is complicated to align things when there are multiple lines.
  • second, it looks like the vertical alignment of a line is not exactly the same for GtkTextViews and poppler (I think one aligns the baseline and the other the font descent, or something similar). This might be improved but it is quite difficult to investigate.

So, this result in a slight change of positions for the annotation when it enters the edit mode.

Colors For now there is no way to set borders or background, this may be added before merging if it is seen as useful (however, maybe this could be a next step).

Fonts and colors can be changed in the annotation properties dialog. This UI is not great--but again, it may be a second step. In the future, I guess buttons could overlay the PpsView to change colors and font size.

Capture_d_écran_du_2024-08-03_19-17-55

Capture_d_écran_du_2024-08-03_19-17-02

Merge request reports