Use this guide when your output must be legally sanitized and safe to share. The canonical sequence below ensures redactions are applied permanently before the final PDF is exported, so no underlying content remains in the file.

Do not allow final export before applyRedactions() succeeds when compliance or sanitization is required.

Canonical sequence

  1. Mark redactions (via UI tools or programmatically).
  2. Apply permanently with instance.applyRedactions().
  3. Export final PDF only after step 2 succeeds.

Required toolbar tools (UI workflow)

To enable users to mark redactions in the UI, include one or both of the following toolbar items:

  • redact-text-highlighter for text redactions
  • redact-rectangle for area redactions
NutrientViewer.load({
container: "#nutrient-viewer",
document: "/path/to/document.pdf",
toolbarItems: [
...NutrientViewer.defaultToolbarItems,
{ type: "redact-text-highlighter" },
{ type: "redact-rectangle" }
]
});

Gate final export until permanent apply succeeds

To enforce the production-safe sequence, apply redactions directly in the final export action:

async function exportFinalPdf(instance) {
await instance.applyRedactions();
return instance.exportPDF();
}

Export recommendation matrix

The following table summarizes the recommended export methods based on your final output goals:

GoalRecommended exportNotes
Final sanitized PDF after permanent redaction applyexportPDF()Default final export after applyRedactions() succeeds.
Final sanitized PDF + flatten remaining annotations for downstream compatibilityexportPDF({ flatten: true })Use when you also need non-redaction annotations/forms flattened in the exported PDF.