pypdf icon indicating copy to clipboard operation
pypdf copied to clipboard

BUG: fix apperance stream options for forms

Open fidoriel opened this issue 1 year ago • 10 comments

add apperance stream option to update_page_form_field_values. If true it generates apperance streams but only for one line. There are also issues with non-ascii characters not showing. This is a fix for #355.

fidoriel avatar Aug 17 '22 09:08 fidoriel

Thank you for taking care of it :heart: It would be amazing if we could finally close this long-standing issue!

I'll try to test it on Saturday. In the mean time, would you mind to run black . (installable via pip install black) to get rid of the flake8 issues?

MartinThoma avatar Aug 17 '22 18:08 MartinThoma

Codecov Report

Merging #1248 (abdee76) into main (cb6c224) will decrease coverage by 0.52%. The diff coverage is 6.66%.

@@            Coverage Diff             @@
##             main    #1248      +/-   ##
==========================================
- Coverage   94.67%   94.14%   -0.53%     
==========================================
  Files          30       30              
  Lines        4976     5006      +30     
  Branches     1025     1026       +1     
==========================================
+ Hits         4711     4713       +2     
- Misses        149      176      +27     
- Partials      116      117       +1     
Impacted Files Coverage Δ
PyPDF2/_writer.py 87.45% <6.66%> (-4.10%) :arrow_down:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov[bot] avatar Aug 17 '22 21:08 codecov[bot]

Hoping for a quick integration and release. With this change I will start using PyPdf!

brzGatsu avatar Sep 04 '22 11:09 brzGatsu

I will check the changes in https://github.com/Vigrond/PyPDF2/tree/appearance-stream made to my PR and integrate them. Maby we will find a solution for multi-line word px calculation and the encoding.

fidoriel avatar Sep 04 '22 12:09 fidoriel

How are things going @fidoriel ?

MartinThoma avatar Sep 18 '22 09:09 MartinThoma

Since my last message I did not invest time into this isssue. Not using external dependencies makes it very hard to calculate text px based on the font.

fidoriel avatar Sep 18 '22 09:09 fidoriel

I understand that. Is there a specific external dependency that would help a lot?

@pubpub-zz Did you calculate the text px size anywhere already?

MartinThoma avatar Sep 18 '22 10:09 MartinThoma

I think https://github.com/python-pillow/Pillow can do the job

And then there is the thing with special chraracters encoding where I have no idea

fidoriel avatar Sep 18 '22 10:09 fidoriel

If you mean the Height, Yes : the function is available, for horizontal no. @fidoriel, It is a little easier and complex at the same time : widths are already provided in the fonts There is still some work to extract the data and compute for each line,

pubpub-zz avatar Sep 18 '22 10:09 pubpub-zz

Sorry if this is a stupid question, but why is text measuring important? I thought the PDF reader takes care of form rendering? Asking because I'd rather have the form filling finally working than wait for edge-case fixes.

brzGatsu avatar Sep 19 '22 16:09 brzGatsu