static List<COSDictionary> findType(COSBase cosBase, Set<COSName> types, int maxDepth) {
        List<COSDictionary> found = new ArrayList<>();
        Set<COSBase> seen = new HashSet<>();
        find(cosBase, types, 0, maxDepth, seen, found);
        return found;
    }
This recursively looks through cosBase for cosdictionary's that have
a type key in the types set. It intentionally does not follow /p, /parent, /page
dictionaries.

@param cosBase
@param types
@param maxDepth
@return
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-pdf-module/src/main/java/org/apache/tika/parser/pdf/PDFDOMUtil.java