[reportlab-users] Acroform text widget alignment
Robin Becker
robin at reportlab.com
Thu Oct 8 09:22:24 EDT 2020
I messed up the explanation of how to access the annotations via canvas.acroForm this exampl shows how
if __name__=='__main__':
from reportlab.pdfgen.canvas import Canvas
canv = Canvas('aaa.pdf')
tf = canv.acroForm.textfield()
print(canv._doc.idToObject[canv._annotationrefs[-1].name].dict)
....... for me this produces
python tmp/tf.py
{'FT': '/Tx', 'P': <reportlab.pdfbase.pdfdoc.PDFObjectReference object at 0x7f675bec6f40>, 'V':
<reportlab.pdfbase.pdfdoc.PDFString object at 0x7f675bec6e50>, 'DV': <reportlab.pdfbase.pdfdoc.PDFString object at
0x7f675bec6e50>, 'Rect': <reportlab.pdfbase.pdfdoc.PDFArray object at 0x7f675bed81f0>, 'AP':
<reportlab.pdfbase.pdfdoc.PDFDictionary object at 0x7f675bed8250>, 'Subtype': '/Widget', 'Type': '/Annot', 'F': 4, 'Ff':
0, 'DA': <reportlab.pdfbase.pdfdoc.PDFString object at 0x7f675bed82b0>, 'MaxLen': 100, 'T':
<reportlab.pdfbase.pdfdoc.PDFString object at 0x7f675bed8310>, 'BS': <reportlab.pdfbase.pdfdoc.PDFDictionary object at
0x7f675bed83d0>, 'MK': <reportlab.pdfbase.pdfdoc.PDFDictionary object at 0x7f675bed8490>}
so you should be able to do
canv._doc.idToObject[canv._annotationrefs[-1].name][Q] = 1
--
Robin Becker
More information about the reportlab-users
mailing list