I would like to create a pdf form button and other widgets in pdf using python but donot want to us the form generation modules available with pyupdf, borb etc..
I want to create a "Annot" pdf dictionary structure and add all the relevant details of the form button in to it. Request help from the team for a head start
disclaimer I am the author of
borbborballows you to manipulate PDF documents both in a high-level and low-level fashion.You can build forms by adding
LayoutElementobjects that inherit fromFormField.But you can just manipulate the underlying dictionaries of the PDF and do everything yourself. Or even do a combination of both.
Use an existing
LayoutElementto already do most of the heavy lifting for you, and then tweak the final stuff yourself.An example of doing everything yourself can be found here: https://github.com/jorisschellekens/borb-examples?tab=readme-ov-file#85-creating-a-document-using-low-level-syntax
Although this example doesn't go into detail about forms, it does show you how to manipulate the dictionaries that make up the PDF.
You can also find a copy of the PDF spec in the
borbrepository.