SuffolkLITLab / FormFyxer

A tool for learning about and pre-processing forms
MIT License
11 stars 1 forks source link

Adjust API of swap_pdf to make a general-purpose utility to copy fields #29

Closed nonprofittechy closed 2 years ago

nonprofittechy commented 2 years ago

LGTM. There might be some complications in the offsets and the root AcroForm object: it's not organized by page, though each field only appears on one page (through the annotation). This wouldn't work for someone trying to keep their fields on the first page and just replace later pages. I don't know what would though, so this is a good API for now, and we can improve internals later.

Just to clarify, if the offset in the pages attribute isn't by pages, we may want to remove it. But I'm okay with assuming that you don't want to keep any of the fields in the destination doc even if you use the offset. In my mind, the offset is to accommodate someone adding an instructions cover page to the destination document while the original document didn't have one.