IXpsFixedDocumentReader Interfaccia

Definizione

Definisce i metodi per la lettura delle parti di un FixedDocument e anche per tipi limitati di scrittura del documento.Defines methods for reading the parts of a FixedDocument and also for limited types of writing to the document.

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
Implementazioni

Esempio

Nell'esempio seguente viene illustrato come ottenere un riferimento a un oggetto che implementa questa interfaccia.The following example shows how to obtain a reference to an object that implements this interface.


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

Nell'esempio seguente viene illustrato come utilizzare un oggetto IXpsFixedDocumentReader per ottenere una IXpsFixedDocumentReader raccolta per accedere a ogni pagina di un oggetto FixedDocument .The following example shows how to use an IXpsFixedDocumentReader to obtain an IXpsFixedDocumentReader collection in order to access each page 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();
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()

Proprietà

DocumentNumber

Ottiene la posizione in base zero del documento nell'oggetto FixedDocumentSequence desiderato.Gets the zero-based position of the document in the FixedDocumentSequence.

DocumentStructure

Ottiene la parte DocumentStructure di FixedDocument, se esiste.Gets the DocumentStructure part, if one exists, of the FixedDocument.

FixedPages

Ottiene un insieme di lettori FixedPage, un lettore per ogni pagina in FixedDocument.Gets a collection of FixedPage readers, one reader for each page in the FixedDocument.

PrintTicket

Ottiene un oggetto PrintTicket, se esiste, associato a FixedDocument.Gets the PrintTicket, if one exists, that is associated with the FixedDocument.

SignatureDefinitions

Ottiene un insieme di tutte le definizioni della firma associate a FixedDocument.Gets a collection of all the signature definitions that are associated with the FixedDocument.

Thumbnail

Ottiene l'immagine di anteprima, se esiste un'anteprima, associata a FixedDocument.Gets the thumbnail image, if a thumbnail exists, that is associated with the FixedDocument.

Uri

Ottiene l'URI (Uniform Resource Identifier) di FixedDocument.Gets the uniform resource identifier (URI) of the FixedDocument.

Metodi

AddDocumentStructure()

Aggiunge la parte DocumentStructure di XML Paper Specification (XPS)XML Paper Specification (XPS) a un pacchetto di XPSXPS.Adds the DocumentStructure part of XML Paper Specification (XPS)XML Paper Specification (XPS) to an XPSXPS package.

(Ereditato da IDocumentStructureProvider)
AddSignatureDefinition(XpsSignatureDefinition)

Aggiunge l'oggetto XpsSignatureDefinition specificato alla raccolta FixedDocument.Adds the specified XpsSignatureDefinition to the FixedDocument.

CommitSignatureDefinition()

Svuota l'oggetto Stream del package ed esegue inoltre il commit di un XpsSignatureDefinition al pacchetto.Flushes the package Stream and also commits an XpsSignatureDefinition to the package.

GetFixedPage(Uri)

Ottiene un lettore per l'oggetto FixedPage con l'URI (Uniform Resource Identifier) specificato.Gets a reader for the FixedPage with the specified uniform resource identifier (URI).

RemoveSignatureDefinition(XpsSignatureDefinition)

Rimuove l'oggetto XpsSignatureDefinition specificato dall'oggetto FixedDocument.Removes the specified XpsSignatureDefinition from the FixedDocument.

Si applica a