Export (0) Print
Expand All

IXpsFixedDocumentSequenceWriter Interface

Defines methods and properties for writing a FixedDocumentSequence.

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

public interface IXpsFixedDocumentSequenceWriter

The IXpsFixedDocumentSequenceWriter type exposes the following members.

  NameDescription
Public propertyPrintTicketSets a PrintTicket for the FixedDocumentSequence that is being written.
Public propertyUriGets the URI of the FixedDocumentSequence that is being written.
Top

  NameDescription
Public methodAddFixedDocumentAdds a new FixedDocument to the FixedDocumentSequence.
Public methodAddThumbnailAdds an XpsThumbnail image for the FixedDocumentSequence.
Public methodCommitFlushes and closes the FixedDocumentSequence writer.
Top

The following example shows how to use the AddFixedDocumentSequence method in order to obtain a FixedDocumentSequence writer for adding FixedDocument 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 void AddPackageContent(
    XpsDocument xpsDocument, bool attachPrintTicket)
{
    try
    {
        PrintTicket printTicket = GetPrintTicketFromPrinter();
        // PrintTicket is null, there is no need to attach one. 
        if (printTicket == null)
            attachPrintTicket = false;

        // Add a FixedDocumentSequence at the Package root
        IXpsFixedDocumentSequenceWriter documentSequenceWriter =
            xpsDocument.AddFixedDocumentSequence();

        // Add the 1st FixedDocument to the FixedDocumentSequence. - - - - -
        IXpsFixedDocumentWriter fixedDocumentWriter =
            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)
            fixedDocumentWriter.PrintTicket = printTicket;

        // Commit the 2nd document.
        fixedDocumentWriter.Commit();

        // If attaching PrintTickets, attach one at 
        // the package FixedDocumentSequence level. 
        if (attachPrintTicket)
            documentSequenceWriter.PrintTicket = printTicket;

        // Commit the FixedDocumentSequence
        documentSequenceWriter.Commit();
    }
    catch (XpsPackagingException xpsException)
    {
        throw xpsException;
    }
}// end:AddPackageContent()

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft