| PostScript-Calendar documentation | view source | Contained in the PostScript-Calendar distribution. |
bordercondenseday_heightmini_calendarsphasestitledaysday_namestitle_fonttitle_sizetitle_skiplabel_fontlabel_sizelabel_skipdate_fontdate_sizeevent_fontevent_sizeevent_skipmini_fontmini_sizemini_skipdate_right_margindate_top_marginevent_marginevent_top_marginevent_left_marginevent_right_marginmini_marginmini_top_marginmini_side_marginsmoon_marginshade_days_of_weekmarginside_marginstop_marginbottom_marginpaperlandscapeps_file
PostScript::Calendar - Generate a monthly calendar in PostScript
This document describes version 1.00 of PostScript::Calendar, released November 11, 2010.
use PostScript::Calendar;
my $cal = PostScript::Calendar->new($year, $month, phases => 1,
mini_calendars => 'before');
$cal->output('filename');
PostScript::Calendar generates printable calendars using PostScript.
PostScript::Calendar uses Date::Calc's *_to_Text functions, so you
can change the language used by calling Date::Calc's Language
function before creating your calendar.
Years must be fully specified (e.g., use 1990, not 90). Months range from 1 to 12. Days of the week can be specified as 0 to 7 (where Sunday is either 0 or 7, Monday is 1, etc.).
All dimensions are specified in PostScript points (72 per inch).
$cal = PostScript::Calendar->new($year, $month, [key => value, ...])
This constructs a new PostScript::Calendar object for $year and $month.
There are a large number of parameters you can pass to customize how
the calendar is displayed. They are all passed as name => value
pairs.
borderIf false, omit the border around the calendar grid (only internal grid lines are drawn). The default is true.
condenseIf true, reduce calendars that would span 6 rows down to 5 rows by combining either the first or last day with its neighbor. The default is false.
day_heightThe maximum height of a date row. This is useful to prevent portrait-mode calendars from taking up the entire page (which just doesn't look right). The default is 0, which means there is no maximum value. I recommend 96 for a portrait-mode calendar on US letter size paper.
mini_calendarsThis causes small calendars for the previous and next months to be
printed. The value should be "before" to put them before the first
of the month, "after" to put them after the last day of the month, or
"split" to put the previous month before and the next month after.
The default is a false value (which means no mini calendars).
phasesIf true, the phase of the moon icons are printed (requires Astro::MoonPhase 0.60). The default is false.
titleThe title to be printed at the top of the calendar. The default is
"Month YEAR" (where Month comes from Month_to_Text, and YEAR is
numeric.) Setting this to the empty string automatically sets
title_size and title_skip to 0 (completely suppressing the title).
daysAn arrayref specifying the days of the week to be included in the
calendar. The first day must be in the range 0 to 6 (where Sunday is
0, Monday is 1, etc.). Subsequent days must be in ascending order, up
to the initial day + 6.The default is [ 0 .. 6 ] (meaning Sunday
thru Saturday). Other popular values are [ 1 .. 7 ] for Monday
thru Sunday or [ 1 .. 5 ] for Monday thru Friday (no weekends).
You may skip over days if you don't want them included. For example,
[ 3, 5, 8 ] would display Wednesday, Friday, and Monday (with weeks
starting on Wednesday).
day_namesArrayref of the column labels. Defaults to passing the (normalized)
values from days thru Date::Calc's Day_of_Week_to_Text, which is
probably what you want.
title_fontThe font to use for the title. Defaults to Helvetica-iso.
title_sizeThe size of the title_font to use. Defaults to 14.
title_skipExtra space (in points) to leave below the title. Defaults to 5.
label_fontThe font to use for the days of the week. Defaults to title_font.
label_sizeThe size of the label_font to use. Defaults to title_size.
label_skipExtra space (in points) to leave below the weekday labels. Defaults
to title_skip.
date_fontThe font to use for the dates of the month. Defaults to Helvetica-Oblique-iso.
date_sizeThe size of the date_font to use. Defaults to title_size.
event_fontThe font to use for text events (added by add_event). Defaults to
Helvetica-iso.
event_sizeThe size of the event_font to use. Defaults to 8.
event_skipExtra space (in points) to leave between lines of event text. Defaults to 2.
mini_fontThe font to use for mini calendars. Defaults to Helvetica-iso.
mini_sizeThe size of the mini_font to use. Defaults to 6.
mini_skipExtra space (in points) to leave between the lines of mini calendars. Defaults to 3.
date_right_marginSpace (in points) to leave between the date and the gridline. Defaults to 4.
date_top_marginSpace (in points) to leave between the date and the gridline. Defaults to 2.
event_marginThis is used as the default value for event_top_margin,
event_left_margin, and event_right_margin.
event_top_marginThe space (in points) to leave above event text. Defaults to
event_margin, or 2 if event_margin is not specified.
event_left_marginThe space (in points) to leave to the left of event text. Defaults
to event_margin, or 3 if event_margin is not specified.
event_right_marginThe space (in points) to leave to the right of event text. Defaults to
event_margin, or 2 if event_margin is not specified.
mini_marginThis is used as the default value for mini_top_margin and
mini_side_margins. Defaults to 4.
mini_top_marginThe space (in points) to leave above mini calendars. Defaults to
mini_margin.
mini_side_marginsThe space (in points) to leave on each side of mini calendars.
Defaults to mini_margin.
moon_marginSpace to leave above and to the left of the moon icon. Defaults to 6.
shade_days_of_weekAn arrayref of days of the week to be passed to the
shade_days_of_week method. (I found it convenient to be able to pass
this to the constructor instead of making a separate method call.)
marginThis is used as the default value for top_margin, side_margins,
and bottom_margin.
side_marginsThe space (in points) to leave on each side of the calendar. Defaults
to margin, or 24 if margin is not specified.
top_marginThe space (in points) to leave above the calendar. Defaults to
margin, or 36 if margin is not specified.
bottom_marginThe space (in points) to leave below the calendar. Defaults to
margin, or 24 if margin is not specified.
paperThe paper size to pass to PostScript::File. Defaults to "Letter".
Not used if you supply ps_file.
landscapeIf true, print calendar in landscape mode. Defaults to false.
Not used if you supply ps_file.
ps_fileAllows you to pass in a PostScript::File (or compatible) object for
the calendar to use. By default, a new PostScript::File object is
created. Passing an explicit undef also creates a new object.
$cal->add_event($date, $message)
This prints the text $message on $date, where $date is the
day of the month. You may call this multiple times for the same date.
Messages will be printed in the order they were added. $message
may contain newlines to force line breaks.
$cal->generate
This actually generates the calendar, placing it in the
PostScript::File object. You shouldn't need to call this, because
output calls it automatically.
$cal->output($filename)
This passes its parameters to PostScript::File::output (after
calling generate if necessary). Normally, you just pass the
filename to write. Note that PostScript::File will append ".ps" to
the output filename.
$cal->ps_file
This returns the PostScript::File object that $cal is using. Only
needed for advanced techniques.
$cal->shade($date, ...)
This colors the background of the specified date(s) a light gray,
where $date is the day of the month. Any number of dates can be
given.
$cal->shade_days_of_week($day, ...)
This calls shade for all dates that fall on the specified day(s) of
the week. Each $day should be 0-7 (where Sunday is either 0 or 7).
WARNING: Event text for YYYY-MM-DD doesn't fitYou supplied more event text for the specified date than would fit in the box. You'll have to use a smaller font, smaller margins, or less text.
PostScript::Calendar requires no configuration files or environment variables.
Date::Calc (5.0 or later) and PostScript::File (2.01 or later).
If you want to display phases of the moon, you'll need Astro::MoonPhase (0.60 or later).
All of these are available on CPAN.
None reported.
No bugs have been reported.
Christopher J. Madsen <perl AT cjmweb.net>
Please report any bugs or feature requests to
<bug-PostScript-Calendar AT rt.cpan.org>,
or through the web interface at
http://rt.cpan.org/Public/Bug/Report.html?Queue=PostScript-Calendar
You can follow or contribute to PostScript-Calendar's development at git://github.com/madsen/postscript-calendar.git.
This software is copyright (c) 2010 by Christopher J. Madsen.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
| PostScript-Calendar documentation | view source | Contained in the PostScript-Calendar distribution. |