Op Englesch liesen Editéieren

Deelen iwwer


IXpsFixedDocumentWriter Interface

Definition

Defines methods and properties for writing a FixedDocument.

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

Examples

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.

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

Properties

DocumentNumber

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

PrintTicket

Sets default print options for the FixedDocument.

Uri

Gets the URI of the FixedDocument.

Methods

AddDocumentStructure()

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

(Inherited from IDocumentStructureProvider)
AddFixedPage()

Adds a new FixedPage to the FixedDocument.

AddThumbnail(XpsImageType)

Adds an XpsThumbnail image for the FixedDocument.

Commit()

Flushes and closes the FixedDocument writer.

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