Save a document to a remote server in Flutter
Since version 3.10, Nutrient Flutter SDK allows you to export PDFs in raw binary data format. This can be done using the exportPdf
method from the PdfDocument
class. With this method, you can save data to a file or upload it to a remote server.
Here’s an example of how to export a PDF to Base64 data:
pdfDocument.exportPdf().then((Uint8List data) { /// Convert the data to a Base64 string. base64Data = base64Encode(data); /// Upload the data to a remote server. http.post('https://example.com/upload', body: base64Data); });