Export (0) Print
Expand All

IDocumentPaginatorSource Interface

Defines the source object that performs actual content pagination.

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

public interface IDocumentPaginatorSource
Interfaces cannot be used directly in XAML; see types that implement this interface.

The following example shows use of the IDocumentPaginatorSource interface. For the full sample, see Saving an XPS Document Sample.

// ------------------------- LoadDocumentViewer ----------------------- 
/// <summary> 
///   Loads content from a file to a DocumentViewer control.</summary> 
/// <param name="xpsFilename">
///   The path and name of the XPS file to 
///   load to the DocumentViewer control.</param> 
/// <remarks> 
///   Exception handling should be added if the xpsFilename may not be 
///   valid or if the FixedDocumentSequence contained in the file is 
///   incorrect.  (In this sample the files are hardcoded.)</remarks> 
private void LoadDocumentViewer(string xpsFilename)
{
    // Save a reference to the currently open XPS package.
    XpsDocument oldXpsPackage = _xpsPackage;

    // Open the package for the new XPS document.
    _xpsPackage = new XpsDocument(xpsFilename,
        FileAccess.Read, CompressionOption.NotCompressed);

    // Get the FixedDocumentSequence from the package.
    FixedDocumentSequence fixedDocumentSequence =
        _xpsPackage.GetFixedDocumentSequence();

    // Set the new FixedDocumentSequence as 
    // the DocumentViewer's paginator source.
    docViewer.Document =
        fixedDocumentSequence as IDocumentPaginatorSource;

    // If there was an old XPS package, close it now that 
    // DocumentViewer no longer needs to access it. 
    if (oldXpsPackage != null)
        oldXpsPackage.Close();

    // Leave the new _xpsPackage open for DocumentViewer 
    // to access additional required resources.

}// end:LoadDocumentViewer()

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

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

.NET Framework

Supported in: 3.5, 3.0

Community Additions

ADD
Show:
© 2014 Microsoft