pypdf
pypdf copied to clipboard
BUG: fix apperance stream options for forms
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.
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?
Codecov Report
Merging #1248 (abdee76) into main (cb6c224) will decrease coverage by
0.52%
. The diff coverage is6.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.
Hoping for a quick integration and release. With this change I will start using PyPdf!
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.
How are things going @fidoriel ?
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.
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?
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
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,
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.