iText 8.0.2 API
iText.Kernel.Utils.PageRange Class Reference

Class representing a page range, for instance a page range can contain pages 5, then pages 10 through 15, then page 18, then page 21 and so on. More...

Classes

interface   IPageRangePart
  Inner interface for range parts definition More...
 
class   PageRangePartAfter
  Class for range part containing a range of pages for all pages after a given start page More...
 
class   PageRangePartAnd
  Class for range part based on several range parts. More...
 
class   PageRangePartOddEven
  Class for range part for all even or odd pages. More...
 
class   PageRangePartSequence
  Class for range part containing a range of pages represented by a start and an end page More...
 
class   PageRangePartSingle
  Class for range part containing a single page More...
 

Public Member Functions

  PageRange ()
  Constructs an empty PageRange instance. More...
 
  PageRange (String pageRange)
  Constructs a PageRange instance from a range in a string form, for example: "1-12, 15, 45-66". More...
 
virtual iText.Kernel.Utils.PageRange  AddPageRangePart (PageRange.IPageRangePart part)
  Adds any page range part to this page range. More...
 
virtual iText.Kernel.Utils.PageRange  AddPageSequence (int startPageNumber, int endPageNumber)
  Adds a page sequence to the range. More...
 
virtual iText.Kernel.Utils.PageRange  AddSinglePage (int pageNumber)
  Adds a single page to the range. More...
 
virtual IList< int >  GetQualifyingPageNums (int nbPages)
  Gets the list of pages that have been added to the range so far. More...
 
virtual bool  IsPageInRange (int pageNumber)
  Checks if a given page is present in the range built so far. More...
 
override bool  Equals (Object obj)
 
override int  GetHashCode ()
 

Detailed Description

Class representing a page range, for instance a page range can contain pages 5, then pages 10 through 15, then page 18, then page 21 and so on.

Constructor & Destructor Documentation

◆ PageRange() [1/2]

iText.Kernel.Utils.PageRange.PageRange ( )
inline

Constructs an empty PageRange instance.

◆ PageRange() [2/2]

iText.Kernel.Utils.PageRange.PageRange ( String  pageRange )
inline

Constructs a PageRange instance from a range in a string form, for example: "1-12, 15, 45-66".

Constructs a 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-".
Parameters
pageRange a String of page ranges

Member Function Documentation

◆ AddPageRangePart()

virtual iText.Kernel.Utils.PageRange iText.Kernel.Utils.PageRange.AddPageRangePart ( PageRange.IPageRangePart  part )
inlinevirtual

Adds any page range part to this page range.

Adds any page range part to this page range. Users may define and plug in custom implementations for behavior not found in the standard library.

Parameters
part a custom implementation of IPageRangePart
Returns
this range, already modified

◆ AddPageSequence()

virtual iText.Kernel.Utils.PageRange iText.Kernel.Utils.PageRange.AddPageSequence ( int  startPageNumber,
int  endPageNumber 
)
inlinevirtual

Adds a page sequence to the range.

Parameters
startPageNumber the starting page number of the sequence
endPageNumber the finishing page number of the sequence
Returns
this range, already modified

◆ AddSinglePage()

virtual iText.Kernel.Utils.PageRange iText.Kernel.Utils.PageRange.AddSinglePage ( int  pageNumber )
inlinevirtual

Adds a single page to the range.

Parameters
pageNumber the page number to add
Returns
this range, already modified

◆ Equals()

override bool iText.Kernel.Utils.PageRange.Equals ( Object  obj )
inline

◆ GetHashCode()

override int iText.Kernel.Utils.PageRange.GetHashCode ( )
inline

◆ GetQualifyingPageNums()

virtual IList iText.Kernel.Utils.PageRange.GetQualifyingPageNums ( int  nbPages )
inlinevirtual

Gets the list of pages that have been added to the range so far.

Parameters
nbPages number of pages of the document to get the pages, to list only the pages eligible for this document.
Returns
the list containing page numbers added to the range matching this document

◆ IsPageInRange()

virtual bool iText.Kernel.Utils.PageRange.IsPageInRange ( int  pageNumber )
inlinevirtual

Checks if a given page is present in the range built so far.

Parameters
pageNumber the page number to check
Returns
true if the page is present in this range, false otherwise