IXpsFixedDocumentReader.Uri 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 the uniform resource identifier (URI) of the FixedDocument.

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

Uri Uri { get; }

Property Value

Type: System.Uri

A Uri that represents the URI for the document.

The following example shows how to use the Uri property.

// --------------------- IterateXpsPackageParts() ---------------------
/// <summary>
///   Iterates through the parts contained in a given XpsDocument
///   package initializing a tree view control with the name of each
///   part contained within the package.</summary>
/// <param name="xpsDocument">
///   The XPS document to extract the part names from.</param>
/// <param name="treeView">
///   The TreeView control to insert the part names into.</param>
/// <param name="fileName">
///   The XPS document filename.</param>
public void IterateXpsPackageParts(
    XpsDocument xpsDocument, TreeView treeView, string fileName)
{
    // Set up the Tree View
    treeView.Items.Clear();
    treeView.Visibility      = Visibility.Visible;
    TreeViewItem packageNode = new TreeViewItem();
    packageNode.ToolTip      = fileName;
    packageNode.Header       = System.IO.Path.GetFileName(fileName);
    treeView.Items.Add(packageNode);

    // Start with a DoucmentSequence.
    IXpsFixedDocumentSequenceReader docSeq =
        xpsDocument.FixedDocumentSequenceReader;
    TreeViewItem docSeqNode = AddUriToTreeView(packageNode, docSeq.Uri);

    // For every FixedDocument within the DocumentSequence.
    foreach (IXpsFixedDocumentReader docReader in docSeq.FixedDocuments)
    {
        TreeViewItem docNode = AddUriToTreeView(docSeqNode, docReader.Uri);

        // For every FixedPage within the FixedDocument.
        foreach (IXpsFixedPageReader page in docReader.FixedPages)
        {
            TreeViewItem pageNode = AddUriToTreeView(docNode, docReader.Uri);

            // For every Image on the page.
            foreach (XpsImage image in page.Images)
            {
                AddUriToTreeView(pageNode, image.Uri);
            }

            // For every Font on the page.
            foreach (XpsFont font in page.Fonts)
            {
                AddUriToTreeView(pageNode, font.Uri);
            }
        }
    }
}// end:IterateXpsPackageParts()

.NET Framework
Available since 3.0
Return to top
Show: