Re: Retrieving Form Values from a ReportLab PDF
Robin Becker <[email protected]> Wed, 2 Sep 2020 18:51:27 +0100
| Newsgroups | gmane.comp.python.reportlab.user |
|---|---|
| Message-ID | <[email protected]> |
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