Is it possible to create a perfect tool with AIR?

Since there’s no perfect tool for me I decided to create one myself.

If you want something done do it yourself.

Right now the only platform I can create application for without additional training is Flash/Flex/AIR. AIR looks perfect for this purpose, but I doubt flash can handle some of the features I need. Here’s the list of features from my previous post.

  • Be able to create rich text nodes,
  • Insert images, movies, audio files and PDFs,
  • Have everything searchable,
  • Tag everything,
  • Be able to sort nodes to folders and smart folders,
  • Be able to crosslink files,
  • Add small notes (as clouds) to everything,
  • Annotate PDFs,
  • Have a usable intuitive interface,
  • Run on a mac offline.

AIR can run on Mac, with Flash I can create any interface I need, I can show images, movies and mp3 files, I can edit text in a WYSIWYG mode (though I have yet to find a good one, and not only me), I can store data locally and online with full search index. But there’s huge problem with PDF support. Seriously, Flash PDF support sucks.

The plan.

First, I need to research a lot more about handling the PDF issue. If I fail to find a good solution I should probably stop and spend time learning Objective-C for native OS X programming. Right now there are several possible ways to go:

  1. pdf2swf library. It comes with C source code. The easiest way is to invoke it from command line from AIR application but this is not right. I might be able to modify it a bit and compile to SWC using Alchemy. The problem is that I don’t know C and have never tried to do anything with Alchemy. pdf2swf has some issues too, especially with fonts.
  2. Port a Java PDF library. With Flash 10 it is much easier to port a Java library to AS3, there’s even a special syntax converter and there should be AS3 implementations of core Java classes. This should be much easier than rewriting from scratch. This is what PDFCase has done, but I can’t contact its author. It is a port of PDFBox Java library. I played a bit with it but am not sure still what exactly it parses PDFs to. I am getting a lot of COSObjects and don’t know what they contain and how to work with them. Also, it takes 20 seconds to parse a 60 pages PDF file with several images. So in a port there must be a way to break the whole task into small subtasks not to hang the player. And I still have to understand how PDFBox works to start porting it.
  3. Write my own PDF parser. From what I saw PDF format is complicated. And I couldn’t find a free format spec.

Another question is what to do after I parsed a PDF file to simple instructions. I need to render them with Flash. This might be a problem too, especially with fonts.

Well, if I find a solution to the problem above the rest is pretty straightforward: prototype the interface, use Flex and Swiz to code it, fix bugs.

Afterthoughts.

I think that AIR might be not the tool of choice (see the irony?) for this type of project. I might need to learn Objective-C and code this application as a native OS X app, because there are frameworks to work with PDFs for Objective-C. For example PDFKit and SkimNotes. This might take some time but I am an experienced programmer after all. How Objective-C can be so different from ActionScript? Doubt it.

3 Responses to “Is it possible to create a perfect tool with AIR?”


Leave a Reply