Jan 192011
 

pcal-sample-monthlyThanks to a message on identi.ca I ve saw this program usable from the command line that allows you to easily create custom desk calendars, marked with the dates that interest you and with the ability to add pictures to one (or more) special days.

I’m talking of pcal shipped with anothe calendar programming lcal

PCAL and LCAL are calendar-generation programs which produce nice-looking PostScript output.



PCAL is usually used to generate monthly-format (one month per page) calendars with optional embedded text and images to mark special events (e.g. holidays, birthdays, etc). It can also generate yearly-format (one year per page) calendars.

LCAL generates a graphical ”lunar phase” calendar for an entire year

Install

On ubuntu (i’ve 10.10) you can install pcal with

aptitude install pcal

But the package don’t include lcal.

Basic Usage

pcal -a it -E -P a4 -B -F 1 -n Arial/10 -o cal.ps 2011
  • -a specify the language (it=italian), default English
  • -E specifies European dates (alternative is -A
  • -P specifies A4 paper size
  • -B leaves unused date boxes blank; this saves ink
  • -F indicates the starting weekday; 1 is Monday
  • -n selects the font size to be used in the notes boxes — in this case 10-point Arial
  • -o specifies an output file in PostScript format. I do this so that it is easy to print another copy if I want to.
  • 2011 is the year for which I want to print the calendar — useful if you produce the calendar in December. PCAL’s default option is to produce the calendar for the current year.

Example of pre-generated, nicely-colored, event-free, monthly-format (12 months, 1 per page; landscape orientation; designed for printing on ‘U.S. Letter’-sized paper)

Advanced usage

The killer feature of this small program is the option -f that allow you to use a configuration file. In this file you can place “events” (and, for monthly-format PostScript calendars, Encapsulated PostScript images [e.g. photos and icons]) in appropriate days on the (PostScript or HTML) calendar, thus allowing the user to create personalized calendars.

Example of configuration file:

last Monday in May*		Memorial Day Holiday

all Fridays in Oct		Status Meeting, 11 AM
first workday in all		%-B progress report due
all Fri in all              	fBTime card due,fP 3 PM
all Monday in all           	Fiscal week %0W
-2nd workday in all         	Schedule for %+B due %+2D
Fri on_or_before all 15     	Pay Day
even Fridays in year        	Pay Day
183rd day of year           	Mid-year (%l days left)

Tue after first Mon in Nov  	Election Day (USA)

4th Thu in Nov*             	Thanksgiving
Fri after 4th Thu in Nov*   	Day after Thanksgiving

Easter                     	Easter Sunday
Good_Friday*               	Good Friday
Monday after Easter*       	Easter Monday

Christmas                  	Christmas
Day after Christmas        	Boxing Day
workday ooa Christmas*     	Christmas Holiday
workday after Christmas*   	Boxing Day Holiday

Last Sunday in Sep		Day Light Saving Starts - Clock Forward
First Sunday in Apr		Day Light Saving Ends - Clock Back
Fri on_or_before all 13		Avoid black cats!   # Friday the 13th

So the command become:


pcal -a it -f .calendar -E -P a4 -B -F 1 -n Arial/10 -o cal.ps 2011

Several of the lines have an * in them, which indicates that the day is a holiday, and that the text following should appear on the same line as the date. The character string %B means print the month name; a + or a – after the % means print the next or previous month’s name. You can make text bold using fB, then revert to the previous font with fP. The string %OW prints the week number with leading zeroes. -2nd indicates that you want the event to occur on the second to last workday of the month.

%+2D is an example of PCAL’s simple math functions; it means adjust the date backwards two days and print that date. %l prints the number of days left in the year. ooa is shorthand for “on or after,” and oob can be used for “on or before.”

References:http://www.linux.com/archive/feature/118082

Popular Posts:

Flattr this!

  3 Responses to “Pcal – calendar from command line”

  1. Lieto di averti ispirato 😉

  2. Thank you for the article on pcal. It really is a fantastic tool. I use it to manage my personal and band calendar, including a bash-based daily email system, email notifications of changes to the band calendar, and an automatically-updated online version. pcal is perfect for building your own solutions like these. Here’s how I’m using it:
    http://onensemble.org/2008/12/free-software-based-calendaring/

    And a final plus, the pcal maintainer is incredibly friendly and generous!

  3. Thanks for sharing..i like it very much.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

*