Bug 443403 - Reduce the size of the digital signature display
Summary: Reduce the size of the digital signature display
Status: ASSIGNED
Alias: None
Product: okular
Classification: Applications
Component: PDF backend (show other bugs)
Version: 22.08.1
Platform: Fedora RPMs Linux
: NOR wishlist
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-10-06 15:08 UTC by Björn
Modified: 2024-09-16 15:38 UTC (History)
19 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
2 signatures with different space requirements (120.94 KB, application/pdf)
2021-10-21 13:45 UTC, Björn
Details
Frame of the signature (27.64 KB, image/png)
2022-02-03 21:43 UTC, Enrique Artal
Details
example font too big (133.90 KB, image/png)
2022-12-16 07:26 UTC, MarcSerra
Details
Test document with adobe and okular signatures same field size (136.08 KB, image/png)
2022-12-16 09:23 UTC, AdrianVD
Details
Signature via form field (37.51 KB, image/png)
2022-12-18 11:47 UTC, rschmehl
Details
Signature via user-specified rectangular area (46.73 KB, image/png)
2022-12-18 11:50 UTC, rschmehl
Details
Example of too-large font for digital signature (21.14 KB, image/png)
2023-04-11 14:01 UTC, jat255
Details
An example for a document with no space limits for the signature. All ok for me. (40.31 KB, image/png)
2023-08-25 08:30 UTC, MarcSerra
Details
An example of a document with a limited heigth for the signature. On the big text part the ID is missing and the name it's cutted. (163.94 KB, image/png)
2023-08-25 08:32 UTC, MarcSerra
Details
The ID and name big text is bigger than expected and the ID text is cutted. You can compare the signature with adobe acrobat it's more beatyfull. (51.95 KB, image/png)
2023-08-25 08:35 UTC, MarcSerra
Details
Another example with the big text name cutted and ID missing. (124.20 KB, image/png)
2023-08-25 08:36 UTC, MarcSerra
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Björn 2021-10-06 15:08:04 UTC
The digital signature takes too much space to display on the PDF. 

It would be good if it takes the same space as the Adobe Acrobat product. 

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: openSUSE Tumbleweed
(available in About System)
KDE Plasma Version: 5.22.5
KDE Frameworks Version: 5.86.0
Qt Version: 5.15.2
Comment 1 Albert Astals Cid 2021-10-06 21:40:53 UTC
Can you attach a screenshot of what you think takes too much space?
Comment 2 Bug Janitor Service 2021-10-21 04:35:29 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 3 Björn 2021-10-21 13:45:21 UTC
Created attachment 142724 [details]
2 signatures with different space requirements

2 signatures with different space requirements. The first one from "Bjoern Adelberg" is too big. 

The problem is that documents are created in which there are certain areas where a signature should be displayed. The document creator plans for a certain size, which is based on the size of certificates from Adobe.
Comment 4 Albert Astals Cid 2021-10-21 21:49:55 UTC
I don't understand the problem. You made the first one, you chose exactly which rectangle you wanted the signature to use, so why did you chose such a huge area instead of a smaller one?
Comment 5 Enrique Artal 2022-02-03 21:43:18 UTC
Created attachment 146239 [details]
Frame of the signature

This is the frame of a signature (only edited to erase some personal data); if I choose a smaller frame, it complains as it is too small. I do not see a way to change the size of the font. This is done in Fedora 35 with okular-21.12.2 compiled from sources.
Comment 6 Björn 2022-02-09 16:29:23 UTC
(In reply to Enrique Artal from comment #5)
> Created attachment 146239 [details]
> Frame of the signature
> 
> This is the frame of a signature (only edited to erase some personal data);
> if I choose a smaller frame, it complains as it is too small. I do not see a
> way to change the size of the font. This is done in Fedora 35 with
> okular-21.12.2 compiled from sources.

I use the same version 21.12.2 but the problem persists. I did not compile it myself, but from the package manager of my distribution. Is there a way to adjust the font size manually?
Comment 7 Stefan 2022-02-22 16:18:53 UTC
Hi,
to my mind, the signature should auto resize according to the box size. At least this is the behavior in Adobe Reader. 

And maybe the frame and the gray background can be removed or at least reduced? This is just a visual thing, but in a document with several other Adobe signatures it looks a little bit "lost" ... not sure how to describe it. Oh, and no frame means more space for the signature ^^
Comment 8 Alessandro 2022-05-25 16:53:55 UTC
I just installed version 22.04.1 of Okular (on an Ubuntu 20.4 platform) and the problem is still there: when I go to Tools-->DigitallySign, I am asked to create a box to hold my signature. If the box is too small, I am asked to re-draw it (but I do not see any indication of how large it should be -- hence I need to go through a few iteration to identify the "optimal" size). My name and the date of signature are then placed in the box but their font is too large. Also, the signature box has a gray background which makes it stand out in a not-so-pleasant way.

Can anything be done to control the background colour and the font size used in the signature box?

This is a great tool but the issues reported in this ticket really make its use in a professional environment difficult ...
Comment 9 Nicolas Fella 2022-10-07 09:39:36 UTC
Adjusting the font size according to the box size could be a relatively easy way to address this.

However I think the overall UX could still be improved. We are asking the user to specify an area where they initially have no idea what size would be appropriate for the content. The the user has to figure out the best size  through trial and error. Perhaps we could do something like

1. The user starts signing
2. Okular asks which certificate should be used
3. Based on the certificate content Okular calculates a suggested rectangle and places that somewhere
4. The user can resize and move the rectangle as needed
5. The user saves and the PDF is signed
Comment 10 Enrique Artal 2022-10-22 21:27:07 UTC
I agree!


(In reply to Nicolas Fella from comment #9)
> Adjusting the font size according to the box size could be a relatively easy
> way to address this.
> 
> However I think the overall UX could still be improved. We are asking the
> user to specify an area where they initially have no idea what size would be
> appropriate for the content. The the user has to figure out the best size 
> through trial and error. Perhaps we could do something like
> 
> 1. The user starts signing
> 2. Okular asks which certificate should be used
> 3. Based on the certificate content Okular calculates a suggested rectangle
> and places that somewhere
> 4. The user can resize and move the rectangle as needed
> 5. The user saves and the PDF is signed
Comment 11 AdrianVD 2022-10-30 23:14:56 UTC
Previous versions the signature was a bit smaller. Now it is completely disproportionate especially for long names
Comment 12 MarcSerra 2022-12-16 07:26:00 UTC
Created attachment 154616 [details]
example font too big
Comment 13 MarcSerra 2022-12-16 07:26:36 UTC
Attached another example using okular 22.08.3
Comment 14 AdrianVD 2022-12-16 09:23:57 UTC
Created attachment 154617 [details]
Test document with adobe and okular signatures same field size
Comment 15 Oliver Sander 2022-12-16 09:27:32 UTC
This is probably fixed by https://invent.kde.org/graphics/okular/-/merge_requests/537
Comment 16 AdrianVD 2022-12-16 09:41:59 UTC
(In reply to Oliver Sander from comment #15)
> This is probably fixed by
> https://invent.kde.org/graphics/okular/-/merge_requests/537

Hopefully yes. The request is 11 month old though ...
Comment 17 rschmehl 2022-12-18 11:47:49 UTC
Created attachment 154666 [details]
Signature via form field

Signature via form field produces an unreadable visual representation of the digital signature
Comment 18 rschmehl 2022-12-18 11:50:36 UTC
Created attachment 154667 [details]
Signature via user-specified rectangular area

As reported earlier the static font size in the signature box is too large. Would be nice if that could be adapted dynamically, to fit all content.
Comment 19 jat255 2023-04-11 14:01:16 UTC
This bug should be classified as "CONFIRMED", correct? It's affecting multiple people including myself. My use case is documents that have what I would consider a normally-sized signature area at the bottom. When I sign, all that gets displayed is a huge text version of my first name (see attachment), which looks very unprofessional compared to Adobe digital signatures.
Comment 20 jat255 2023-04-11 14:01:52 UTC
Created attachment 158016 [details]
Example of too-large font for digital signature
Comment 21 paul.beach 2023-08-02 18:49:29 UTC
I'm not sure if this is a bug, or rather a new feature request, but I too would like to have the ability to adjust the size of the digital signature (or ideally, have it auto-resize like Adobe does). When signing a document where other users used Adobe PDF, signatures that were created by Okular are much larger (they stand out like John Hancock's signature would!)
Comment 22 Enrique Artal 2023-08-24 21:59:25 UTC
In version 23.08.0 there are some nice improvements about digital signature, but the size of the fonts is still very big and non adjustable. Any hope?
Comment 23 Sune Vuorela 2023-08-25 06:47:01 UTC
(In reply to Enrique Artal from comment #22)
> In version 23.08.0 there are some nice improvements about digital signature,
> but the size of the fonts is still very big and non adjustable. Any hope?

It is not currently on *my* work table.

What could help this would be a thorough proposal about
 - What fixed things should be changed - from what and to what. Be specific.
 - What should be adjustable?
    - In what dialogs should the adjustability be? How should it look like? Can you visualize it somehow?
    - What should the work flow be for doing this?

And get several of the bug submitters behind it (and preferably also contact KDE's visual design team for support)

Currently it is mostly people pulling in various directions and a lot of not-concrete things; if it can somehow be consolidated to a great proposal, it might help on progress.

About visualization:
 I'm not picky. It can be a photo of a piece of paper with lines on. It can be mockup tools. Or kolourpaint. Or it can just be a file from QtDesigner
Comment 24 Enrique Artal 2023-08-25 07:04:35 UTC
(In reply to Sune Vuorela from comment #23)

Thanks for the answer.

> (In reply to Enrique Artal from comment #22)
> > In version 23.08.0 there are some nice improvements about digital signature,
> > but the size of the fonts is still very big and non adjustable. Any hope?
> 
> It is not currently on *my* work table.

I understand it; this problem was reported almost two years ago and there are several people that have confirmed it. Any of the attached images by several users show the issue. 
> 
> What could help this would be a thorough proposal about
>  - What fixed things should be changed - from what and to what. Be specific.

Apparently when one chooses a frame the size of the fonts does not depend on the size of the frame. As a consequence one has two big letters, not aligned, and even some part of the name. In some documents one can put a large frame to avoid it (though the result is not aestethically optimal) but some other documents have very few space for the frame

>  - What should be adjustable?
One option is that the size of the font is chosen in terms of the size of the frame. The other option is to open a dialog for this choice (as it is now for a background image). I do not know if it is possible to implement it.
>     - In what dialogs should the adjustability be? How should it look like?
For the first choice, it would be internal. For the second one, add one more line in the frame asking you for certificate, location, image, etc.
> Can you visualize it somehow?
>     - What should the work flow be for doing this?

I do not know if I can be more helpful, but I would be glad to test any progress.
> 
> And get several of the bug submitters behind it (and preferably also contact
> KDE's visual design team for support)
> 
> Currently it is mostly people pulling in various directions and a lot of
> not-concrete things; if it can somehow be consolidated to a great proposal,
> it might help on progress.
> 
> About visualization:
>  I'm not picky. It can be a photo of a piece of paper with lines on. It can
> be mockup tools. Or kolourpaint. Or it can just be a file from QtDesigner

Thanks again, Enrique.
Comment 25 MarcSerra 2023-08-25 08:30:41 UTC
Created attachment 161166 [details]
An example for a document with no space limits for the signature. All ok for me.
Comment 26 MarcSerra 2023-08-25 08:32:56 UTC
Created attachment 161167 [details]
An example of a document with a limited heigth for the signature. On the big text part the ID is missing and the name it's cutted.
Comment 27 MarcSerra 2023-08-25 08:35:05 UTC
Created attachment 161168 [details]
The ID and name big text is bigger than expected and the ID text is cutted. You can compare the signature with adobe acrobat it's more beatyfull.
Comment 28 MarcSerra 2023-08-25 08:36:00 UTC
Created attachment 161169 [details]
Another example with the big text name cutted and ID missing.
Comment 29 MarcSerra 2023-08-25 08:36:48 UTC
I just attached 4 real examples. Please take a look. Thank's!
Comment 30 Enrique Artal 2023-08-25 08:51:48 UTC
(In reply to MarcSerra from comment #29)
> I just attached 4 real examples. Please take a look. Thank's!

Basically, I encountered all the issues illustrated by Marc; at least you can dance! :)
Comment 31 smihael 2023-11-16 12:37:30 UTC
This particular issue has been bothering me for a long while, so I tried to investigate if this could be addressed easily.

A quick solution is to add the following line:

pData->setFontSize(10);

to the following file:
https://invent.kde.org/graphics/okular/-/blob/release/23.08/generators/poppler/generator_pdf.cpp#L1382

Side note: After compiling Okular from source (https://okular.kde.org/build-it/) make sure to also update the library path (otherwise system version of the compiled generator_pdf will be called). 

At this point, I cannot make any pull request, because there are several other things that should be addressed. The font size setting could be added to: https://invent.kde.org/graphics/okular/-/blob/release/23.08/part/selectcertificatedialog.ui

However, the "signature is too small" warning dialogue is currently somewhat arbitrary and based on fixed pixel size (https://invent.kde.org/graphics/okular/-/blob/release/23.08/part/pageviewannotator.cpp#L358) so without further changes the user would get the warning even with the smaller font size.

A more adaptive solution (font size automatically determined from annotation box size), would probably require changes in the poppler library.
Comment 32 smihael 2023-11-16 18:07:58 UTC
I made a merge request at: https://invent.kde.org/graphics/okular/-/merge_requests/839
Comment 33 igor.machado@gmail.com 2023-11-17 13:49:46 UTC
For me, the font size is the greatest issue, since in Brazil with university ICP-EDU RNP certificates, the Full Name is connected with the national number (called CPF), that has 11 digits... So, the left side is typically giant and broken, unless a very large space is provided.
I created two tutorials that have been used in brazilian universities, and they explain exactly about this problem (but in Portuguese):
- https://igormcoelho.medium.com/assinatura-digital-do-icpedu-em-pdf-no-gnu-linux-c612688ce454
- https://igormcoelho.medium.com/assinatura-digital-do-icpedu-com-carimbo-utilizando-okular-98c146066c3a
I also created some PDF with "enough space" for the current signature system, which is quite large:
- https://raw.githubusercontent.com/igormcoelho/igormcoelho/main/tutoriais/2021-Teste-Assinatura-Digital.pdf

A solution, at least for me, is to allow to reduce font size when selecting the Stamp box for signature (together with fields Reason, etc, one could select "Font Size: 20" or "Font Size: XX").
Comment 34 Nicolas Fella 2023-12-11 17:39:44 UTC
There are multiple scenarios to consider here:

1) Singing a predefined signature field. Here the size is fixed and currently we risk cutting off the text because it is too large. The font size should automatically be chosen so that the text fits into the predefined box

2) We add a new signature to the document. Here we get to choose the bounding box, but we have to consider that space on the document may be limited. Ideally we would have something like I described in https://bugs.kde.org/show_bug.cgi?id=443403#c9
- When adding a signature we collect the necessary information
- Then we calculate a reasonable suggested bounding box and place that somewhere on the document
- Then the user is able to move and resize the proposed signature as they desire. When resizing the font scales appropriately so that the text always fits
- The user hits "Apply" of some sort and the signature is baked into the signed document
Comment 35 Bug Janitor Service 2024-04-03 17:29:38 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/okular/-/merge_requests/965
Comment 36 Bug Janitor Service 2024-04-04 15:02:56 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/okular/-/merge_requests/966
Comment 37 Nicolas Fella 2024-04-15 12:30:30 UTC
Git commit 465b9ff5cea0cc4d4f35308ac1bb3d84a912cda9 by Nicolas Fella.
Committed on 15/04/2024 at 12:24.
Pushed by nicolasfella into branch 'master'.

Let poppler pick the font size when signing signature fields

Currently we use the default font sizes for NewSignatureData, which are 10 for fontSize and 20 for leftFontSize

This can be too large for a small signature field, leasing to cut-off text

When passing 0 poppler picks a suitable size depending on the size of the signature field

M  +5    -0    generators/poppler/formfields.cpp

https://invent.kde.org/graphics/okular/-/commit/465b9ff5cea0cc4d4f35308ac1bb3d84a912cda9
Comment 38 Bug Janitor Service 2024-06-06 15:11:08 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/okular/-/merge_requests/1005
Comment 39 Nicolas Fella 2024-09-12 13:00:34 UTC
Git commit e165180bb0db38e780e7fcd425cff186f48abd12 by Nicolas Fella.
Committed on 12/09/2024 at 12:54.
Pushed by aacid into branch 'master'.

Rework UX for adding digital signature

Currently when adding a signature the user is prompted to specify a
rectangle, then chose a certificate. The problem here is that the
user doesn't know what size is appropriate, so it takes some trial and
error to get something good.

To address this change the flow a bit. First ask which certificate and
other parameters should be used. With that information we create a
signature annotation object and add that to the page. The user can
then move and resize it like any annotation util the size and placement
is right.

Once the user is happy with the placement they click on a Finish Signing
button that then prompts for where to save the signed document and signs
it.

This makes the warning about a too small signature rect redundant since
the user sees that the signature won't fit. It was only an approximation
anyway.

M  +6    -0    CMakeLists.txt
M  +133  -0    core/annotations.cpp
M  +56   -0    core/annotations.h
M  +6    -0    core/document.cpp
M  +5    -0    core/document.h
M  +8    -0    core/signatureutils.h
M  +50   -0    generators/poppler/annots.cpp
M  +47   -1    part/pageview.cpp
M  +10   -0    part/pageview.h
M  +133  -45   part/pageviewannotator.cpp
M  +4    -0    part/pageviewannotator.h
M  +23   -0    part/part.cpp
M  +6    -0    part/part.h
M  +1    -0    shell/shell.cpp

https://invent.kde.org/graphics/okular/-/commit/e165180bb0db38e780e7fcd425cff186f48abd12
Comment 40 Bug Janitor Service 2024-09-16 15:38:52 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/okular/-/merge_requests/1053