XpsDocumentWriter.WriteAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Writes asynchronously to the XpsDocument or PrintQueue that created the XpsDocumentWriter.
Overloads
WriteAsync(FixedPage, Object)
Writes asynchronously a specified FixedPage to the target XpsDocument or PrintQueue.
public:
override void WriteAsync(System::Windows::Documents::FixedPage ^ fixedPage, System::Object ^ userSuppliedState);
public override void WriteAsync (System.Windows.Documents.FixedPage fixedPage, object userSuppliedState);
override this.WriteAsync : System.Windows.Documents.FixedPage * obj -> unit
Public Overrides Sub WriteAsync (fixedPage As FixedPage, userSuppliedState As Object)
Parameters
- fixedPage
- FixedPage
The page that is written.
- userSuppliedState
- Object
A user-specified object to identify and associate with the asynchronous operation.
Applies to
WriteAsync(FixedPage, PrintTicket)
Writes asynchronously a specified FixedPage together with a PrintTicket to the target XpsDocument or PrintQueue.
public:
override void WriteAsync(System::Windows::Documents::FixedPage ^ fixedPage, System::Printing::PrintTicket ^ printTicket);
public override void WriteAsync (System.Windows.Documents.FixedPage fixedPage, System.Printing.PrintTicket printTicket);
override this.WriteAsync : System.Windows.Documents.FixedPage * System.Printing.PrintTicket -> unit
Public Overrides Sub WriteAsync (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.
This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by Write(FixedPage, PrintTicket).
Applies to
WriteAsync(Visual, Object)
Writes asynchronously a specified Visual to the target XpsDocument or PrintQueue.
public:
override void WriteAsync(System::Windows::Media::Visual ^ visual, System::Object ^ userSuppliedState);
public override void WriteAsync (System.Windows.Media.Visual visual, object userSuppliedState);
override this.WriteAsync : System.Windows.Media.Visual * obj -> unit
Public Overrides Sub WriteAsync (visual As Visual, userSuppliedState As Object)
Parameters
- userSuppliedState
- Object
A user-specified object to identify and associate with the asynchronous operation.
Remarks
To batch write a Visual, use VisualsToXpsDocument.
Applies to
WriteAsync(Visual, PrintTicket)
Writes asynchronously a specified Visual together with a PrintTicket to the target XpsDocument or PrintQueue.
public:
override void WriteAsync(System::Windows::Media::Visual ^ visual, System::Printing::PrintTicket ^ printTicket);
public override void WriteAsync (System.Windows.Media.Visual visual, System.Printing.PrintTicket printTicket);
override this.WriteAsync : System.Windows.Media.Visual * System.Printing.PrintTicket -> unit
Public Overrides Sub WriteAsync (visual As Visual, printTicket As PrintTicket)
Parameters
- 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.
This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by Write(Visual, PrintTicket).
Applies to
WriteAsync(FixedDocumentSequence, PrintTicket, Object)
Writes asynchronously a specified FixedDocumentSequence together with a PrintTicket to the target XpsDocument or PrintQueue.
public:
override void WriteAsync(System::Windows::Documents::FixedDocumentSequence ^ fixedDocumentSequence, System::Printing::PrintTicket ^ printTicket, System::Object ^ userSuppliedState);
public override void WriteAsync (System.Windows.Documents.FixedDocumentSequence fixedDocumentSequence, System.Printing.PrintTicket printTicket, object userSuppliedState);
override this.WriteAsync : System.Windows.Documents.FixedDocumentSequence * System.Printing.PrintTicket * obj -> unit
Public Overrides Sub WriteAsync (fixedDocumentSequence As FixedDocumentSequence, printTicket As PrintTicket, userSuppliedState As Object)
Parameters
- fixedDocumentSequence
- FixedDocumentSequence
The set of documents to be written.
- printTicket
- PrintTicket
A PrintTicket that represents the default printing preferences for the set of documents.
- userSuppliedState
- Object
A user-specified object to identify and associate with the asynchronous operation.
Remarks
WriteAsync writes a set of documents asynchronously to the XpsDocument or PrintQueue that created the XpsDocumentWriter. The data that is written includes a PrintTicket and additional information that the caller wants to pass to an event handler.
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 sequence.
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
WriteAsync(FixedDocument, PrintTicket, Object)
Writes asynchronously a specified FixedDocument together with a PrintTicket to the target XpsDocument or PrintQueue.
public:
override void WriteAsync(System::Windows::Documents::FixedDocument ^ fixedDocument, System::Printing::PrintTicket ^ printTicket, System::Object ^ userSuppliedState);
public override void WriteAsync (System.Windows.Documents.FixedDocument fixedDocument, System.Printing.PrintTicket printTicket, object userSuppliedState);
override this.WriteAsync : System.Windows.Documents.FixedDocument * System.Printing.PrintTicket * obj -> unit
Public Overrides Sub WriteAsync (fixedDocument As FixedDocument, printTicket As PrintTicket, userSuppliedState As Object)
Parameters
- fixedDocument
- FixedDocument
The document that is written.
- printTicket
- PrintTicket
A PrintTicket that represents the default printing preferences for the document.
- userSuppliedState
- Object
A user-specified object to identify and associate with the asynchronous operation.
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
WriteAsync(FixedPage, PrintTicket, Object)
Writes asynchronously a specified FixedPage together with a PrintTicket to the target XpsDocument or PrintQueue.
public:
override void WriteAsync(System::Windows::Documents::FixedPage ^ fixedPage, System::Printing::PrintTicket ^ printTicket, System::Object ^ userSuppliedState);
public override void WriteAsync (System.Windows.Documents.FixedPage fixedPage, System.Printing.PrintTicket printTicket, object userSuppliedState);
override this.WriteAsync : System.Windows.Documents.FixedPage * System.Printing.PrintTicket * obj -> unit
Public Overrides Sub WriteAsync (fixedPage As FixedPage, printTicket As PrintTicket, userSuppliedState As Object)
Parameters
- fixedPage
- FixedPage
The page that is written.
- printTicket
- PrintTicket
A PrintTicket that represents the default printing preferences for the page.
- userSuppliedState
- Object
A user-specified object to identify and associate with the asynchronous operation.
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
WriteAsync(Visual, PrintTicket, Object)
Writes asynchronously a specified Visual together with a PrintTicket to the target XpsDocument or PrintQueue.
public:
override void WriteAsync(System::Windows::Media::Visual ^ visual, System::Printing::PrintTicket ^ printTicket, System::Object ^ userSuppliedState);
public override void WriteAsync (System.Windows.Media.Visual visual, System.Printing.PrintTicket printTicket, object userSuppliedState);
override this.WriteAsync : System.Windows.Media.Visual * System.Printing.PrintTicket * obj -> unit
Public Overrides Sub WriteAsync (visual As Visual, printTicket As PrintTicket, userSuppliedState As Object)
Parameters
- printTicket
- PrintTicket
A PrintTicket that represents the default printing preferences for the document.
- userSuppliedState
- Object
A user-specified object to identify and associate with the asynchronous operation.
Remarks
For writing multiple Visual elements, 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
WriteAsync(FixedDocumentSequence, PrintTicket)
Writes asynchronously a specified FixedDocumentSequence together with a PrintTicket to the target XpsDocument or PrintQueue.
public:
override void WriteAsync(System::Windows::Documents::FixedDocumentSequence ^ fixedDocumentSequence, System::Printing::PrintTicket ^ printTicket);
public override void WriteAsync (System.Windows.Documents.FixedDocumentSequence fixedDocumentSequence, System.Printing.PrintTicket printTicket);
override this.WriteAsync : System.Windows.Documents.FixedDocumentSequence * System.Printing.PrintTicket -> unit
Public Overrides Sub WriteAsync (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.
This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by Write(FixedDocumentSequence, PrintTicket).
Applies to
WriteAsync(DocumentPaginator, PrintTicket, Object)
Writes asynchronously paginated content from a specified DocumentPaginator together with a PrintTicket to the target XpsDocument or PrintQueue.
public:
override void WriteAsync(System::Windows::Documents::DocumentPaginator ^ documentPaginator, System::Printing::PrintTicket ^ printTicket, System::Object ^ userSuppliedState);
public override void WriteAsync (System.Windows.Documents.DocumentPaginator documentPaginator, System.Printing.PrintTicket printTicket, object userSuppliedState);
override this.WriteAsync : System.Windows.Documents.DocumentPaginator * System.Printing.PrintTicket * obj -> unit
Public Overrides Sub WriteAsync (documentPaginator As DocumentPaginator, printTicket As PrintTicket, userSuppliedState As Object)
Parameters
- documentPaginator
- DocumentPaginator
An object that contains a pointer to unpaginated source material; also contains methods for paginating the material.
- printTicket
- PrintTicket
A PrintTicket that represents the default printing preferences for the material.
- userSuppliedState
- Object
A user-specified object to identify and associate with the asynchronous operation.
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
WriteAsync(FixedDocumentSequence, Object)
Writes asynchronously a specified FixedDocumentSequence to the target XpsDocument or PrintQueue.
public:
override void WriteAsync(System::Windows::Documents::FixedDocumentSequence ^ fixedDocumentSequence, System::Object ^ userSuppliedState);
public override void WriteAsync (System.Windows.Documents.FixedDocumentSequence fixedDocumentSequence, object userSuppliedState);
override this.WriteAsync : System.Windows.Documents.FixedDocumentSequence * obj -> unit
Public Overrides Sub WriteAsync (fixedDocumentSequence As FixedDocumentSequence, userSuppliedState As Object)
Parameters
- fixedDocumentSequence
- FixedDocumentSequence
The set of documents that are written.
- userSuppliedState
- Object
A user-specified object to identify and associate with the asynchronous operation.
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
WriteAsync(FixedDocumentSequence)
Writes asynchronously a specified FixedDocumentSequence to the target XpsDocument or PrintQueue.
public:
override void WriteAsync(System::Windows::Documents::FixedDocumentSequence ^ fixedDocumentSequence);
public override void WriteAsync (System.Windows.Documents.FixedDocumentSequence fixedDocumentSequence);
override this.WriteAsync : System.Windows.Documents.FixedDocumentSequence -> unit
Public Overrides Sub WriteAsync (fixedDocumentSequence As FixedDocumentSequence)
Parameters
- fixedDocumentSequence
- FixedDocumentSequence
The set of documents that is written.
Examples
The following example shows how to use this method to write to an XPS document.
private void SaveMultipleFixedContentDocumentsAsync(
XpsDocumentWriter xpsdw, FixedDocumentSequence fds)
{
_xpsdwActive = xpsdw;
xpsdw.WritingCompleted +=
new WritingCompletedEventHandler(AsyncSaveCompleted);
xpsdw.WritingProgressChanged +=
new WritingProgressChangedEventHandler(AsyncSavingProgress);
// Write the FixedDocumentSequence as a
// collection of documents asynchronously.
xpsdw.WriteAsync(fds);
}
Private Sub SaveMultipleFixedContentDocumentsAsync(ByVal xpsdw As XpsDocumentWriter, ByVal fds As FixedDocumentSequence)
_xpsdwActive = xpsdw
AddHandler xpsdw.WritingCompleted, AddressOf AsyncSaveCompleted
AddHandler xpsdw.WritingProgressChanged, AddressOf AsyncSavingProgress
' Write the FixedDocumentSequence as a
' collection of documents asynchronously.
xpsdw.WriteAsync(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.
This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by Write(FixedDocumentSequence).
Applies to
WriteAsync(FixedDocument, Object)
Writes asynchronously a specified FixedDocument to the target XpsDocument or PrintQueue.
public:
override void WriteAsync(System::Windows::Documents::FixedDocument ^ fixedDocument, System::Object ^ userSuppliedState);
public override void WriteAsync (System.Windows.Documents.FixedDocument fixedDocument, object userSuppliedState);
override this.WriteAsync : System.Windows.Documents.FixedDocument * obj -> unit
Public Overrides Sub WriteAsync (fixedDocument As FixedDocument, userSuppliedState As Object)
Parameters
- fixedDocument
- FixedDocument
The document that is written.
- userSuppliedState
- Object
A user-specified object to identify and associate with the asynchronous operation.
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
WriteAsync(DocumentPaginator, PrintTicket)
Writes asynchronously paginated content from a specified DocumentPaginator together with a PrintTicket to the target XpsDocument or PrintQueue.
public:
override void WriteAsync(System::Windows::Documents::DocumentPaginator ^ documentPaginator, System::Printing::PrintTicket ^ printTicket);
public override void WriteAsync (System.Windows.Documents.DocumentPaginator documentPaginator, System.Printing.PrintTicket printTicket);
override this.WriteAsync : System.Windows.Documents.DocumentPaginator * System.Printing.PrintTicket -> unit
Public Overrides Sub WriteAsync (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 the 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.
This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by Write(DocumentPaginator, PrintTicket).
Applies to
WriteAsync(DocumentPaginator, Object)
Writes asynchronously paginated content from a specified DocumentPaginator to the target XpsDocument or PrintQueue.
public:
override void WriteAsync(System::Windows::Documents::DocumentPaginator ^ documentPaginator, System::Object ^ userSuppliedState);
public override void WriteAsync (System.Windows.Documents.DocumentPaginator documentPaginator, object userSuppliedState);
override this.WriteAsync : System.Windows.Documents.DocumentPaginator * obj -> unit
Public Overrides Sub WriteAsync (documentPaginator As DocumentPaginator, userSuppliedState As Object)
Parameters
- documentPaginator
- DocumentPaginator
An object that contains a pointer to unpaginated source material; also contains methods for paginating the material.
- userSuppliedState
- Object
A user-specified object to identify and associate with the asynchronous operation.
Applies to
WriteAsync(String, XpsDocumentNotificationLevel)
Writes asynchronously a specified XPS document with notification option to the target XpsDocument or PrintQueue.
public:
void WriteAsync(System::String ^ documentPath, System::Windows::Xps::XpsDocumentNotificationLevel notificationLevel);
public void WriteAsync (string documentPath, System.Windows.Xps.XpsDocumentNotificationLevel notificationLevel);
override this.WriteAsync : string * System.Windows.Xps.XpsDocumentNotificationLevel -> unit
Public Sub WriteAsync (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 serialized XPS 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 is removed. The reserialization also removes 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 WriteAsync method does not call the WritingPrintTicketRequired event.
This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by Write(String, XpsDocumentNotificationLevel).
Applies to
WriteAsync(Visual)
Writes asynchronously a specified Visual to the target XpsDocument or PrintQueue.
public:
override void WriteAsync(System::Windows::Media::Visual ^ visual);
public override void WriteAsync (System.Windows.Media.Visual visual);
override this.WriteAsync : System.Windows.Media.Visual -> unit
Public Overrides Sub WriteAsync (visual As Visual)
Parameters
Examples
The following example shows how to use this method to write a Visual to an XPS document.
private void SaveVisualAsync(XpsDocumentWriter xpsdw, Visual v)
{
_xpsdwActive = xpsdw;
xpsdw.WritingCompleted +=
new WritingCompletedEventHandler(AsyncSaveCompleted);
xpsdw.WriteAsync(v); // Write visual to single page.
}
Private Sub SaveVisualAsync(ByVal xpsdw As XpsDocumentWriter, ByVal v As Visual)
_xpsdwActive = xpsdw
AddHandler xpsdw.WritingCompleted, AddressOf AsyncSaveCompleted
xpsdw.WriteAsync(v) ' Write visual to single page.
End Sub
Remarks
To batch write a Visual, use VisualsToXpsDocument.
This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by Write(Visual).
Applies to
WriteAsync(FixedPage)
Writes asynchronously a specified FixedPage to the target XpsDocument or PrintQueue.
public:
override void WriteAsync(System::Windows::Documents::FixedPage ^ fixedPage);
public override void WriteAsync (System.Windows.Documents.FixedPage fixedPage);
override this.WriteAsync : System.Windows.Documents.FixedPage -> unit
Public Overrides Sub WriteAsync (fixedPage As FixedPage)
Parameters
- fixedPage
- FixedPage
The page that is written.
Remarks
This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by Write(FixedPage).
Applies to
WriteAsync(FixedDocument)
Writes asynchronously a specified FixedDocument to the target XpsDocument or PrintQueue.
public:
override void WriteAsync(System::Windows::Documents::FixedDocument ^ fixedDocument);
public override void WriteAsync (System.Windows.Documents.FixedDocument fixedDocument);
override this.WriteAsync : System.Windows.Documents.FixedDocument -> unit
Public Overrides Sub WriteAsync (fixedDocument As FixedDocument)
Parameters
- fixedDocument
- FixedDocument
The document that is written.
Examples
The following example shows how to use this method to write to an XPS document.
private void SaveSingleFixedContentDocumentAsync(
XpsDocumentWriter xpsdw, FixedDocument fd)
{
_xpsdwActive = xpsdw;
xpsdw.WritingCompleted +=
new WritingCompletedEventHandler(AsyncSaveCompleted);
// Write the FixedDocument as a document.
xpsdw.WriteAsync(fd);
}
Private Sub SaveSingleFixedContentDocumentAsync(ByVal xpsdw As XpsDocumentWriter, ByVal fd As FixedDocument)
_xpsdwActive = xpsdw
AddHandler xpsdw.WritingCompleted, AddressOf AsyncSaveCompleted
' Write the FixedDocument as a document.
xpsdw.WriteAsync(fd)
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.
This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by Write(FixedDocument).
Applies to
WriteAsync(DocumentPaginator)
Writes asynchronously paginated content from a specified DocumentPaginator to the target XpsDocument or PrintQueue.
public:
override void WriteAsync(System::Windows::Documents::DocumentPaginator ^ documentPaginator);
public override void WriteAsync (System.Windows.Documents.DocumentPaginator documentPaginator);
override this.WriteAsync : System.Windows.Documents.DocumentPaginator -> unit
Public Overrides Sub WriteAsync (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 this method to write to an XPS document.
private void SaveSingleFlowContentDocumentAsync(
XpsDocumentWriter xpsdw, DocumentPaginator idp)
{
_xpsdwActive = xpsdw;
xpsdw.WritingCompleted +=
new WritingCompletedEventHandler(AsyncSaveCompleted);
// Write the IDP as a document.
xpsdw.WriteAsync(idp);
}
Private Sub SaveSingleFlowContentDocumentAsync(ByVal xpsdw As XpsDocumentWriter, ByVal idp As DocumentPaginator)
_xpsdwActive = xpsdw
AddHandler xpsdw.WritingCompleted, AddressOf AsyncSaveCompleted
' Write the IDP as a document.
xpsdw.WriteAsync(idp)
End Sub
Remarks
This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by Write(DocumentPaginator).
Applies to
WriteAsync(String)
Writes asynchronously a specified XPS document to the target XpsDocument or PrintQueue.
public:
void WriteAsync(System::String ^ documentPath);
public void WriteAsync (string documentPath);
override this.WriteAsync : string -> unit
Public Sub WriteAsync (documentPath As String)
Parameters
- documentPath
- String
The path of the source 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 the FixedDocument elements in the source to the set of FixedDocument elements in the target XpsDocument or PrintQueue.
This WriteAsync method reserializes the specified XPS document, which removes all content from the Package that's not 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 WriteAsync method does not call the WritingPrintTicketRequired event.
This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by Write(String).
Applies to
WriteAsync(FixedDocument, PrintTicket)
Writes asynchronously a specified FixedDocument together with a PrintTicket to the target XpsDocument or PrintQueue.
public:
override void WriteAsync(System::Windows::Documents::FixedDocument ^ fixedDocument, System::Printing::PrintTicket ^ printTicket);
public override void WriteAsync (System.Windows.Documents.FixedDocument fixedDocument, System.Printing.PrintTicket printTicket);
override this.WriteAsync : System.Windows.Documents.FixedDocument * System.Printing.PrintTicket -> unit
Public Overrides Sub WriteAsync (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.
This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by Write(FixedDocument, PrintTicket).