py-pdf / pypdf

A pure-python PDF library capable of splitting, merging, cropping, and transforming the pages of PDF files
https://pypdf.readthedocs.io/en/latest/
Other
8.44k stars 1.42k forks source link

Forms: appearance generation broken for autosized fields, fields with center alignment and unicode text #1919

Open brzGatsu opened 1 year ago

brzGatsu commented 1 year ago

Hi @pubpub-zz, absolutely appreciate your effort in fixing py-pdfs form capabilities. I tested 3.11.1 and replaced pdftk with pypdf in our app. Its already looking quite good but there are still some appearance generation issues:

Tested with current Acrobat Reader and Sumatra, happens on both.

Relates to: https://github.com/py-pdf/pypdf/issues/1306 https://github.com/py-pdf/pypdf/issues/355

pubpub-zz commented 1 year ago

@brzGatsu. When you are clicking on the fields the viewer is generating the appearance. this is why results looks good that way. Can you provide some PDFs for point 1 and 2.

brzGatsu commented 1 year ago

Sure, in this pdf you can observe all 3 problems:

  1. All the numbers should be center aligned
  2. The "Talente" column is set to auto font size, check the "Talente" cell in the row "Gebräuche" - its content only shows when clicking in the field.
  3. Same Row - the text Gebräuche is malformed. pypdf_forms_bug.pdf
pubpub-zz commented 1 year ago

the autosize has been fixed in PR #2002

brzGatsu commented 2 months ago

Hi there, just want to let you know that a fix would still be still relevant for us - we are still stuck with PDFtk.

stefan6419846 commented 2 months ago

As always, you are of course invited to further analyze this and propose a corresponding PR to fix this.