There is no need to add to the main_cp
, you can use a blank panel form and add to it.
Here is how I create a PDF with the description of a truck on the first page followed by one page per crate. The PageBreak is imported from Anvil Extras
from anvil_extras.PageBreak import PageBreak
self.add_component(TruckPDF(truck))
for crate in truck.crates:
self.add_component(PageBreak())
self.add_component(CratePDF(crate))