December 18th 2007

PDF calendar generation


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

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

  -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.

You can subscribe to new posts via email or RSS.