XpsDocumentWriter.Write XpsDocumentWriter.Write XpsDocumentWriter.Write XpsDocumentWriter.Write Method

Definition

Overloads

Write(Visual, PrintTicket) Write(Visual, PrintTicket) Write(Visual, PrintTicket)

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

Write(FixedPage, PrintTicket) Write(FixedPage, PrintTicket) Write(FixedPage, PrintTicket)

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

Write(FixedDocumentSequence, PrintTicket) Write(FixedDocumentSequence, PrintTicket) Write(FixedDocumentSequence, PrintTicket)

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

Write(FixedDocument, PrintTicket) Write(FixedDocument, PrintTicket) Write(FixedDocument, PrintTicket)

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

Write(String, XpsDocumentNotificationLevel) Write(String, XpsDocumentNotificationLevel) Write(String, XpsDocumentNotificationLevel) Write(String, XpsDocumentNotificationLevel)

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

Write(DocumentPaginator, PrintTicket) Write(DocumentPaginator, PrintTicket) Write(DocumentPaginator, PrintTicket)

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

Write(FixedPage) Write(FixedPage) Write(FixedPage)

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

Write(FixedDocumentSequence) Write(FixedDocumentSequence) Write(FixedDocumentSequence)

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

Write(FixedDocument) Write(FixedDocument) Write(FixedDocument)

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

Write(DocumentPaginator) Write(DocumentPaginator) Write(DocumentPaginator)

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

Write(String) Write(String) Write(String) Write(String)

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

Write(Visual) Write(Visual) Write(Visual)

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

Write(Visual, PrintTicket) Write(Visual, PrintTicket) 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

Parameters

visual
Visual Visual Visual Visual

The Visual that is written.

printTicket
PrintTicket PrintTicket 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.

Write(FixedPage, PrintTicket) Write(FixedPage, PrintTicket) 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

Parameters

fixedPage
FixedPage FixedPage FixedPage FixedPage

The page that is written.

printTicket
PrintTicket PrintTicket 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.

Write(FixedDocumentSequence, PrintTicket) Write(FixedDocumentSequence, PrintTicket) 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

Parameters

fixedDocumentSequence
FixedDocumentSequence FixedDocumentSequence FixedDocumentSequence FixedDocumentSequence

The set of documents that are written.

printTicket
PrintTicket PrintTicket 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.

Write(FixedDocument, PrintTicket) Write(FixedDocument, PrintTicket) 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

Parameters

fixedDocument
FixedDocument FixedDocument FixedDocument FixedDocument

The document that is written.

printTicket
PrintTicket PrintTicket 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.

Write(String, XpsDocumentNotificationLevel) Write(String, XpsDocumentNotificationLevel) Write(String, XpsDocumentNotificationLevel) 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 String String String

The path of the source document.

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 is 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.

Write(DocumentPaginator, PrintTicket) Write(DocumentPaginator, PrintTicket) 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

Parameters

documentPaginator
DocumentPaginator DocumentPaginator DocumentPaginator DocumentPaginator

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

printTicket
PrintTicket PrintTicket 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.

Write(FixedPage) Write(FixedPage) 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

Parameters

fixedPage
FixedPage FixedPage FixedPage FixedPage

A page that is written to the XpsDocument.

Write(FixedDocumentSequence) Write(FixedDocumentSequence) 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

Parameters

fixedDocumentSequence
FixedDocumentSequence FixedDocumentSequence 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.

Write(FixedDocument) Write(FixedDocument) 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

Parameters

fixedDocument
FixedDocument FixedDocument 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.

Write(DocumentPaginator) Write(DocumentPaginator) 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

Parameters

documentPaginator
DocumentPaginator DocumentPaginator 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

Write(String) Write(String) Write(String) 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 String String 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 will reserialize the specified XPS document, which will remove all content from the Package that is not required to be preserved by the XML Paper Specification. The reserialization will also remove all extensions from the FixedPage markup, including any extended XPS content.

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

Write(Visual) Write(Visual) 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

Parameters

visual
Visual Visual 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