class SamboxOutlineLevelsHandler implements org.sejda.model.outline.OutlineLevelsHandler {

    @Override
    public OutlinePageDestinations getPageDestinationsForLevel(int level) {
        OutlinePageDestinations destinations = new OutlinePageDestinations();
        OutlineUtils.getFlatOutline(document).stream().filter(i -> i.level == level).filter(i -> isNotBlank(i.title))
                .filter(i -> titleMatchingPattern.matcher(i.title).matches())
                .forEach(i -> destinations.addPage(i.page, i.title));
        return destinations;
    }

    public  SamboxOutlineLevelsHandler(PDDocument document, String matchingTitleRegEx);

}