This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/maui/save-a-document/to-arraybuffer.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. Save PDF document to an array buffer in MAUI | Nutrient

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.

For more control over exporting documents, use IExportConfiguration. If you pass null instead, the default configuration will be used:

var exportOptions = _document.CreateExportConfiguration();
{
ExcludeAnnotations = true,
ExportForPrinting = true,
ExportIncrementally = false,
Flatten = true,
};
var exportedDocumentContent = await _document.ExportDocumentAsync(exportConfiguration);