First, I am trying to use Python to dynamically enter data into a secured PDF file, that I downloaded from a government source. I DO NOT have the password to unprotect them, but can open them with a PDF reader and enter data. I have tried using pdftk and an FDF file created from fdf_forge.
I couldn't get the field names from pdftk dump_data_fields
because it wouldn't open the file without the correct owner password. I was able to remove the password from the file with a third-party program and create a file without password, so I got the fields from that. However, while the program I used to remove the password kept the fields in the file, it did something strange and made them bordered with a thick black border. So I don't want to write my FDF data to the cracked PDF, I want to add my data to the original secured PDF, just as if I opened and added the data by hand. However, I can't merge the FDF data into the secured PDF file because I don't know the password.
Any suggestions on how to programatically open a secured PDF file without knowing the password, and enter the data into the fields specified using Python, an FDF, and a call to pdftk from within a Python shell?