This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/web/save-a-document/to-remote-server.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. Save & download PDF from server with JavaScript viewer | Nutrient

Nutrient Web SDK makes it possible to upload a document to a remote server. This can be done programmatically by exporting the document and sending it to the destination server.

The following example shows how to use the Fetch Web API to send the ArrayBuffer resolved to by instance.exportPDF() to a remote server (try it in the Playground(opens in a new tab)):

try {
const arrayBuffer = await instance.exportPDF();
const blob = new Blob([arrayBuffer], { type: "application/pdf" });
const formData = new FormData();
formData.append("file", blob);
const response = await fetch("/upload", {
method: "POST",
body: formData
});
if (!response.ok) {
throw new Error(`Upload failed: ${response.statusText}`);
}
console.log("PDF uploaded successfully");
} catch (error) {
console.error("Failed to save PDF to server:", error.message);
}

In the example above, the backend server expects to receive a POST request with a content type of multipart/form-data through an /upload endpoint it exposes. The payload of the request will depend upon your specific backend implementation.

When you export a document, you can choose how Nutrient Web SDK writes the output. For more information, refer to the flattening annotations guide and the incremental saving guide.

Use autosave to configure when Nutrient Web SDK saves changes. For more information, refer to the autosave guide.

Call instance.save() before exporting if autosave is disabled, or after an undo, redo, or paste. Otherwise, the exported file doesn’t include unsaved annotations.