In my app I would like to produce a PDF. that shows the date range selected on the datepickers used to do a search on a table that is displayed on a repeating panel, and the repearing panel results, on the documention example all of the form is generated as a pdf, I didnt understand how to pick only some elements of the form for the pdf
here is my proyect
I’m on my cell and I can’t clone, but if I understand your question, you are asking how to print only certain elements of the input form.
One way, not the right one, is to pass a parameter to the form and use it to set the visibility of some components in the
form_show event. Something like:
self.comp_1.visible = generating_pdf
self.comp_2.visible = not generating_pdf
Another way, much better, is to create two different forms, one for input and one for pdf generation.
The best way is to create a form for your PDF layout, pass your variables from the input form to a server code, and run that which generates the PDF if you pass the variable into your pdf form init.
The invoice tutorial covers this really well.
im not sure how to pass the parameter to the form, I couldnt understand your explanation
You can add an optional parameter to the form:
def __init__(self, generating_pdf=False, **properties):
This parameter will not be set by Anvil while using the form in the browser, so it will get the default
False value, but you can use it when you render the pdf with:
This form can use the
generating_pdf variable inside the
__init__ to decide what’s visible while generating the pdf and what’s visible on the browser.