Save a Document to a Remote Server in Flutter

Since version 3.10, PSPDFKit for Flutter 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.'', body: base64Data);