Example usage for com.itextpdf.text.pdf SimpleBookmark eliminatePages

List of usage examples for com.itextpdf.text.pdf SimpleBookmark eliminatePages

Introduction

In this page you can find the example usage for com.itextpdf.text.pdf SimpleBookmark eliminatePages.

Prototype

@SuppressWarnings("unchecked")
public static void eliminatePages(List<HashMap<String, Object>> list, int pageRange[]) 

Source Link

Document

Removes the bookmark entries for a number of page ranges.

Usage

From source file:org.sejda.impl.itext5.component.ITextOutlineSubsetProvider.java

License:Open Source License

public Collection<HashMap<String, Object>> getOutlineUntillPageWithOffset(int endPage, int offset)
        throws TaskException {
    if (startPage < 0 || startPage > endPage) {
        throw new TaskException(
                "Unable to process document bookmarks: start page is negative or higher then end page.");
    }/* www . ja va  2s. c  o m*/
    if (bookmarks.isEmpty()) {
        return Collections.emptyList();
    }
    List<HashMap<String, Object>> books = getDeepCopyBookmarks(bookmarks);
    if (endPage < totalNumberOfPages) {
        SimpleBookmark.eliminatePages(books, new int[] { endPage + 1, totalNumberOfPages });
    }
    if (startPage > 1) {
        SimpleBookmark.eliminatePages(books, new int[] { 1, startPage - 1 });
        SimpleBookmark.shiftPageNumbers(books, -(startPage - 1), null);
    }
    if (offset != 0) {
        SimpleBookmark.shiftPageNumbers(books, offset, null);
    }
    return books;
}