OpenAsync(Stream, CancellationToken) Method

Definition

Namespace Broadside
Assembly Broadside.dll

Opens the PDF file held by stream, from its current position, reading a non-seekable stream asynchronously.

public Task<PdfDocument> OpenAsync(Stream stream, CancellationToken cancellationToken)

Parameters

stream
Stream

The stream. It is not disposed. A seekable stream is read in place as objects are used: keep it open and unchanged until the document is disposed. A non-seekable stream is read to its end, asynchronously, before the file is parsed.

cancellationToken
CancellationToken

Cancels reading a non-seekable stream.

Returns

Task<PdfDocument>
The document. Dispose it when done.

Remarks

ISO 32000-2 §7.5. Reading is synchronous once the bytes are available (spec #33: Async only at the open and save boundaries), so this differs from Open(Stream) only in how a non-seekable stream is copied.