I ended up with the following solution. Added custom id flo_id for each thread. And override the handle_flowable method in BaseDocTemplate, where the id was checked and stored,
class SignDocTemplate(BaseDocTemplate): blocks_to_pages = {} def handle_flowable(self, flowables): f = flowables[0] BaseDocTemplate.handle_flowable(self, flowables) if hasattr(f,'flo_id'): if self.blocks_to_pages.has_key(self.canv._pageNumber): self.blocks_to_pages[self.canv._pageNumber].append(f.flo_id) else: self.blocks_to_pages[self.canv._pageNumber]= [f.flo_id,]
And after creating the document, it will be available in the document instance in the variable blocks_to_pages.
source share