I'm currently using the fillpdf Python library to fill a template PDF with generated data. I'm running this process on Ubuntu 20.04 server, trying to print to a Kyocera ECOSYS p4060dn.
An example of how I'm using the code:
import fillpdf
from fillpdf import fillpdfs
data_dict = {
'Season1': '2025-2026',
'Season2': '2025-26',
'MemberName': 'Test',
'Address': '123 Sesame St',
'CityStateZip': 'Birmingham, AK 12345-6789',
'Number': '9999999',
'Level': '1'
}
fillpdfs.write_fillable_pdf('/home/myuser/template.pdf', '/home/myuser/filled.pdf', data_dict, flatten=True)
This appears to work as intended, as when I copy the filled PDf to my Windows machine and open it, the fields are filled with the provided data.
However my issue is that when I try to print the PDF, it prints without the forms filled in. There are no cups errors in /var/log/cups/error_log related to the print, and access_log similarly looks all good.
I'm printing by using the command
lp -d [printer] /path/to/PDf
I have the printer setup with the right driver, and strangely if I fill the PDF on my windows machine and copy it up to the Ubuntu server then print, it prints just fine, fields filled and all.
I've tried using different libraries like PyPDF2, PyPDF, and pdfrw to fill the fields and flatten, all to the same result of the fields being filled but not printing with them filled, or occasionally no print at all.
Any guidance would be greatly appreciated
EDIT: The fields are set to print in Acrobat.