Around November of 2011, I began developing a application to parse and display Apple Keynote documents with a custom menu and UI. Now, after the completion of eight commercially released deliveries, that system has matured to become a robust platform for delivering custom presentations via Adobe AIR on the Mac and PC.
Understanding Keynote Files
One of the most challenging aspects of developing the system was understanding the structure of the Keynote's data file (APXL format). It is a massive XML file that serves as a relational database containing all the text, image, video, animation and stylesheet information for the presentation. They can contain 100's of thousands of lines of markup, and are in the size range of 7-15 MB.
I was not able to find much information about the APXL format online, so much of the process involved careful testing and trial and error. There is some information available from Apple that outlines the basics, but everything I found seemed to be a few versions behind and left many unanswered questions. After gaining a better understanding of the inheritance relationships and format of the common objects being modeled, the process improved significantly.
Processing the Keynote File
There are many data formats and XML constructs used by Keynote that are not suitable for use in the Flash platform. I also found that many styling options available in Keynote are not possible with available tools in AS3. These areas had be adapted for the presentation to be utilized in Flash.
In particular cases, these issues can be overcome by prepping the Keynote file to replace incompatable style options with valid solutions. One example is the use image bullets. The way to achieve this result is to replace the bullets with static images next to the textfield, or to bake the entire slide into a single image. Both solutions have been used, depending on the situation.
After prepping the file properly, the rest of the processing step is completely handled by Python scripts. This includes converting proprietary markup to valid HTML, associating and generating CSS1 complient stylesheets based on in-file data and converting images and videos to compatable formats.
Parsing the modified Keynote File
This process is more straight forward than the modification of the data, but all the different features and options that can be in a presentation begins to have more of an impact here. So far, support has been added for text fields, images, vector graphics, videos, animations, slide transitions, drop shadows, outlines, the use of master slides and stylesheets.
The Front End
With all that info, now its time to do something useful! A simple OO design was used to handle Slides, Visual and Text Resources, etc. The parser gives us all the info we need to display an object (x,y coordinates, scale, associated animations & styles, and so forth).
The navigation package provides a menu of chapters, and the abliity to jump around the presentation using a hidden UI panel. A timer system was also developed at the request of the client.
Optimization & Other Interesting Things
Most of our client's presentations have contained over 200 slides with lots of videos and images, so optimization was important from the get-go. Good compression of resources was helpful with filesize, but runtime performance has been an issue as well. A massive memory leak was soon discovered when testing a full presentation for the first time. Because of the way the Actionscript Virtual Machine's garbage collection process works, the problem was solved with object-pooling.
Conclusion & The Future
There is still a long way to go for this project. Future goals include support for more animations and transitions, improving performance and reducing the need for prep-work. I have considered the idea of going open-source with the project, but have mixed feelings on the benefits from doing so.
Another exciting project that would be an extension of this system is to utilize Keynote as an authoring environment for eLearning modules.
In conclusion, this has been one of the most challenging projects I've ever worked on. It has also been one of the most rewarding from an educational standpoint. I look forward to the next challenges that await.