PDF redaction API for React
Redact PDF text inside your own React workflow. Remove selected or matched text, then save the edited document directly in the browser. No upload service and no vendor redaction UI.
Redaction is in early access
Leave your email and we’ll reach out with access
By sending us your email, you agree to our Privacy policy
Works with vanilla JavaScript and most popular frameworks
Redact PDF text in React: what the SDK removes
The PDF redaction React component toolkit covers page-text removal from selection to export.
Remove selected text
Let a user enter an editable PDF paragraph, select sensitive text, and remove it with controls built into your own React interface.
- useDeleteSelection()
- useSelection()
Redact known text from code
Read extracted paragraphs, match values from your application, and rewrite affected paragraphs without the sensitive text.
- useProgrammaticEditor()
- getPlainTextParagraphs()
- getParagraphEditor()
Remove whole paragraphs
Delete paragraph blocks by ID when an entire extracted text block must be removed from the document.
- useBlockDelete()
Rewrite modified page content
Saving a modified page creates a replacement content stream instead of leaving the edited text as an active page instruction.
Clear stale content streams
The save path zeros the old content-stream bytes of modified pages so removed page text is not left recoverable in the original stream. Metadata, annotations, form values, attachments, images, and unused resource objects are not sanitized.
Undo and review
Connect removal actions to undo and redo so users can review their changes before producing the final PDF.
- useUndoRedo()
Keep documents in the browser
Load, edit, and save the PDF on the user’s device without sending document contents to a hosted redaction service.
Export a standard PDF
Return the result as a PDF Uint8Array for download, upload, storage, or an application-specific validation step.
- useDocumentSaving()
How to redact a PDF in React
Load the document with text editing enabled, remove the sensitive text, and serialize the result in the browser.
Load the PDF in editable mode
Load the document into a headless React viewport with text editing enabled. Wrap the application in PdfProviders with the editor policy, pass a Uint8Array to loadPdf, and render Viewport.
import { useEffect } from 'react';
import {
CONTENT_POLICY_PRESET,
PdfProviders,
Viewport,
useLoadPdf,
} from '@sdk-pdf/react';
import '@sdk-pdf/react/style.css';
function RedactionView({ file }: { file: Uint8Array }) {
const [state, loadPdf] = useLoadPdf();
useEffect(() => {
void loadPdf(file);
}, [file, loadPdf]);
if (state.status !== 'ready') return null;
return (
<div style={{ height: '100vh' }}>
<Viewport />
</div>
);
}
export function App({ file }: { file: Uint8Array }) {
return (
<PdfProviders initialContentPolicy={CONTENT_POLICY_PRESET.PDF_EDITOR}>
<RedactionView file={file} />
</PdfProviders>
);
}Build the redaction workflow around your data
The SDK exposes PDF paragraphs and editing primitives; your application supplies the matching rules, review state, permissions, and audit workflow.
import {
useDeleteSelection,
useFocusSelection,
useSelection,
useUndoRedo,
} from '@sdk-pdf/react';
export function RemovalToolbar() {
const selection = useSelection();
const deleteSelection = useDeleteSelection();
const focusSelection = useFocusSelection();
const { canUndo, canRedo, undo, redo } = useUndoRedo();
const run = (action: () => void) => {
action();
focusSelection();
};
return (
<div role="toolbar">
<button
disabled={selection?.type !== 'text'}
onClick={() => run(deleteSelection)}
>
Remove selection
</button>
<button disabled={!canUndo} onClick={() => run(undo)}>
Undo
</button>
<button disabled={!canRedo} onClick={() => run(redo)}>
Redo
</button>
</div>
);
}Runs in the browser, ships with your bundle
No redaction service, no workers, no WASM binaries, no font files to host. PDF document processing runs in one package, one stylesheet, and one bundler alias. The PDF goes in and comes out as bytes, so it’s an easy React PDF library to add to an existing build.
'use client';
import dynamic from 'next/dynamic';
const RedactionView = dynamic(() => import('./redaction-view'), {
ssr: false,
});
export default function Page() {
return <RedactionView />;
}- Framework
- React 19, with react and react-dom as peer dependencies
- Module format
- ESM only; use a bundler (Vite, Next.js, or equivalent)
- Runtime
- Browser only. In Next.js, use a client component with ssr: false
- Bundle
- 277 KB gzipped; CJK character maps are code-split and lazy
- Assets to host
- None. Everything the engine needs is in the module graph
- Bundler
- Alias the unused canvas require once (see config snippets)
- Strict Mode
- Off for now. The simulated unmount kills the engine
- Encrypted files
- Pass { password } to loadPdf. RC4, AES-128, and AES-256
- Input
- Uint8Array, one PDF loaded at a time
- Output
- Uint8Array with the saved PDF, or a browser download
PDF redaction approaches compared
Rendering, document editing, and complete sanitization are different capabilities. Compare how each React PDF library handles PDF redaction based on which PDF objects your workflow must inspect and remove.
| Library | Removes page text | Area or image redaction | Metadata cleanup | Browser workflow | Saves a PDF |
|---|---|---|---|---|---|
| Selected or matched | Not yet | Not yet | Yes | Yes | |
| PDF.js | Bring your own | Bring your own | Bring your own | Yes | Application-owned |
| react-pdf | Bring your own | Bring your own | Bring your own | Yes | Bring your own |
| pdf-lib | Low-level/manual | Low-level/manual | Low-level/manual | Yes | Yes |
Where to go next
React PDF Editor
Edit PDF paragraphs, typography, images, and pages with the same browser engine.
Editor pageReact PDF Viewer
Embed a headless PDF viewer with selectable text, annotations, forms, navigation, and zoom.
Viewer pagePDF Annotation SDK
Display existing PDF markup, edit supported annotation geometry, and place image stamps.
Annotation pageQuestions engineers ask
Not yet. The current release can remove or replace extracted page text and save the modified PDF. It does not yet provide Redact annotations, rectangular redaction areas, image redaction, OCR, or whole-document sanitization.
Still have questions? Book 30 minutes
A short call with the engineering team and a straight answer instead of a pitch