private void initPageAnnotations() throws InterruptedException {
        // find annotations in main library for our pages dictionary
        Object annots = library.getObject(entries, ANNOTS_KEY.getName());
        if (annots != null && annots instanceof Vector) {
            Vector v = (Vector) annots;
            annotations = new ArrayList<Annotation>(v.size() + 1);
            // add annotations
            Object annotObj;
            org.icepdf.core.pobjects.annotations.Annotation a = null;
            for (int i = 0; i < v.size(); i++) {

                if (Thread.interrupted()) {
                    throw new InterruptedException(
                            "Page Annotation initialization thread interrupted");
                }

                annotObj = v.elementAt(i);
                Reference ref = null;
                // we might have a reference
                if (annotObj instanceof Reference) {
                    ref = (Reference) v.elementAt(i);
                    annotObj = library.getObject(ref);
                }

                // but most likely its an annotations base class
                if (annotObj instanceof Annotation) {
                    a = (Annotation) annotObj;
                }
                // or build annotations from dictionary.
                else if (annotObj instanceof Hashtable) { // Hashtable lacks "Type"->"Annot" entry
                    a = Annotation.buildAnnotation(library, (Hashtable) annotObj);
                }
                // set the object reference, so we can save the state correct
                // and update any references accordingly. 
                if (ref != null) {
                    a.setPObjectReference(ref);
                }

                // add any found annotations to the vector.
                annotations.add(a);
            }
        }
    }