---
name: "Remind::PDF"
section: "3pm"
platform: "linux"
package: "remind-tools"
version: "05.03.07-1+deb13u1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Remind::PDF"
---

# Remind::PDF(3pm)

Render a month's worth of Remind data to PDF

## NAME

Remind::PDF - Render a month's worth of Remind data to PDF

## CLASS METHODS

### Remind::PDF-\>create\_from\_stream($in, $specials\_accepted)

This method reads data from an open file handle `$in`.  `$specials_accepted` is a hashref of SPECIAL reminder types to accept; the key is the name of the SPECIAL (all lower-case) and the value should be 1.  Any SPECIAL reminders not in the hash are ignored.

This function returns a two-element array: `"($obj, $err)"`.  On success, `$obj` will be a `"Remind::PDF"` object and `$err` will be undef.  On failure, `$obj` will be undef and `$err` will be an error message.

### Remind::PDF-\>create\_from\_hash($hash, $specials\_accepted)

This method takes data from a hash `$hash`, which must be one month's worth of data from `"remind -ppp"` output.  `$specials_accepted` is a hashref of SPECIAL reminder types to accept; the key is the name of the SPECIAL (all lower-case) and the value should be 1.  Any SPECIAL reminders not in the hash are ignored.

This function returns a two-element array: `"($obj, $err)"`.  On success, `$obj` will be a `"Remind::PDF"` object and `$err` will be undef.  On failure, `$obj` will be undef and `$err` will be an error message.

## INSTANCE METHODS

### read\_one\_month($in, $first\_line, $specials\_accepted)

This function reads one month's worth of data from the file handle `$in`.  `$first_line` is the line that was read from `$in` just before calling this function.  `$specials_accepted` is a hashref as documented above.

The return value is the same `"($obj, $err)"` two-element array as `"create_from_stream"` returns.

### read\_one\_month\_p($in, $specials\_accepted)

This function reads one month's worth of data from the file handle `$in`, assuming the original "remind -p" format. `$specials_accepted` is a hashref as documented above.

The return value is the same `"($obj, $err)"` two-element array as `"create_from_stream"` returns.

### parse\_oldstyle\_line ($line)

This method parses an old-style "remind -p" line and returns a hashref containing some or all of the hash keys found in the newer "remind -pp" JSON output.

### setup\_daymap

Set up the array that maps ($row, `$col`) to day number (or -1 for rows/cols out of range.)

### read\_one\_month\_pp($in, $specials\_accepted)

This function reads one month's worth of data from the file handle `$in`, assuming the "remind -pp" partial-JSON format. `$specials_accepted` is a hashref as documented above.

The return value is the same `"($obj, $err)"` two-element array as `"create_from_stream"` returns.

### accept\_special($hash, $specials\_accepted)

Given a hashref `$hash` consisting of one entry parsed from the "remind -p" stream and a `$specials_accepted` hash, return 1 if we should include this entry in the calendar or 0 if not.

### find\_last\_special($special, $entries)

Given an array of Reminder entries, find the last `$special`-type SPECIAL in the array.  Return the entry if one was found or undef if not.

### render($cr, $settings)

Render a calendar for one month.  `$cr` is a Cairo drawing context, and `$settings` is a settings hash passed in by the caller.  See the source code of `"rem2pdf"` for the contents of `$settings`

### draw\_row($cr, $settings, $so\_far, $row, $start\_day, $start\_col)

Draw a single row in the calendar.  `$cr` is a Cairo drawing context and `$settings` is the settings hash passed to `"render"`.  `$so_far` is the Y-coordinate of the top of the row; drawing starts at this coordinate.  `$start_day` is the day of the month at which the row starts and `$start` col is the column number (0-6) at which to start drawing from `$start_day`

Returns the Y coordinate at which to start drawing the *next* calendar row.

### col\_box\_coordinates($so\_far, $col, $height, $settings)

Returns a four-element array `"($x1, $y1, $x2, $y2)"` representing the bounding box of the calendar box at column `$col` (0-6).  `$height` is the height of the box and `$settings` is the settings hashref passed to `"render"`.

### draw\_day($cr, $settings, $so\_far, $day, $col, $height)

Renders a single day's worth of reminders.  `$cr` is a Cairo drawing context and `$settings` is the settings hash passed to `"render"`.  `$so_far` is the Y-coordinate of the top of the box and `$col` is the column number.

`$height` is the height of the box.  If `$height` is passed in as zero, then do not actually render anything... instead, compute how high the box should be.  If `$height` is non-zero, then it is the height of the box.

Returns the height required for the calendar box.

### draw\_daynames($cr, $settings, $so\_far)

Draw the weekday names heading.  `$cr` is a Cairo drawing context and `$settings` is the settings hash passed to `"render"`.  `$so_far` is the Y-coordinate of the top of the row; drawing starts at this coordinate.

Returns the Y coordinate at which to start drawing the first calendar row.

### draw\_title($cr, $settings)

Draw the title ("Monthname Year") at the top of the calendar. `$cr` is a Cairo drawing context and `$settings` is the settings hash passed to `"render"`.

Returns the Y coordinate at which to start drawing the row containing the weekday names.

### draw\_small\_calendar($cr, $x, $y, $width, $height, $settings, $month, $days, $start\_wkday)

Draw a small calendar on the Cairo context `$cr`.  The top left-hand corner of the box is at `"($x, $y)"` and the size of the box is `"($width, $height"`).  `$settings` is the settings hashref passed to `"render"`.  `$month` is the name of the month to draw and `$days` is the number of days in the month.  Finally, `$start_wkday` is the weekday (0=Sunday, 6=Saturday) on which the month starts

## NAME

Remind::PDF::Multi - A container for multiple months' worth of calendar data

## DESCRIPTION

The `"remind -ppp"` output consists of a JSON array with each element representing one month's worth of reminders.  `"Remind::PDF::Multi"` reads this output and returns an instance of itself containing an array of `"Remind::PDF"` objects, one object for each month.

## CLASS METHODS

### Remind::PDF::Multi-\>create\_from\_stream($in, $specials\_accepted)

This method reads data from an open file handle `$in`.  `$specials_accepted` is a hashref of SPECIAL reminder types to accept; the key is the name of the SPECIAL (all lower-case) and the value should be 1.  Any SPECIAL reminders not in the hash are ignored.

This function returns a two-element array: `"($obj, $err)"`.  On success, `$obj` will be a `"Remind::PDF::Multi"` object and `$err` will be undef.  On failure, `$obj` will be undef and `$err` will be an error message.

### Remind::PDF::Multi-\>create\_from\_json($json, $specials\_accepted)

This method takes data from a JSON string \<$json\>.  `$specials_accepted` is a hashref of SPECIAL reminder types to accept; the key is the name of the SPECIAL (all lower-case) and the value should be 1.  Any SPECIAL reminders not in the hash are ignored.

This function returns a two-element array: `"($obj, $err)"`.  On success, `$obj` will be a `"Remind::PDF::Multi"` object and `$err` will be undef.  On failure, `$obj` will be undef and `$err` will be an error message.

## INSTANCE METHODS

### render($cr, $settings)

Iterate through all the `"Remind::PDF"` objects and call their `"render"` methods.  This method renders as many months worth of calendar data as were read from the `"remind -ppp"` stream

## NAME

Remind::PDF::Weekly - render a weekly calendar
