I have the code below
d = {'Name': 'James', ' Date':'1/1/2016','City':'Wilmo','County':'United States'}
input_file = PdfFileReader(open(baseDir + 'medicareRRF.pdf', "rb"))
inFields = input_file.getFields()
watermark = PdfFileReader(open(baseDir + "justSign.pdf", "rb"))
output_file = PdfFileWriter()
input_page = input_file.getPage(0)
input_page.mergePage(watermark.getPage(0))
output_file.addPage(input_page)
thisPage = output_file.getPage(0)
output_file.updatePageFormFieldValues(thisPage, d)
Which correctly fills in the PDF with the dictionary (d), but how can I check and uncheck boxes on the PDF? Here is the getField() info for one of the boxes:
u'Are you ok': {'/FT': '/Btn','/Kids': [IndirectObject(36, 0),
IndirectObject(38, 0)],'/T': u'Are you ok','/V': '/No'}
I tried adding {'Are you ok' : '/Yes'}
and several other similar ways, but nothing worked.
Aucun commentaire:
Enregistrer un commentaire