import fitz # PyMuPDF import calendar import sys assert len(sys.argv) == 2, "need start year as the one and only parameter" startyear = sys.argv[1] assert startyear.isnumeric(), "year must be positive numeric" startyear = int(startyear) assert startyear > 0, "year must be positive numeric" doc = fitz.open() # new empty PDF cal = calendar.LocaleTextCalendar(locale = "de") # choose your locale txt = cal.formatyear(startyear, m = 4, c = 10) doc.insertPage(-1, txt, fontname = "Courier", width = 842, height = 595) txt = cal.formatyear(startyear + 1, m = 4, c = 10) doc.insertPage(-1, txt, fontname = "Courier", width = 842, height = 595) txt = cal.formatyear(startyear + 2, m = 4, c = 10) doc.insertPage(-1, txt, fontname = "Courier", width = 842, height = 595) doc.save("calendar.pdf", garbage = 4, deflate = True)