public class PageRange extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
PageRange.IPageRangePart
Inner interface for range parts definition
|
static class |
PageRange.PageRangePartAfter
Class for range part containing a range of pages for all pages after a given start page
|
static class |
PageRange.PageRangePartAnd
Class for range part based on several range parts.
|
static class |
PageRange.PageRangePartOddEven
Class for range part for all even or odd pages.
|
static class |
PageRange.PageRangePartSequence
Class for range part containing a range of pages represented by a start and an end page
|
static class |
PageRange.PageRangePartSingle
Class for range part containing a single page
|
Constructor and Description |
---|
PageRange()
Constructs an empty PageRange instance.
|
PageRange(String pageRange)
Constructs a PageRange instance from a range in a string form, for example: "1-12, 15, 45-66".
|
Modifier and Type | Method and Description |
---|---|
PageRange |
addPageRangePart(PageRange.IPageRangePart part)
Adds any page range part to this page range.
|
PageRange |
addPageSequence(int startPageNumber, int endPageNumber)
Adds a page sequence to the range.
|
PageRange |
addSinglePage(int pageNumber)
Adds a single page to the range.
|
boolean |
equals(Object obj) |
List<Integer> |
getQualifyingPageNums(int nbPages)
Gets the list of pages that have been added to the range so far.
|
int |
hashCode() |
boolean |
isPageInRange(int pageNumber)
Checks if a given page is present in the range built so far.
|
public PageRange()
PageRange
instance.
public PageRange(String pageRange)
PageRange
instance from a range in a string form, for example: "1-12, 15, 45-66". More advanced forms are also available, for example: - "3-" to indicate from page 3 to the last page - "odd" for all odd pages - "even" for all even pages - "3- & odd" for all odd pages starting from page 3 A complete example for pages 1 to 5, page 8 then odd pages starting from page 9: "1-5, 8, odd & 9-".
pageRange
- a String of page ranges
public PageRange addPageRangePart(PageRange.IPageRangePart part)
part
- a custom implementation of PageRange.IPageRangePart
public PageRange addPageSequence(int startPageNumber, int endPageNumber)
startPageNumber
- the starting page number of the sequence
endPageNumber
- the finishing page number of the sequence
public PageRange addSinglePage(int pageNumber)
pageNumber
- the page number to add
public List<Integer> getQualifyingPageNums(int nbPages)
nbPages
- number of pages of the document to get the pages, to list only the pages eligible for this document.
public boolean isPageInRange(int pageNumber)
pageNumber
- the page number to check
true
if the page is present in this range, false
otherwise
Copyright © 1998–2020 iText Group NV. All rights reserved.