Share via


IXpsFixedPageReader インターフェイス

定義

FixedPage のパーツの読み取りを行うメソッドを定義します。

public interface class IXpsFixedPageReader : System::Windows::Xps::Packaging::IStoryFragmentProvider
public interface IXpsFixedPageReader : System.Windows.Xps.Packaging.IStoryFragmentProvider
type IXpsFixedPageReader = interface
    interface IStoryFragmentProvider
Public Interface IXpsFixedPageReader
Implements IStoryFragmentProvider
実装

次の例は、 からコレクションを取得する IXpsFixedPageReader 方法を IXpsFixedDocumentReader示しています。 このサンプルでは、固定ページ リーダーを使用して、ページのドキュメント構造を定義する新しい StoryFragment を追加する方法も示します。

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();
ShowStatus("   Getting FixedDocumentSequenceReader.")
Dim fixedDocSeqReader As IXpsFixedDocumentSequenceReader = xpsDocument.FixedDocumentSequenceReader

ShowStatus("   Getting FixedDocumentReaders.")
Dim fixedDocuments As ICollection(Of IXpsFixedDocumentReader) = fixedDocSeqReader.FixedDocuments

ShowStatus("   Getting FixedPageReaders.")
Dim enumerator As IEnumerator(Of IXpsFixedDocumentReader) = fixedDocuments.GetEnumerator()
enumerator.MoveNext()
Dim fixedPages As ICollection(Of IXpsFixedPageReader) = enumerator.Current.FixedPages


' Add a document structure to each fixed page.
Dim i As Integer = 0
For Each fixedPageReader As IXpsFixedPageReader In fixedPages
    Dim pageStructure As XpsResource
    ShowStatus("   Adding page structure resource:" & vbLf & "       '" & Filename(_fixedPageStructures(i)) & "'")
    Try
        pageStructure = fixedPageReader.AddStoryFragment()
    Catch e2 As InvalidOperationException
        System.Windows.MessageBox.Show(xpsUnstructuredFile & vbLf & vbLf & "Document structure cannot be added." & vbLf & vbLf & Filename(xpsUnstructuredFile) & " might already " & "contain an existing document structure.",
                        "Cannot Add Document Structure",
                        MessageBoxButton.OK,
                        MessageBoxImage.Error)
        Exit For
    End Try

    ' Copy the page structure to the new StoryFragment.
    WriteResource(pageStructure, _fixedPageStructures(i))
    i += 1
Next fixedPageReader

ShowStatus("   Saving and closing the new document." & vbLf)
xpsDocument.Close()

プロパティ

ColorContexts

ページ上のすべてのカラー コンテキストのコレクションを取得します。

Fonts

ページで使用されるすべてのフォントのコレクションを取得します。

Images

ページ上のすべてのイメージのコレクションを取得します。

PageNumber

ページ番号を取得します。

PrintTicket

チケットが存在する場合は、PrintTicket に関連付けられている FixedPage を取得します。

ResourceDictionaries

ページに対するすべてのリソース ディクショナリのコレクションを取得します。

StoryFragment

XPS パッケージの StoryFragments マークアップの部分を取得します。

Thumbnail

サムネイルが存在する場合は、FixedPage に関連付けられているサムネイル イメージを取得します。

Uri

FixedPage の Uniform Resource Identifier (URI) を取得します。

XmlReader

ページの XmlReader を取得します。

メソッド

AddStoryFragment()

XPS パッケージに StoryFragments 要素を追加します。

(継承元 IStoryFragmentProvider)
GetColorContext(Uri)

指定した Uniform Resource Identifier (URI) を持つリソースのカラー コンテキストを取得します。

GetFont(Uri)

指定した Uniform Resource Identifier (URI) を持つフォントを取得します。

GetImage(Uri)

指定した Uniform Resource Identifier (URI) を持つイメージを取得します。

GetResource(Uri)

指定した Uniform Resource Identifier (URI) を持つリソースを取得します。

GetResourceDictionary(Uri)

指定した Uniform Resource Identifier (URI) を持つリソース ディクショナリを取得します。

適用対象