[reportlab-users] Retrieving Form Values from a ReportLab PDF

Robin Becker robin at reportlab.com
Wed Sep 2 13:51:27 EDT 2020


On 02/09/2020 17:15, Mike Romey wrote:
> Hi Robin,
> 
> I am having some other issues with forms as well.  If you look at my
> origins code sample I am using pdfform to add my input fields inside the
> cell of a field using flowable's.  However, I noticed that acroform has
> some additional and better options.  How do I maintain a table with cells
> and flowable but also use acroform widgets?  For example, I really want to
> use the choice widget but it doesn't seem possible this way
> and selectFieldRelative clobbers the height of my form.  Thoughts?
> 
> Romey
> 
........
Mike,

there are a bunch of issues with fields. Theer are a couple of examples in the reportlab source code tests see eg

https://hg.reportlab.com/hg-public/reportlab/file/tip/tests/test_pdfbase_pdfform.py
line 47 onward which tests the new AcroForm stuff.

You are making flowables which add form fields to the canvas. You can add such a flowable to table cells. However, you 
become responsible for the sizing and ensuring you don't overlap etc etc. The table should lay the flowable out 
correctly provided the flowable wrap produces the right answers and the draw method does the right thing. when draw is 
called the canvas origin should be correct so perhaps you can experiment with using the non relative version. I haven't 
done a lot of this so you are at the sharp end.

An important thing to note is that although you can specify all sorts of properties concerning layout/colours for the 
fields they are actually rendered by the viewer when viewed so may not actually match your expectations. That might 
change with viewer options or when the pdf is printed.
-- 
Robin Becker


More information about the reportlab-users mailing list