Save a PDF Document to an Array Buffer in MAUI

Exporting a PDF to a byte[] can be done with a single API call to <IDocument>.ExportDocumentAsync():

try
{
    var exportConfiguration = _document.CreateExportConfiguration();
    // Update the configuration here.

    var exportedDocumentAsArrayBuffer = await _document.ExportDocumentAsync(exportConfiguration);
}
catch (Exception ex)
{
    // Handle the exception.
}

The resolved byte[] can be then handled as desired. For example, you can send it to your server or save it to local storage.