I am designing a tool to display a git repository's commits in PDF form with pyfpdf.
It have designed it so that each commit only spans across one page if possible. However, if a commit is longer than a page, I simply draw it and allow FPDF to handle the page breaking for me. This is fine when I am generating the PDF in light mode, but when doing it in dark mode, all the pages that were automatically broken to when generating a multipage commit are not picked up by my program, so I don't know when to draw a custom dark page background.
Some code to explain what I would like to add to fix my problem:
def page_break_callback(pdf): pdf.draw_dark_page_bg()pdf = FPDF()draw_commit(long_commit_description) # This will call page_break_callback