Table of Contents

Interface IPdfDocument

Namespace
PdfEngine.Documents
Assembly
PdfEngine.Abstractions.dll

Represents an open PDF document contract independent of any UI or native implementation.

public interface IPdfDocument : IAsyncDisposable, IDisposable
Inherited Members

Properties

FilePath

The path the document was opened from; for a document opened from memory, the name given at open time.

string FilePath { get; }

Property Value

string

IsOpen

False after the document is disposed.

bool IsOpen { get; }

Property Value

bool

Metadata

The document information and permissions read at open time.

DocumentMetadata Metadata { get; }

Property Value

DocumentMetadata

PageCount

The number of pages.

int PageCount { get; }

Property Value

int

Methods

GetBookmarksAsync(CancellationToken)

Gets the document outline (bookmarks) as a tree. The list is empty when the document has no outline.

ValueTask<IReadOnlyList<BookmarkItem>> GetBookmarksAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Cancels the operation.

Returns

ValueTask<IReadOnlyList<BookmarkItem>>

GetPageAsync(int, CancellationToken)

Gets a page object.

ValueTask<IPdfPage> GetPageAsync(int pageNumber, CancellationToken cancellationToken = default)

Parameters

pageNumber int

The page number, starting at 1.

cancellationToken CancellationToken

Cancels the operation.

Returns

ValueTask<IPdfPage>

Exceptions

ArgumentOutOfRangeException

pageNumber is less than 1 or greater than PageCount.

GetPageInfoAsync(int, CancellationToken)

Gets the size and rotation of a page.

ValueTask<PageInfo> GetPageInfoAsync(int pageNumber, CancellationToken cancellationToken = default)

Parameters

pageNumber int

The page number, starting at 1.

cancellationToken CancellationToken

Cancels the operation.

Returns

ValueTask<PageInfo>

Exceptions

ArgumentOutOfRangeException

pageNumber is less than 1 or greater than PageCount.