Bewerken

Delen via


XpsDocumentWriter.Write Method

Definition

Overloads

Write(Visual, PrintTicket)

Writes synchronously a specified Visual together with a PrintTicket to the target XpsDocument or PrintQueue.

Write(FixedPage, PrintTicket)

Writes synchronously a specified FixedPage together with a PrintTicket to the target XpsDocument or PrintQueue.

Write(FixedDocumentSequence, PrintTicket)

Writes synchronously a specified FixedDocumentSequence together with a PrintTicket to the target XpsDocument or PrintQueue.

Write(FixedDocument, PrintTicket)

Writes synchronously a FixedDocument together with a PrintTicket to the target XpsDocument or PrintQueue.

Write(String, XpsDocumentNotificationLevel)

Writes synchronously a specified XPS document to the target XpsDocument or PrintQueue.

Write(DocumentPaginator, PrintTicket)

Writes synchronously paginated content from a specified DocumentPaginator together with a PrintTicket to the target XpsDocument or PrintQueue.

Write(FixedPage)

Writes synchronously a specified FixedPage to the target XpsDocument or PrintQueue.

Write(FixedDocumentSequence)

Writes synchronously a specified FixedDocumentSequence to the target XpsDocument or PrintQueue.

Write(FixedDocument)

Writes synchronously a specified FixedDocument to the target XpsDocument or PrintQueue.

Write(DocumentPaginator)

Writes synchronously paginated content from a specified DocumentPaginator to the target XpsDocument or PrintQueue.

Write(String)

Synchronously writes a specified XPS document to the target XpsDocument or PrintQueue.

Write(Visual)

Writes synchronously a specified Visual to the target XpsDocument or PrintQueue.

Write(Visual, PrintTicket)

Writes synchronously a specified Visual together with a PrintTicket to the target XpsDocument or PrintQueue.

public:
 override void Write(System::Windows::Media::Visual ^ visual, System::Printing::PrintTicket ^ printTicket);
public override void Write (System.Windows.Media.Visual visual, System.Printing.PrintTicket printTicket);
override this.Write : System.Windows.Media.Visual * System.Printing.PrintTicket -> unit
Public Overrides Sub Write (visual As Visual, printTicket As PrintTicket)

Parameters

visual
Visual

The Visual that is written.

printTicket
PrintTicket

A PrintTicket that represents the default printing preferences for the document.

Remarks

To batch write a Visual, use VisualsToXpsDocument.

This method does not validate or modify the specified printTicket for a particular PrintQueue. If necessary, use the MergeAndValidatePrintTicket method to create a PrintTicket that is specific to the PrintQueue and is valid for a specified printer.

Applies to

Write(FixedPage, PrintTicket)

Writes synchronously a specified FixedPage together with a PrintTicket to the target XpsDocument or PrintQueue.

public:
 override void Write(System::Windows::Documents::FixedPage ^ fixedPage, System::Printing::PrintTicket ^ printTicket);
public override void Write (System.Windows.Documents.FixedPage fixedPage, System.Printing.PrintTicket printTicket);
override this.Write : System.Windows.Documents.FixedPage * System.Printing.PrintTicket -> unit
Public Overrides Sub Write (fixedPage As FixedPage, printTicket As PrintTicket)

Parameters

fixedPage
FixedPage

The page that is written.

printTicket
PrintTicket

A PrintTicket that represents the default printing preferences for the page.

Remarks

This method does not validate or modify the specified printTicket for a particular PrintQueue. If necessary, use the MergeAndValidatePrintTicket method to create a PrintTicket that is specific to the PrintQueue and is valid for a specified printer.

Applies to

Write(FixedDocumentSequence, PrintTicket)

Writes synchronously a specified FixedDocumentSequence together with a PrintTicket to the target XpsDocument or PrintQueue.

public:
 override void Write(System::Windows::Documents::FixedDocumentSequence ^ fixedDocumentSequence, System::Printing::PrintTicket ^ printTicket);
public override void Write (System.Windows.Documents.FixedDocumentSequence fixedDocumentSequence, System.Printing.PrintTicket printTicket);
override this.Write : System.Windows.Documents.FixedDocumentSequence * System.Printing.PrintTicket -> unit
Public Overrides Sub Write (fixedDocumentSequence As FixedDocumentSequence, printTicket As PrintTicket)

Parameters

fixedDocumentSequence
FixedDocumentSequence

The set of documents that are written.

printTicket
PrintTicket

A PrintTicket that represents the default printing preferences for the set of documents.

Remarks

Although the XpsDocument class has a singular name, an XpsDocument can be one FixedDocument or a set of multiple documents. This method adds a FixedDocument or a set of FixedDocument elements to the existing set.

This method does not validate or modify the specified printTicket for a particular PrintQueue. If necessary, use the MergeAndValidatePrintTicket method to create a PrintTicket that is specific to the PrintQueue and is valid for a specified printer.

Applies to

Write(FixedDocument, PrintTicket)

Writes synchronously a FixedDocument together with a PrintTicket to the target XpsDocument or PrintQueue.

public:
 override void Write(System::Windows::Documents::FixedDocument ^ fixedDocument, System::Printing::PrintTicket ^ printTicket);
public override void Write (System.Windows.Documents.FixedDocument fixedDocument, System.Printing.PrintTicket printTicket);
override this.Write : System.Windows.Documents.FixedDocument * System.Printing.PrintTicket -> unit
Public Overrides Sub Write (fixedDocument As FixedDocument, printTicket As PrintTicket)

Parameters

fixedDocument
FixedDocument

The document that is written.

printTicket
PrintTicket

A PrintTicket that represents the default printing preferences for the document.

Remarks

Although the XpsDocument class has a singular name, an XpsDocument can be one FixedDocument or a set of multiple documents. This method adds a FixedDocument to the set.

This method does not validate or modify the specified printTicket for a particular PrintQueue. If necessary, use the MergeAndValidatePrintTicket method to create a PrintTicket that is specific to the PrintQueue and is valid for a specified printer.

Applies to

Write(String, XpsDocumentNotificationLevel)

Writes synchronously a specified XPS document to the target XpsDocument or PrintQueue.

public:
 void Write(System::String ^ documentPath, System::Windows::Xps::XpsDocumentNotificationLevel notificationLevel);
public void Write (string documentPath, System.Windows.Xps.XpsDocumentNotificationLevel notificationLevel);
override this.Write : string * System.Windows.Xps.XpsDocumentNotificationLevel -> unit
Public Sub Write (documentPath As String, notificationLevel As XpsDocumentNotificationLevel)

Parameters

documentPath
String

The path of the source document.

notificationLevel
XpsDocumentNotificationLevel

An indication of whether notification is enabled.

Remarks

When notificationLevel is disabled, the XpsDocumentWriter copies the serializedXPS document to the target XpsDocument or PrintQueue that created the XpsDocumentWriter. When notificationLevel is enabled, the XpsDocumentWriter first deserializes the document, next reserializes it, and then writes it to the target with progress notifications as each page is output.

Although the XpsDocument class has a singular name, an XpsDocument can be one FixedDocument or a set of multiple documents. This method adds the FixedDocument elements in the source to the sequence of FixedDocument elements in the target XpsDocument or PrintQueue.

If notificationLevel is specified as ReceiveNotificationEnabled, notifications are produced only when the document is serialized, not printed. To receive notifications the document must be reserialized. When a document is reserialized, all content from the Package that's not required to be preserved by the XML Paper Specification (XPS) is removed. The reserialization will also remove all extensions from the FixedPage markup, including any extended XPS content.

If notificationLevel is specified as ReceiveNotificationDisabled the document will not be reserialized and any extended content will be preserved, even when printed.

By design this Write method does not call the WritingPrintTicketRequired event.

Applies to

Write(DocumentPaginator, PrintTicket)

Writes synchronously paginated content from a specified DocumentPaginator together with a PrintTicket to the target XpsDocument or PrintQueue.

public:
 override void Write(System::Windows::Documents::DocumentPaginator ^ documentPaginator, System::Printing::PrintTicket ^ printTicket);
public override void Write (System.Windows.Documents.DocumentPaginator documentPaginator, System.Printing.PrintTicket printTicket);
override this.Write : System.Windows.Documents.DocumentPaginator * System.Printing.PrintTicket -> unit
Public Overrides Sub Write (documentPaginator As DocumentPaginator, printTicket As PrintTicket)

Parameters

documentPaginator
DocumentPaginator

An object that contains a pointer to unpaginated source material and also contains methods for paginating the material.

printTicket
PrintTicket

A PrintTicket that represents the default printing preferences for material.

Remarks

This method does not validate or modify the specified printTicket for a particular PrintQueue. If necessary, use the MergeAndValidatePrintTicket method to create a PrintTicket that is specific to the PrintQueue and is valid for a specified printer.

Applies to

Write(FixedPage)

Writes synchronously a specified FixedPage to the target XpsDocument or PrintQueue.

public:
 override void Write(System::Windows::Documents::FixedPage ^ fixedPage);
public override void Write (System.Windows.Documents.FixedPage fixedPage);
override this.Write : System.Windows.Documents.FixedPage -> unit
Public Overrides Sub Write (fixedPage As FixedPage)

Parameters

fixedPage
FixedPage

A page that is written to the XpsDocument.

Applies to

Write(FixedDocumentSequence)

Writes synchronously a specified FixedDocumentSequence to the target XpsDocument or PrintQueue.

public:
 override void Write(System::Windows::Documents::FixedDocumentSequence ^ fixedDocumentSequence);
public override void Write (System.Windows.Documents.FixedDocumentSequence fixedDocumentSequence);
override this.Write : System.Windows.Documents.FixedDocumentSequence -> unit
Public Overrides Sub Write (fixedDocumentSequence As FixedDocumentSequence)

Parameters

fixedDocumentSequence
FixedDocumentSequence

A set of documents that is written to the XpsDocument.

Examples

The following example shows how to use the Write method to write a sequence of XPS documents.

private void SaveMultipleFixedContentDocuments(
             XpsDocumentWriter xpsdw, FixedDocumentSequence fds)
{
    // Write the FixedDocumentSequence as a collection of documents
    xpsdw.Write(fds);
}
Private Sub SaveMultipleFixedContentDocuments(ByVal xpsdw As XpsDocumentWriter, ByVal fds As FixedDocumentSequence)
    ' Write the FixedDocumentSequence as a collection of documents
    xpsdw.Write(fds)
End Sub

Remarks

Although the XpsDocument class has a singular name, an XpsDocument can be one FixedDocument or a set of multiple documents. This method adds a FixedDocument or a set of FixedDocument elements to the existing set.

Applies to

Write(FixedDocument)

Writes synchronously a specified FixedDocument to the target XpsDocument or PrintQueue.

public:
 override void Write(System::Windows::Documents::FixedDocument ^ fixedDocument);
public override void Write (System.Windows.Documents.FixedDocument fixedDocument);
override this.Write : System.Windows.Documents.FixedDocument -> unit
Public Overrides Sub Write (fixedDocument As FixedDocument)

Parameters

fixedDocument
FixedDocument

A document that is written to the XpsDocument.

Examples

The following example shows how to use this method to write to an XPS document.

private void SaveSingleFixedContentDocument(
             XpsDocumentWriter xpsdw, FixedDocument fd)
{
    xpsdw.Write(fd);        // Write the FixedDocument as a document.
}
Private Sub SaveSingleFixedContentDocument(ByVal xpsdw As XpsDocumentWriter, ByVal fd As FixedDocument)
    xpsdw.Write(fd) ' Write the FixedDocument as a document.
End Sub

Remarks

Although the XpsDocument class has a singular name, an XpsDocument can be one FixedDocument or a set of multiple documents. This method adds a FixedDocument to the set.

Applies to

Write(DocumentPaginator)

Writes synchronously paginated content from a specified DocumentPaginator to the target XpsDocument or PrintQueue.

public:
 override void Write(System::Windows::Documents::DocumentPaginator ^ documentPaginator);
public override void Write (System.Windows.Documents.DocumentPaginator documentPaginator);
override this.Write : System.Windows.Documents.DocumentPaginator -> unit
Public Overrides Sub Write (documentPaginator As DocumentPaginator)

Parameters

documentPaginator
DocumentPaginator

An object that contains a pointer to unpaginated source material and also contains methods for paginating the material.

Examples

The following example shows how to use the Write method to write to an XPS document.

private void SaveSingleFlowContentDocument(
             XpsDocumentWriter xpsdw, DocumentPaginator docPaginator)
{
    xpsdw.Write(docPaginator); // Write the DocPaginator as a document.
}
Private Sub SaveSingleFlowContentDocument(ByVal xpsdw As XpsDocumentWriter, ByVal docPaginator As DocumentPaginator)
    xpsdw.Write(docPaginator) ' Write the DocPaginator as a document.
End Sub

Applies to

Write(String)

Synchronously writes a specified XPS document to the target XpsDocument or PrintQueue.

public:
 void Write(System::String ^ documentPath);
public void Write (string documentPath);
override this.Write : string -> unit
Public Sub Write (documentPath As String)

Parameters

documentPath
String

The path of the source document.

Remarks

Although the XpsDocumentWriter class has a singular name, an XpsDocumentWriter can be one FixedDocument or a set of multiple documents. This method adds the FixedDocument elements in the source to the set of FixedDocument elements in the target XpsDocumentWriter or PrintQueue.

This Write method reserializes the specified XPS document, which removes all content from the Package that isn't required to be preserved by the XML Paper Specification. The reserialization also removes all extensions from the FixedPage markup, including any extended XPS content.

By design, this Write method does not raise the WritingPrintTicketRequired event.

Applies to

Write(Visual)

Writes synchronously a specified Visual to the target XpsDocument or PrintQueue.

public:
 override void Write(System::Windows::Media::Visual ^ visual);
public override void Write (System.Windows.Media.Visual visual);
override this.Write : System.Windows.Media.Visual -> unit
Public Overrides Sub Write (visual As Visual)

Parameters

visual
Visual

The Visual that is written.

Examples

The following example shows how to use the Write method to write a Visual to an XPS document.

private void SaveVisual(XpsDocumentWriter xpsdw, Visual v)
{
    xpsdw.Write(v); // Write visual to single page
}
Private Sub SaveVisual(ByVal xpsdw As XpsDocumentWriter, ByVal v As Visual)
    xpsdw.Write(v) ' Write visual to single page
End Sub

Remarks

To batch write a Visual, use VisualsToXpsDocument.

Applies to