PDFRendered: Unable to render a form in its most up-to-date state

I think you’re misunderstanding how Anvil renders a form to a PDF. You’re not getting the current instance of the form the user is seeing, you’re getting a new copy of the form that has no relation to any form the user might be seeing.

That’s why @duncan_richards12 said to pass information to the __init__ of the form via the render_form call. You have to pass in all the information needed to populate the form via that call.

That might mean your form has to work in two modes. One is user-interactive mode, where it does the API calls to get information to display. The other is pdf-rendering mode, where it takes all the information via __init__.

1 Like