private static PDFObject getDestFromString(PDFObject str, PDFObject root)
            throws IOException {
        // find the names object in the root node
        PDFObject names = root.getDictRef("Names");
        if (names != null) {
            // find the dests entry in the names dictionary
            PDFObject dests = names.getDictRef("Dests");
            if (dests != null) {
                // create a name tree object
                NameTree tree = new NameTree(dests);

                // find the value we're looking for
                PDFObject obj = tree.find(str.getStringValue());

                // if we get back a dictionary, look for the /D value
                if (obj != null && obj.getType() == PDFObject.DICTIONARY) {
                    obj = obj.getDictRef("D");
                }

                // found it
                return obj;
            }
        }

        // not found
        return null;
    }