The following is the AIK code for the sample solution. It is documented in this PDF Implementor's Notes, for which I've also provided the Latex source.