Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23189

Method for detecting an auto page break - pyfpdf

$
0
0

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

Viewing all articles
Browse latest Browse all 23189

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>