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
7.73k stars 1.36k forks source link

ENH: Create /Font if not exists (#2670) #2671

Closed BrooksWatson717 closed 4 weeks ago

BrooksWatson717 commented 1 month ago

Updates the _writer.py to create the /DR and /Font dictionaries, and add a font (Helvetica) if they don't exist. This enables filling out PDF forms.

Response to issue #2670

stefan6419846 commented 1 month ago

Thanks for the PR. Besides of the above remarks, could you please add a corresponding test as well?

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 95.01%. Comparing base (109ef4a) to head (aed6a28).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #2671 +/- ## ======================================= Coverage 95.00% 95.01% ======================================= Files 50 50 Lines 8356 8362 +6 Branches 1673 1674 +1 ======================================= + Hits 7939 7945 +6 Misses 259 259 Partials 158 158 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

pubpub-zz commented 1 month ago

I've proposed an alternative PR #2677