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.12k stars 1.39k forks source link

DOC: Small improvements to Markdown files #2695

Closed j-t-1 closed 4 months ago

j-t-1 commented 4 months ago

Including sorting imports of Python examples

codecov[bot] commented 4 months ago

Codecov Report

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

Project coverage is 95.12%. Comparing base (4c99de8) to head (811318c).

:exclamation: Current head 811318c differs from pull request most recent head 461bb1d

Please upload reports for the commit 461bb1d to get more accurate results.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #2695 +/- ## ======================================= Coverage 95.12% 95.12% ======================================= Files 51 51 Lines 8521 8521 Branches 1700 1700 ======================================= Hits 8106 8106 Misses 261 261 Partials 154 154 ```

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

j-t-1 commented 4 months ago

In order to ease locating page fields you can use get_pages_showing_field of PdfReader or PdfWriter. This method accepts a field object, a PdfObject that represents a field (as extracted from _root_object["/AcroForm"]["/Fields"]). The method returns a list of pages, because a field can have multiple widgets as mentioned previously (e.g. radio buttons or text displayed on multiple pages).

Identify pages where fields are used

_root_object["/AcroForm"]["/Fields"]) -> root_object["/AcroForm"]["/Fields"])?