def doc_constructor(fdata: Callable) -> Doc:
    """Initialize doc and close first revision."""
    chrono, nxt, nb = build_xref_sequence(fdata)
    index = build_index_from_xref_sequence(chrono, nxt, nb)
    data = [{'eof_cut': eof_cut(i[-1]['abs_pos'], fdata), 'fdata': fdata} for i in index if i[-1]]
    for i in index:
        del i[-1]
    cache = build_cache(fdata, index)
    doc_initial = Doc(index, cache, data)
    doc_new_rev = commit(doc_initial)
    return doc_new_rev
Initialize doc and close first revision.
pdfsyntax/api.py