Re: Acroform text widget alignment
Robin Becker <[email protected]> Thu, 8 Oct 2020 14:22:24 +0100
| Newsgroups | gmane.comp.python.reportlab.user |
|---|---|
| Message-ID | <[email protected]> |
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