DocumentPaginator.GetPageAsync Method (Int32, Object)

Asynchronously returns (through the GetPageCompleted event) the DocumentPage for the specified page number and assigns the specified ID to the asynchronous task.

Namespace:  System.Windows.Documents
Assembly:  PresentationCore (in PresentationCore.dll)

public virtual void GetPageAsync(
	int pageNumber,
	Object userState
)

Parameters

pageNumber
Type: System.Int32

The zero-based page number of the DocumentPage to get.

userState
Type: System.Object

A unique identifier for the asynchronous task.

ExceptionCondition
ArgumentOutOfRangeException

pageNumber is negative.

This overload of the method makes it possible to cancel this asynchronous operation without cancelling all asynchronous operations.

This method raises the GetPageCompleted event. The DocumentPage is passed to the event as one of the event arguments.

The following steps illustrate how to retrieve a DocumentPage asynchronously:

  1. Create a GetPageCompletedEventHandler delegate and add it to be notified of GetPageCompleted events.

  2. Call GetPageAsync(Int32, Object) specifying the pageNumber desired and a unique userState, which will be used to identify the completion of the asynchronous event.

  3. When the event occurs and the delegate is called, compare the event's GetPageCompletedEventArgs.UserState property with the original GetPageAsync(Int32, Object) userState parameter. (The GetPageCompletedEventArgs.PageNumber property will also match the pageNumber specified in the GetPageAsync(Int32, Object) call.)

  4. When the GetPageCompletedEventArgs.UserState property matches the original GetPageAsync(Int32, Object) userState, the operation is complete and the page is ready.

  5. Call GetPage to retrieve the formatted DocumentPage.

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft