IXpsFixedDocumentReader.FixedPages Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets a collection of FixedPage readers, one reader for each page in the FixedDocument.

Namespace:   System.Windows.Xps.Packaging
Assembly:  ReachFramework (in ReachFramework.dll)

ReadOnlyCollection<IXpsFixedPageReader> FixedPages { get; }

Property Value

Type: System.Collections.ObjectModel.ReadOnlyCollection<IXpsFixedPageReader>

A collection of fixed page readers, one reader for each page in the FixedDocument.

The following example shows how to use the FixedPages property to obtain an IXpsFixedDocumentReader collection in order to access the individual pages in a FixedDocument.

ShowStatus("   Getting FixedDocumentSequenceReader.");
IXpsFixedDocumentSequenceReader fixedDocSeqReader =
    xpsDocument.FixedDocumentSequenceReader;

ShowStatus("   Getting FixedDocumentReaders.");
ICollection<IXpsFixedDocumentReader> fixedDocuments =
    fixedDocSeqReader.FixedDocuments;

ShowStatus("   Getting FixedPageReaders.");
IEnumerator<IXpsFixedDocumentReader> enumerator =
    fixedDocuments.GetEnumerator();
enumerator.MoveNext();
ICollection<IXpsFixedPageReader> fixedPages =
    enumerator.Current.FixedPages;


// Add a document structure to each fixed page.
int i = 0;
foreach (IXpsFixedPageReader fixedPageReader in fixedPages)
{
    XpsResource pageStructure;
    ShowStatus("   Adding page structure resource:\n       '" +
                       Filename(_fixedPageStructures[i]) + "'");
    try
    {   // Add a new StoryFragment to hold the page structure.
        pageStructure = fixedPageReader.AddStoryFragment();
    }
    catch (System.InvalidOperationException)
    {
        MessageBox.Show(xpsUnstructuredFile +
            "\n\nDocument structure cannot be added.\n\n" +
            Filename(xpsUnstructuredFile) + " might already " +
            "contain an existing document structure.",
            "Cannot Add Document Structure",
            MessageBoxButton.OK, MessageBoxImage.Error);
        break;
    }

    // Copy the page structure to the new StoryFragment.
    WriteResource(pageStructure, _fixedPageStructures[i++]);
}

ShowStatus("   Saving and closing the new document.\n");
xpsDocument.Close();

.NET Framework
Available since 3.0
Return to top
Show: