Save a document to a remote server in Flutter
Nutrient Flutter SDK can export PDFs as raw binary data. Call exportPdf() on the viewer’s controller.document, or on a document you opened headlessly with Nutrient.openDocument(). You can then save the data to a file or upload it to a remote server. Refer to the export PDF(opens in a new tab) API reference for details.
The following example exports a PDF to Base64 data and uploads it to a remote server:
final Uint8List data = await controller.document.exportPdf();
/// Convert the data to a Base64 string.final base64Data = base64Encode(data);
/// Upload the data to a remote server.await http.post(Uri.parse('https://example.com/upload'), body: base64Data);You can also pass DocumentSaveOptions to exportPdf() to flatten annotations, set passwords, or restrict permissions on the exported copy. Refer to the document save options guide and the DocumentSaveOptions(opens in a new tab) API reference for details.