Class DocumentPaginator
Paginates a document by running the internal layout engine to determine page boundaries. Uses the same flow engine as PDF export.
Inherited Members
Namespace: DRIT.Document
Assembly: DRIT.Document.dll
Syntax
public class DocumentPaginator
Constructors
DocumentPaginator(Document)
Creates a paginator for the given document.
Declaration
public DocumentPaginator(Document document)
Parameters
| Type | Name | Description |
|---|---|---|
| Document | document | The document to paginate. |
Properties
PageCount
Gets the total number of pages in the document by running the layout engine.
Declaration
public int PageCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
Pages
Gets metadata and extracted text for all laid-out pages.
Declaration
public IReadOnlyList<DocumentPageInfo> Pages { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<DocumentPageInfo> |
Methods
ExtractPageDocument(int, PageSplitOverflowMode)
Extracts one independent document containing the nodes laid out on a page.
Declaration
public Document ExtractPageDocument(int pageIndex, PageSplitOverflowMode overflowMode = PageSplitOverflowMode.IncludeWholeNode)
Parameters
| Type | Name | Description |
|---|---|---|
| int | pageIndex | Zero-based page index. |
| PageSplitOverflowMode | overflowMode | Policy for nodes that cross a page boundary. |
Returns
| Type | Description |
|---|---|
| Document | A new document owned by the caller. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | The page index or overflow mode is invalid. |
| NotSupportedException | The selected policy rejects a cross-page node. |
ExtractPageDocuments(int, int, PageSplitOverflowMode)
Extracts independent documents for a page range.
Declaration
public IReadOnlyList<Document> ExtractPageDocuments(int startIndex, int count, PageSplitOverflowMode overflowMode = PageSplitOverflowMode.IncludeWholeNode)
Parameters
| Type | Name | Description |
|---|---|---|
| int | startIndex | Zero-based first page index. |
| int | count | Number of pages to extract. |
| PageSplitOverflowMode | overflowMode | Policy for nodes that cross a page boundary. |
Returns
| Type | Description |
|---|---|
| IReadOnlyList<Document> | Independent documents in page order. The caller owns the returned documents. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | The range or overflow mode is invalid. |
| NotSupportedException | The selected policy rejects a cross-page node. |
ExtractPageText(int)
Extracts the text content of the specified page (0-based). Pages with no text content return an empty string.
Declaration
public string ExtractPageText(int pageIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| int | pageIndex | 0-based page index. |
Returns
| Type | Description |
|---|---|
| string | The text on the page. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | The page index is outside the snapshot. |
ExtractPages(int, int)
Extracts text from a range of pages (0-based, inclusive start, exclusive end).
Declaration
public IList<string> ExtractPages(int startIndex, int endIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| int | startIndex | 0-based start page index (inclusive). |
| int | endIndex | 0-based end page index (exclusive). |
Returns
| Type | Description |
|---|---|
| IList<string> | A list of page text strings. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | The range is outside the snapshot. |
GetPageCount()
Computes the total number of pages by running the layout engine.
Declaration
public int GetPageCount()
Returns
| Type | Description |
|---|---|
| int | The page count. |
GetPageInfo(int)
Gets metadata and extracted text for one laid-out page.
Declaration
public DocumentPageInfo GetPageInfo(int pageIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| int | pageIndex | Zero-based page index. |
Returns
| Type | Description |
|---|---|
| DocumentPageInfo | The page metadata. |
Invalidate()
Invalidates the cached layout snapshot after the document is modified.
Declaration
public void Invalidate()