Back to Devexpress

PdfViewer.SaveDocumentAsync(Stream) Method

maui-devexpress-dot-maui-dot-pdf-dot-pdfviewer-dot-savedocumentasync-x28-system-dot-io-dot-stream-x29.md

latest2.0 KB
Original Source

PdfViewer.SaveDocumentAsync(Stream) Method

Saves the current PDF document to a stream.

Namespace : DevExpress.Maui.Pdf

Assembly : DevExpress.Maui.Pdf.dll

NuGet Package : DevExpress.Maui.Pdf

Declaration

csharp
public Task SaveDocumentAsync(
    Stream stream
)

Parameters

NameTypeDescription
streamStream

A stream that contains a PDF file.

|

Returns

TypeDescription
Task

A task that allows you to wait for the document to be saved.

|

Remarks

To invoke the system Save File dialog to allow users to save the current document to the file system, call the PdfViewer.ShowSaveFileDialogAsync method or the PdfViewerCommands.ShowSaveFileDialog command. Users can also save documents in the Share UI. To invoke it, call the PdfViewer.ShareDocumentAsync method or the PdfViewerCommands.ShareDocument command. Call the PdfViewer.SaveDocumentAsync method to save the current document to a stream.

The following example saves the current document to a MemoryStream:

csharp
private async void DXButton_Clicked(object sender, EventArgs e) {
    using Stream stream = new MemoryStream();
    await pdfViewer.SaveDocumentAsync(stream);
    // Do something with the stream.
}

See Also

PdfViewer Class

PdfViewer Members

DevExpress.Maui.Pdf Namespace