[reportlab-users] Need help creating fillable forms with reportlab

Robin Becker robin at reportlab.com
Fri May 10 05:53:04 EDT 2019

Hi Arturo,

this is probably the right place. If I understand it correctly you want to create some fields which have some kind of relation 
with other fields.

We did a good deal of work on fields recently and I believe mostly that works. There's an example here


which illustrates old & new form code.

The new form code accessed via canvas.acroForm is more advanced, but I'm fairly sure we don't support the kind of thing you want 
to do.

I think your use case requires javascript actions which is something we haven't looked at yet very much.

I guess we would need to add an additional actions dictionary to the fields and some way to define the javascript actions.

On 10/05/2019 09:35, Arturo López wrote:
> Hi!
> I need to create a pdf where user fill some fields but other fields are calculated according to the values the user introduces, for example, the user set the number of beers and price for each and total price is calculated automatically in the pdf.
> I need this to be calculated after the pdf is created of course, because it needs user input, in reportlab I create the empty pdf with this instructions in the fields.
> Attached simple concept code to sum two numbers.
> Hope someone have an answer and if it's possible "it is using adobe acrobat" so hoping this functionality is also integrated in reportlab... acroForms have some "name" and "value" fields, but I don't know how to access them
> Here is the reportlab documentation I followed: https://www.reportlab.com/docs/reportlab-userguide.pdf <https://www.reportlab.com/docs/reportlab-userguide.pdf>
> from reportlab.pdfgen import canvas
> from reportlab.pdfbase import pdfform
> from reportlab.lib.colors import magenta, pink, blue, green, white
> def GenerarFactura():
Robin Becker

More information about the reportlab-users mailing list