---
title: "Production-safe redaction workflow | Nutrient Web SDK"
canonical_url: "https://www.nutrient.io/guides/web/redaction/production-safe-workflow/"
md_url: "https://www.nutrient.io/guides/web/redaction/production-safe-workflow.md"
last_updated: "2026-06-08T09:14:14.473Z"
description: "Use the production-safe redaction sequence for legal/sanitized output: mark content, apply redactions permanently, and only then export the final PDF."
---

# Production-safe redaction workflow

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()`](https://www.nutrient.io/api/web/classes/NutrientViewer.Instance.html#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

```js

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:

```js

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:

| Goal                                                                             | Recommended export             | Notes                                                                                 |
| -------------------------------------------------------------------------------- | ------------------------------ | ------------------------------------------------------------------------------------- |
| Final sanitized PDF after permanent redaction apply                              | `exportPDF()`                  | Default final export after `applyRedactions()` succeeds.                              |
| Final sanitized PDF + flatten remaining annotations for downstream compatibility | `exportPDF({ flatten: true })` | Use when you also need non-redaction annotations/forms flattened in the exported PDF. |

## Related guides

- [Programmatically redact PDFs using JavaScript](https://www.nutrient.io/guides/web/redaction/programmatically.md)

- [Redact PDFs using JavaScript tools](https://www.nutrient.io/guides/web/redaction/built-in-ui.md)

- [Headless redaction](https://www.nutrient.io/guides/web/redaction/headless.md)

- [Flatten annotations](https://www.nutrient.io/guides/web/annotations/flatten.md)
---

## Related pages

- [JavaScript PDF redaction library](/guides/web/redaction.md)
- [PDF redaction techniques for your documents](/guides/web/redaction/introduction-to-redaction.md)
- [Search and redact PDFs using JavaScript](/guides/web/redaction/search-and-redact.md)
- [Redact PDFs using JavaScript tools](/guides/web/redaction/built-in-ui.md)
- [Programmatically redact PDFs using JavaScript](/guides/web/redaction/programmatically.md)
- [Redact PDFs using regex](/guides/web/redaction/regex-patterns.md)
- [Headless redaction](/guides/web/redaction/headless.md)
- [Automate document redaction with predefined patterns](/guides/web/redaction/preset-patterns.md)

