Op Englesch liesen Editéieren

Deelen iwwer


IXpsFixedDocumentReader Interface

Definition

Defines methods for reading the parts of a FixedDocument and also for limited types of writing to the document.

C#
public interface IXpsFixedDocumentReader : System.Windows.Xps.Packaging.IDocumentStructureProvider
Implements

Examples

The following example shows how to obtain a reference to an object that implements this interface.

C#

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();
    }
}

The following example shows how to use an IXpsFixedDocumentReader to obtain an IXpsFixedDocumentReader collection in order to access each page in a FixedDocument.

C#
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();

Properties

DocumentNumber

Gets the zero-based position of the document in the FixedDocumentSequence.

DocumentStructure

Gets the DocumentStructure part, if one exists, of the FixedDocument.

FixedPages

Gets a collection of FixedPage readers, one reader for each page in the FixedDocument.

PrintTicket

Gets the PrintTicket, if one exists, that is associated with the FixedDocument.

SignatureDefinitions

Gets a collection of all the signature definitions that are associated with the FixedDocument.

Thumbnail

Gets the thumbnail image, if a thumbnail exists, that is associated with the FixedDocument.

Uri

Gets the uniform resource identifier (URI) of the FixedDocument.

Methods

AddDocumentStructure()

Adds the DocumentStructure part of XML Paper Specification (XPS) to an XPS package.

(Inherited from IDocumentStructureProvider)
AddSignatureDefinition(XpsSignatureDefinition)

Adds the specified XpsSignatureDefinition to the FixedDocument.

CommitSignatureDefinition()

Flushes the package Stream and also commits an XpsSignatureDefinition to the package.

GetFixedPage(Uri)

Gets a reader for the FixedPage with the specified uniform resource identifier (URI).

RemoveSignatureDefinition(XpsSignatureDefinition)

Removes the specified XpsSignatureDefinition from the FixedDocument.

Applies to

Produkt Versiounen
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10