table of contents
Remind::PDF(3pm) | User Contributed Perl Documentation | Remind::PDF(3pm) |
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.
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 mot.
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_stream($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
2022-02-23 | perl v5.34.0 |