Colendar - PDF calendars with AppleScript, Python & CoreGraphics

Have you ever wanted to directly create dynamic PDF documents from within your AppleScripts? In less than a second? While having full control over page dimensions, color space and the exact positions of inserted texts, graphics and images? Well, if your answer is a resounding Yes, then I kindly invite you to download and inspect my latest Mac scripting project:

Colendar - Instantly create colorful PDF calendars in many languages (ca. 229.3 KB)

Colendar is an AppleScript Studio application that requires Mac OS X 10.5 Leopard and the system font Andale Mono. Just like my RagTime template it can create customized PDF calendars in several languages, but - and that is important - without the need of owning a copy of RagTime. It just creates the whole PDF document completely on its own.

Now, how can our beloved language of automation instantly create rich PDF content without installing extensions like Smile? Frankly spoken, it cannot. The real magic of direct PDF calendar creation is not achieved by AppleScript itself. It’s done by a Python script that makes excessive use of the excellent Quartz 2D bindings for Python. And that is also why you necessarily need Mac OS X 10.5 to successfully run Colendar, because the Python script relies on the latest version of PyObjC, which is pre-installed on Leopard.

But don’t underestimate the power of this combination! By having the possibility to execute Python scripts with arguments from within your AppleScript code using the «do shell script command», you can easily create a Python script that creates a nicely formatted and layouted PDF document with data retrieved from the calling AppleScript.

For example, one could quickly extend Colendar to include birthdays from an iCal calendar. Or think about an AppleScript based Apple Mail rule, that extracts all available informations from an incoming eMail and then calls a Python script, which produces a corresponding PDF representation of that message to file or directly print it with the lpr command. A thousand possibilities!

You only need to keep in mind, that currently all characters used in text to be drawn to a PDF context must be able to be converted to Mac Roman text encoding. Therefor not all languages can be supported. And just in case I watered your mouth and you want to dive into Python and direct PDF creation, I recommend to install the Developer Tools and take a look at the code examples located in /Developer/Examples/Quartz/Python/ and /Developer/Examples/Python/PyObjC/. Of course, studying the well commented Python script which is responsible for the PDF calendars produced with Colendar might also be a good idea :smiley:

Let’s build a great web service!
I would really like to put the underlying Python script on a server running Mac OS X Server (10.5), so that anybody could create and download colorful PDF calendars online. But unfortunately I don’t have access to such a server and don’t want to offer such a service out of my living room using my limited bandwidth, DynDNS and an old but still beautiful Power Mac G4/400…

So if you have access to a server running Mac OS X Server 10.5 and are interested in creating such a calendar creation service, please do not hesitate to contact me!

hi Martin,

firsdt of all thanks for the great colendar-app. It’s great and I used it last year. Now I found this posting and was wondering if you ever did anything like you said one could do. I’d love to have the feature to include one (or more) calenders from ical within the pdf-file.
I’m not a coder so I tried but got too confused.

greetings
triple

Hi triple,

First of all thank you very much for your interest in the Colendar script.

Unfortunately I did not have any time yet to implement the iCal feature in Colendar. Since the beginning of 2009 I am working as a professional scripter and I only have very little time for my private projects now :slight_smile:

Best regards from sunny Berlin,

Martin

Actually, Martin, you do have access to such a server: ScriptBuilders

Colendar won’t run on Mac OS X 10.6 (Snow Leopard), as this OS does not include Core Graphics bindings (CGBindings) for 64-bit Python :frowning:

Hi Martin just tried to issue the new colendar for 2010 without success.

Now I saw your commend that it’s not working due to snow leopard 64 bit system.

Any other option to fix it or alternative calendars available ?

I love this kind of calendar and it’s another feature which is killed by SW upgrade…

regards
leif

Hi,

I get many complaints about Colendar not working in Mac OS X 10.6, even my own wife is bitter about this fact. Therefor - also to rescue my marriage - I plan to release an Obj-C version of Colendar in 2010. The internal development name is Snolendar :smiley: Will use christmas time to start coding :lol:

Best regards from snowy Berlin!

Martin

That sounds great.

So we still have some hope for this year.

I would volunteer for the job as beta tester :-))

Many thanks … and speed up before the year ends.

best wishes

Leif

Hi Martin,

any news on colendar? Since it’s 2011 now I’m in need of a new calender :slight_smile:

grüsse aus der Schweiz,
triple

Hi,

Finally I found some time to publish a new tool for creating custom calendars: It utilizes iWork Numbers '09 and includes many features that people missed when using Colendar.

The new tool is named Colina and you can download it for free here:
Download Colina.app

Of course all AppleScripts used by Colina can be viewed in Script Editor, just in case you are interested in the code (find them in the app bundle).

For the first time, I also made a small video on YouTube. Times are changing :slight_smile:

Best regards from Berlin,

Martin

Hello Martin,

Great app be unfortunately not every mac user has numbers right? So I wanted to make a suggestion what you can do and is also very easy (like iCal works). Make a webview and create a html page on the fly. This html page will be loaded in your webview and the only thing you need to code is that it can be printed correctly. When printing the user has also an option like, show in preview or pdf (Mac OS X built-in).

Hi DJ Bazzie Wazzie;

I like your idea of using a Webview. But one thing would still be missing:

A lot of people complained that they could not edit the calendar in Colendar, as the result was a PDF. So that is one advantage of the Numbers solution: You can create your calendar, have some iCal events included and are still able to edit the result.

Best regards to NL, was in Hilversum just lately…

Martin

hey martin,

thanks for this app … great that you give away this app for free … i really appreciate this.

Since I have numbers on my computer at work it works fine for me. But at home I have office 2011 … without knowing anything about coding … is there a chance of getting the same thing with excel? Or is that completely out of reach?

triple

hello, is there a chance that colina will run with el capitan et numbers 3.6.2 ? :cool:

thank