PDF Render with container from form

Hi there,

  • Is it possible to render just a container from the Form rather than the entire Form?
    similar to …render_form(‘Form1().xp_panel_1’)
  • Is it possible to render more forms at once: similar to …render_form(‘Form1’, ‘Form2’)

Code Sample:

# this is a formatted code snippet.
# paste your code between ``` 
    pdf = PDFRenderer(filename=file_name, 
                      scale=0.6,
                      #page_size='A4', 
                      landscape = True,
                      quality='original',
                      margins={'top': 1, 'bottom': 1, 'left': 1, 'right': 1}
                      ).render_form('Form1')

Thank you,
Gerhard

You can have a blank panel and add other forms to it. Something like this:

class PrintPDF(PrintPDFTemplate):
    def __init__(self, some_options, **properties):
        self.init_components(**properties)

        self.add_component(Form1(some_options))
        for n, some_item in enumerate(some_options.some_list):
            self.add_component(PageBreak())
            self.add_component(Form2(n, some_item))

Ciao Stefano,

thank you for the fast replay.
I have to try you solution.

I just tried with adding a blank for and adding the form.

self.add_component(Form3().card_project, full_width_row=True)

No issues at all with the complete form when adding only the container: from the form:
This component is already added to a container, call remove_from_parent() first

I removed the parent first … but I get the error as well?

A container belongs to a form and is initialized inside that form, I don’t think you can move it to another form.

But you can create a form with only that container and its content, then add that to multiple forms.

3 posts were split to a new topic: Snapshot of canvas