IXpsFixedDocumentWriter Interface

 

Defines methods and properties for writing a FixedDocument.

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

Public Interface IXpsFixedDocumentWriter
	Inherits IDocumentStructureProvider

NameDescription
System_CAPS_pubpropertyDocumentNumber

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

System_CAPS_pubpropertyPrintTicket

Sets default print options for the FixedDocument.

System_CAPS_pubpropertyUri

Gets the 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_pubmethodAddFixedPage()

Adds a new FixedPage to the FixedDocument.

System_CAPS_pubmethodAddThumbnail(XpsImageType)

Adds an XpsThumbnail image for the FixedDocument.

System_CAPS_pubmethodCommit()

Flushes and closes the FixedDocument writer.

The following example shows how to use the AddFixedDocument method in order to obtain a fixed-document writer for adding FixedPage content to an XpsDocument.

' ------------------------- AddPackageContent ----------------------------
''' <summary>
'''   Adds a predefined set of content to a given XPS document.</summary>
''' <param name="xpsDocument">
'''   The package to add the document content to.</param>
''' <param name="attachPrintTicket">
'''   true to include a PrintTicket with the
'''   document; otherwise, false.</param>
Private Sub AddPackageContent(ByVal xpsDocument As XpsDocument, ByVal attachPrintTicket As Boolean)
    Try
        Dim printTicket As PrintTicket = GetPrintTicketFromPrinter()
        ' PrintTicket is null, there is no need to attach one.
        If printTicket Is Nothing Then
            attachPrintTicket = False
        End If

        ' Add a FixedDocumentSequence at the Package root
        Dim documentSequenceWriter As IXpsFixedDocumentSequenceWriter = xpsDocument.AddFixedDocumentSequence()

        ' Add the 1st FixedDocument to the FixedDocumentSequence. - - - - -
        Dim fixedDocumentWriter As IXpsFixedDocumentWriter = documentSequenceWriter.AddFixedDocument()

        ' Add content to the 1st document
        AddDocumentContent(fixedDocumentWriter)

        ' Commit the 1st Document
        fixedDocumentWriter.Commit()

        ' Add a 2nd FixedDocument to the FixedDocumentSequence. - - - - - -
        fixedDocumentWriter = documentSequenceWriter.AddFixedDocument()

        ' Add content to the 2nd document.
        AddDocumentContent(fixedDocumentWriter)

        ' If attaching PrintTickets, attach one at the FixedDocument level.
        If attachPrintTicket Then
            fixedDocumentWriter.PrintTicket = printTicket
        End If

        ' Commit the 2nd document.
        fixedDocumentWriter.Commit()

        ' If attaching PrintTickets, attach one at
        ' the package FixedDocumentSequence level.
        If attachPrintTicket Then
            documentSequenceWriter.PrintTicket = printTicket
        End If

        ' Commit the FixedDocumentSequence
        documentSequenceWriter.Commit()
    Catch xpsException As XpsPackagingException
        Throw xpsException
    End Try
End Sub ' end:AddPackageContent()

.NET Framework
Available since 3.0
Return to top
Show: