Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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

C#
public Task SaveDocumentAsync(
    Stream stream
)

#Parameters

Name Type Description
stream Stream

A stream that contains a PDF file.

#Returns

Type Description
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:

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