I am generating pdf invoice using fpdf.
Some invoices containing many items, and details need to go into the second page. However, I need the total, and other details
I had the same issue and I overrode a few methods of the FPDF class and was able to fix it in a fairly simple manner. In order to go back and forth pages, you simply need to change the page attribute of the FPDF object. However, once you go back a page, when you progress to the next page, you'll end up adding a new page instead of progressing to the already existing one. To deal with this issue, I created a boolean called add_new_page, and used it in my rewritten accept_page_break method to see whether or not to create a new page or progress to an already existing one.
def prev_page(self):
self.page -= 1
self.add_new_page = False
def next_page(self):
self.page += 1
def accept_page_break(self):
"Accept automatic page break or not"
if self.add_page:
return self.auto_page_break
else:
self.page += 1
self.add_new_page = True