Skip to main content

IPdfAdapter Interface

Definition

Assembly:Avalonia.Controls.PdfViewer
Package:Avalonia.Controls.PdfViewer

Platform-agnostic interface for PDF rendering operations.

public interface IPdfAdapter

Implements: IDisposable

Methods

NameDescription
LoadDocumentAsync (3 overloads)Loads a PDF document from a stream. The stream is read once from its current position and is never disposed by the adapter; the document keeps its own copy of the bytes.

LoadDocumentAsync overloads

LoadDocumentAsync Method

Loads a PDF document from a stream. The stream is read once from its current position and is never disposed by the adapter; the document keeps its own copy of the bytes.

public System.Threading.Tasks.Task<Avalonia.Controls.Pdf.Core.IPdfDocument> LoadDocumentAsync(System.IO.Stream stream, string password, System.Threading.CancellationToken cancellationToken)
Parameters

stream System.IO.Stream

password string

cancellationToken System.Threading.CancellationToken

Returns

System.Threading.Tasks.Task<Avalonia.Controls.Pdf.Core.IPdfDocument>

LoadDocumentAsync Method

public System.Threading.Tasks.Task<Avalonia.Controls.Pdf.Core.IPdfDocument> LoadDocumentAsync(ReadOnlyMemory<byte> data, string password, System.Threading.CancellationToken cancellationToken)
Parameters

data ReadOnlyMemory<byte>

password string

cancellationToken System.Threading.CancellationToken

Returns

System.Threading.Tasks.Task<Avalonia.Controls.Pdf.Core.IPdfDocument>

LoadDocumentAsync Method

Loads a PDF document from a file path.

public System.Threading.Tasks.Task<Avalonia.Controls.Pdf.Core.IPdfDocument> LoadDocumentAsync(string path, string password, System.Threading.CancellationToken cancellationToken)
Parameters

path string

password string

cancellationToken System.Threading.CancellationToken

Returns

System.Threading.Tasks.Task<Avalonia.Controls.Pdf.Core.IPdfDocument>

Properties

NameDescription
IsInitializedGets whether the adapter has been initialized.

IsInitialized Property

Gets whether the adapter has been initialized.

public bool IsInitialized { get; set; }

Events

NameDescription
ErrorEvent raised when the adapter encounters an error.

Error Event

Event raised when the adapter encounters an error.

public event EventHandler<Avalonia.Controls.Pdf.Core.PdfErrorEventArgs> Error