This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/web/user-interface/main-toolbar/download-export-button.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. Disable and remove the download button in JavaScript PDF viewer | Nutrient

Use instance.setToolbarItems() to activate the built-in download button.

Keep Save review and Export PDF as separate actions in review workflows. Use instance.exportInstantJSON() to persist the editable review layer, and use instance.exportPDF() only when users need a final PDF output. For an implementation pattern, refer to the keyboard-accessible review workflow guide.

Call instance.save() before either export if autosave is disabled, or after an undo, redo, or paste. instance.exportPDF() omits unsaved annotations. In server-backed deployments, instance.exportInstantJSON() exports saved annotations only, so the review layer loses unsaved ones too.

Add the built-in export button

Add the built-in export button to the main toolbar with instance.setToolbarItems():

instance.setToolbarItems((items) =>
items.concat([{ type: "export-pdf" }])
);

You can also set the toolbar items in the NutrientViewer.Configuration object passed to NutrientViewer.load():

NutrientViewer.load({
toolbarItems: NutrientViewer.defaultToolbarItems.concat([
{ type: "export-pdf" }
])
});

Add a custom download button

Use a custom button when you need more control over the download action. The custom button can call instance.exportPDF() and use your toolbar configuration. For more information, refer to the customizing the toolbar guide.

const downloadButton = {
type: "custom",
id: "download-pdf",
icon: "/download.svg",
title: "Download",
onPress: () => {
pspdfkitInstance.exportPDF().then((buffer) => {
const blob = new Blob([buffer], { type: "application/pdf" });
const fileName = "document.pdf";
if (window.navigator.msSaveOrOpenBlob) {
window.navigator.msSaveOrOpenBlob(blob, fileName);
} else {
const objectUrl = window.URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = objectUrl;
a.style = "display: none";
a.download = fileName;
document.body.appendChild(a);
a.click();
window.URL.revokeObjectURL(objectUrl);
document.body.removeChild(a);
}
});
}
};
NutrientViewer.load({
toolbarItems: NutrientViewer.defaultToolbarItems.concat([downloadButton])
});

Hide the download button

Remove the export-pdf toolbar item by filtering instance.toolbarItems. Then set the filtered array:

const items = instance.toolbarItems;
// Hide the toolbar item with the type "export-pdf" by removing it from the array of items.
instance.setToolbarItems(
items.filter((item) => item.type !== "export-pdf")
);