IXpsFixedDocumentReader Interface

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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

Namespace:   System.Windows.Xps.Packaging
Assembly:  ReachFramework (in ReachFramework.dll)

Public Interface IXpsFixedDocumentReader
	Inherits IDocumentStructureProvider

NameDescription
System_CAPS_pubpropertyDocumentNumber

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

System_CAPS_pubpropertyDocumentStructure

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

System_CAPS_pubpropertyFixedPages

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

System_CAPS_pubpropertyPrintTicket

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

System_CAPS_pubpropertySignatureDefinitions

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

System_CAPS_pubpropertyThumbnail

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

System_CAPS_pubpropertyUri

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

NameDescription
System_CAPS_pubmethodAddDocumentStructure()

Adds theDocumentStructure part of XML Paper Specification (XPS) to an XPS package.(Inherited from IDocumentStructureProvider.)

System_CAPS_pubmethodAddSignatureDefinition(XpsSignatureDefinition)

Adds the specified XpsSignatureDefinition to the FixedDocument.

System_CAPS_pubmethodCommitSignatureDefinition()

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

System_CAPS_pubmethodGetFixedPage(Uri)

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

System_CAPS_pubmethodRemoveSignatureDefinition(XpsSignatureDefinition)

Removes the specified XpsSignatureDefinition from the FixedDocument.

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


Private Sub SignatureDefinitionCommandHandler(ByVal sender As Object, ByVal e As RoutedEventArgs)
	Dim sigDefDialog As New SignatureDefinition()
	If sigDefDialog.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
		Dim signatureDefinition As New XpsSignatureDefinition()
		signatureDefinition.RequestedSigner = sigDefDialog.RequestedSigner.Text
		signatureDefinition.Intent = sigDefDialog.Intent.Text
		signatureDefinition.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 Sub

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.")
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()

.NET Framework
Available since 3.0
Return to top
Show: