Save PDFs to a Remote Server in UWP

Saving a local document to a server is a straightforward process with PSPDFKit for Windows. This is achievable by programmatically exporting the document and then sending it to its remote destination.

The example below uses Microsoft’s HttpClient for demonstration purposes, though the general idea should be easy to adapt to whatever solution you choose to use:

var storageFile = PDFView.Document?.DocumentSource.GetFile()

using (var fileStream = await storageFile.OpenReadAsync())
{
    using (var client = new HttpClient())
    {
        var contentStream = new HttpStreamContent(fileStream);
        var response = await client.PostAsync(address, contentStream);
    }
}

For a better understanding of the use of StorageFile and DocumentSource in our SDK, you can read our Save a Document to a StorageFile guide.