[reportlab-users] Acroform text widget alignment
Robin Becker
robin at reportlab.com
Thu Oct 8 08:31:16 EDT 2020
......
it would help to know what you are using in ReportLab toolkit to produce your form.
There are two form systems present in pdfbase; the older one is pdfform.py and the later one is acroform. The code in
pdfform uses a pattern style interpolation to create pdf objects directly. It's quite hard to use and not well
understood or maintained.
The acroform code is more recent and attempts to make form building more object oriented. You access canvas.acroForm and
the base object is created automatically. The various widgets are created using methods on the canvas.acroForm object eg
def textfield(self,
value='',
fillColor=None,
borderColor=None,
textColor=None,
borderWidth=1,
borderStyle='solid',
width=120,
height=36,
x=0,
y=0,
tooltip=None,
name=None,
annotationFlags='print',
fieldFlags='',
forceBorder=False,
relative=False,
maxlen=100,
fontName=None,
fontSize=None,
dashLen=3,
):
is the method called to add a textfield. The above ends up adding an annotation to the canvas. It will have a name
NUMBER<d> where <d> is canvas._annotationCount - 1. The annotation gets added to the canvas._doc object and it should be
visible as canvas._doc.id2Object['NUMBER<d>'].
If you are using the older technology then you will need to hack the definitions of the patterns which is hard.
I looked in vain for the /Q usage and failed. I'm using pdf_reference_1-7.pdf do you have another reference; perhaps you
can point me at it.
--
Robin Becker
More information about the reportlab-users
mailing list