pypdf icon indicating copy to clipboard operation
pypdf copied to clipboard

BUG: fix apperance stream options for forms

Open fidoriel opened this issue 2 years 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

What is the state of this PR? Does it improve pypdf?

What is missing to get it merged? (besides resolving the merge conflict)?

MartinThoma avatar Jan 06 '23 22:01 MartinThoma

My comany has decided to not use pypdf in our Project. What is needed:

  • The calculation of the Font size/length and sentence breaks
  • Encode Unicode correctly
  • There are 2 forks of my brach wich might also help as far as I remember
  • Testing that this really fix the issue on all PDF reader

fidoriel avatar Jan 07 '23 13:01 fidoriel

My comany has decided to not use pypdf in our Project. What is needed:

* The calculation of the Font size/length and sentence breaks

* Encode Unicode correctly

* There are 2 forks of my brach wich might also help as far as I remember

* Testing that this really fix the issue on all PDF reader

@fidoriel You should create some PR from your forks.

pubpub-zz avatar Jan 07 '23 21:01 pubpub-zz

My comany has decided to not use pypdf in our Project.

I'm curious: Can you let me know (maybe in private; [email protected]) what you use instead?

MartinThoma avatar Jan 07 '23 21:01 MartinThoma

I'm closing this PR now as it will likely never get merged. I'm sorry.

@pubpub-zz Maybe here are some ideas that would be useful for our current code base. If you do, please give credit in the commit so that we don't loose that information.

MartinThoma avatar Aug 13 '23 07:08 MartinThoma

I've missed it a while ago (sorry about that @fidoriel) but it is another way to fill up forms. The current issues I'm facing are further than this (how to introduce a fulll range true type fonts to allow filling up with Arabic,... @fidoriel If you have any ideas about It will be welcomed

pubpub-zz avatar Aug 13 '23 07:08 pubpub-zz