다음을 통해 공유


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

다음 예제에서는 사용 하는 방법을 보여 줍니다는 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의 각 페이지에 하나씩 지정되어 있는 FixedDocument 판독기 컬렉션을 가져옵니다.

PrintTicket

PrintTicket와 연결된 FixedDocument을(있는 경우) 가져옵니다.

SignatureDefinitions

FixedDocument와 연결되어 있는 모든 서명 정의 컬렉션을 가져옵니다.

Thumbnail

FixedDocument와 연결되어 있는 축소판 그림 이미지(있는 경우)를 가져옵니다.

Uri

FixedDocument의 URI(Uniform Resource Identifier)를 가져옵니다.

메서드

AddDocumentStructure()

DocumentStructure XPS(XML Paper Specification)의 일부를 XPS 패키지에 추가합니다.

(다음에서 상속됨 IDocumentStructureProvider)
AddSignatureDefinition(XpsSignatureDefinition)

지정된 XpsSignatureDefinitionFixedDocument에 추가합니다.

CommitSignatureDefinition()

패키지 Stream을 플러시하고 패키지에 XpsSignatureDefinition을 커밋합니다.

GetFixedPage(Uri)

지정된 URI(Uniform Resource Identifier)가 포함된 FixedPage의 판독기를 가져옵니다.

RemoveSignatureDefinition(XpsSignatureDefinition)

XpsSignatureDefinition에서 지정된 FixedDocument을 제거합니다.

적용 대상