Share via


IXpsFixedDocumentReader インターフェイス

定義

FixedDocument のパーツの読み取りや、ドキュメントへの制限された種類の書き込みを行うメソッドを定義します。

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

次の例は、このインターフェイスを実装するオブジェクトへの参照を取得する方法を示しています。


private void SignatureDefinitionCommandHandler(object sender, RoutedEventArgs e)
{
    SignatureDefinition sigDefDialog = new SignatureDefinition();
    if (sigDefDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
    {
        XpsSignatureDefinition signatureDefinition = new XpsSignatureDefinition();
        signatureDefinition.RequestedSigner = sigDefDialog.RequestedSigner.Text;
        signatureDefinition.Intent = sigDefDialog.Intent.Text;
        signatureDefinition.SigningLocale = sigDefDialog.SigningLocale.Text;
        try
        {
            signatureDefinition.SignBy = DateTime.Parse(sigDefDialog.SignBy.Text);
        }
        catch (FormatException)
        {
        }
        signatureDefinition.SpotId = Guid.NewGuid();
        IXpsFixedDocumentSequenceReader docSeq = _xpsDocument.FixedDocumentSequenceReader; //_xpsDocument is type System.Windows.Xps.Packaging.XpsDocument
        IXpsFixedDocumentReader doc = docSeq.FixedDocuments[0];
        doc.AddSignatureDefinition(signatureDefinition);
        doc.CommitSignatureDefinition();
        InitializeSignatureDisplay();
    }
}

Private Sub SignatureDefinitionCommandHandler(sender As Object, e As RoutedEventArgs)
    Using sigDefDialog As New SignatureDefinition()
        If sigDefDialog.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
            Dim signatureDefinition As New XpsSignatureDefinition With {
                .RequestedSigner = sigDefDialog.RequestedSigner.Text,
                .Intent = sigDefDialog.Intent.Text,
                .SigningLocale = sigDefDialog.SigningLocale.Text
            }
            Try
                signatureDefinition.SignBy = Date.Parse(sigDefDialog.SignBy.Text)
            Catch e1 As FormatException
            End Try
            signatureDefinition.SpotId = Guid.NewGuid()
            Dim docSeq As IXpsFixedDocumentSequenceReader = _xpsDocument.FixedDocumentSequenceReader '_xpsDocument is type System.Windows.Xps.Packaging.XpsDocument
            Dim doc As IXpsFixedDocumentReader = docSeq.FixedDocuments(0)
            doc.AddSignatureDefinition(signatureDefinition)
            doc.CommitSignatureDefinition()
            InitializeSignatureDisplay()
        End If
    End Using
End Sub

次の例では、a IXpsFixedDocumentReader を使用してコレクションを IXpsFixedDocumentReader 取得し 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();
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()

プロパティ

DocumentNumber

FixedDocumentSequence 内のドキュメントの 0 から始まる位置を取得します。

DocumentStructure

FixedDocumentDocumentStructure パーツが存在する場合は、そのパーツを取得します。

FixedPages

FixedPage 内の各ページに対して 1 つずつ存在する FixedDocument リーダーのコレクションを取得します。

PrintTicket

存在する場合は、PrintTicket に関連付けられている FixedDocument を取得します。

SignatureDefinitions

FixedDocument に関連付けられているすべての署名定義のコレクションを取得します。

Thumbnail

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

Uri

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

メソッド

AddDocumentStructure()

DocumentStructure XML Paper Specification (XPS) の部分を XPS パッケージに追加します。

(継承元 IDocumentStructureProvider)
AddSignatureDefinition(XpsSignatureDefinition)

指定した XpsSignatureDefinitionFixedDocument に追加します。

CommitSignatureDefinition()

パッケージ Stream をフラッシュし、XpsSignatureDefinition をパッケージにコミットします。

GetFixedPage(Uri)

指定した Uniform Resource Identifier (URI) の FixedPage のリーダーを取得します。

RemoveSignatureDefinition(XpsSignatureDefinition)

指定した XpsSignatureDefinitionFixedDocument から削除します。

適用対象