About the project
jPdfCalendar is a tool which allows you to create a printable calendar as a PDF document from any of your images. The iText library is used to create the PDF itself.
The lastest version (on 23.12.2009) is 0.9.2 and you can download it from SourceForge page using this link: http://sourceforge.net/projects/jpdfcalendar/
My public calendars can be found on my DeviantArt page: chur.deviantart.com
I started this project to create a gift for my relations - the calendar with family photos to put the calendar on the wall at home. Later I found out that such tool can be usefull for other. Thus I opened my sources.
There is no GUI way to create a calendar, all actions must be done via command line. The idea of the tool is to create the description as XML file, create PDF file according to this XML description and print PDF on color photo-printer.
How to use
First of all this tool is Java tool and this is the command-line tool. Java means that you need to have Java in your OS to be installed. You can download JRE from Sun's site: http://java.sun.com. The command-line tool means that there is no GUI and to create PDF you will need to execute a command from command-line. Now you have been warned and you can download the package from SF page: http://sourceforge.net/projects/jpdfcalendar/
Unpack the package in any place. The package has the following structure:
- bin - the list of scripts
- docs - the short documentations
- dtd - contains the DTD file which corresponds to the version of this package
- lib - jPdfCalendar tool and all additional libraries
- sample - the sample which contains the XML file and pictures to create single a PDF
- src - sources
To create a sample please change the current location to bin folder and execute createme script. This script will create a sample PDF.
The most important thing is creation of XML description according to DTD structure:
project | Root tag |
year | The year number, 2009 for example. Must be defined. |
destination | The place and name of PDF file. |
locale | Description of locale, has attribute firstDayOfWeek (monday, sunday etc) |
locale/language | language ISO code (en, ru etc) |
locale/country | country ISO code (US, RU etc) |
iCal/url | The URL of iCal source, for example http://ical.mac.com/spxyouthgroup/Roman32Catholic.ics. You can add more then one url tag inside iCal tag to use several sources. It is optional feature |
page/format | page format. In the current version only A4 type is supported |
page/orientation | page orientation: Portrait or Landscape |
moonPhases | Indicates if the calendar should include information about Moon phases. There is one attribute enabled. Possible values are true or false. |
frontPage | The main tag to describe the Cover (or the front page of the Calendar). This tag is optional. The following subtags are supported: image(required), width(optional), font(optional), textLocation(optional), margin_bottom(optional), margin_right(optional), margin_left(optional), margin_top(optional), background(optional)) |
backPage | The main tag to describe the last page with calendar for the next year. This tag is optional. The following subtags are supported: commonFont (required), monthNameFont(required), yearFont(required), weekendFont(required), border (optional) |
month | The main tag to describe the page for the Month. It has the required attribute id which attribute corresponds to the month's number. Possible values between 1 and 12. Totally can be be defined up to 12 such tags. The following subtags are supported: image and calendar. Both are required. |
frontPage/font | defines the font which will be used for year's number |
frontPage/textLocation | defines the location of text-box with year's number. Possible values are: bottom_left, bottom_right, bottom_center, top_left, top_center, top_right |
month/calendar | defines the box with month's view. Subtags are: location (optional), width (optional), margin_left (optional), margin_right (optional), margin_top (optional), margin_bottom (optional), commonFont, specialFont(optional), weekendFont (optional), monthNameFont (optional), noteTextFont(optional), background(optional), border(optional), day (optional) |
*/image | defines the image which will be used for the given page. Subtags are: file (required), imgLocation (optional), border(optional), scale(optional) |
*/width | defines the width of text-box in % |
In the table above I described not all tags, may be later I'll fill-in this table with full description but I belive that the best way to understand the structure is to try the samples. Just do it ;)
So, when you have the XML file you can try to create the PDF. You can use the script bin/jpdfcalendar with two parameters: first is required - the path to XML file and the second is optional - the path where you keep your additional TTF-files. There is one note about iText and PDF: to create PDF file I use iText library. This library tries to load TTF files from several sources according to your OS but sometimes (espcially in case of Linux) you have to instuct the library to look inside the exact folder (e.g. .fonts). This path can be passed as a second optional paramater.
Also you can execute the command like this:
java -jar /u01/app/tools/jpdfcalendar.0.9.0/lib/jPdfCalendar.jar \
/home/chur/Documents/Personal/Calendars/2009/calendar_public_ru.xml
Samples
My calendars can be found on my DevArt page: chur.deviantart.com
The XML file to create this calendar is calendar_public_en_2008.xml
The XML file to create this calendar is calendar_public_en_2009.xml
The XML file to create this calendar is calendar_public_en_2010.xml
Resources
In this tool I used:
- iText - Java library to create PDF (http://www.lowagie.com/iText/)
- AstroLib - Java library to calculate Moon phases (http://mhuss.com/AstroLib.html)
- MoonTTF - TrueType font with Moon phases (http://www.mockfont.com/old/)
- iCal4j - Java library to work with iCal resources (http://wiki.modularity.net.au/ical4j/)
- Adobe PDF 512x512.png - PDF Logo which I used on the top of this page (http://jasonh1234.deviantart.com/art/Adobe-Acrobat-File-512x512-83440730)
SourceForge.Net
The project is hosted on