def eof_cut(eof_index: int, fdata: Callable) -> int:
    """Calculate where to cut the byte stream of a revision: after %%EOF and possibly EOLs"""
    bdata, start, _, n = fdata(eof_index, bdata_length(fdata) - eof_index)
    i = start + len('%%EOF')
    while i < start + n:
        if bdata[i] not in EOL:
            break
        i += 1
    return i
Calculate where to cut the byte stream of a revision: after %%EOF and possibly EOLs
pdfsyntax/filestruct.py