Chris Lamb

PDF calendar generation

/wp-content/2007/calendar2008.jpg

As an alternative to those Christmas "round robin" letters, my mum likes to create a calendar to send to relatives. This year, I rewrote the original crufty PHP script in Python:

usage:  pdfcalendar [options]

Generates a simple PDF calendar for the specified year, one page per month,
optionally using images in the specified directory.

To use images, use the --dir argument to specify a directory (or leave empty
to use the current directory) with the structure:

    |-- 01
    |   |-- s6000001.jpg
    |-- 02
    |   |-- s6000002.jpg
    |   \\-- s6000003.jpg
    |-- 03
    |   \\-- s6000004.jpg
    etc.

Images will be included on the appropriate month's page. If multiple images
for a month exist, they are tiled horizontally.

options:
  -h, --help            show this help message and exit
  -d DIR, --dir=DIR     Directory to source images (Default: '.')
  -y YEAR, --year=YEAR  Year of calendar (Default: next year)
  -o FILE, --output=FILE
                        Output file (Default: calendar.pdf)
  -q, --quiet           Don't print status messages to STDERR

GPL3+ source available in Git. Would love a patch that tiles images in a square if anyone has a spare moment.


Chris Lamb is a freelance software developer and the current Debian Project Leader. You can read other posts by me, see software I have written or read more about me. You can also follow me @lolamby.


Planets: ALUG UWCS Debian WUGLUG

Tuesday 18th December 2007


18 comments