@lp-labs/pdf-redaction-planner
v0.1.0
Published
PDF redaction overlap planning without editing document bytes.
Readme
@lp-labs/pdf-redaction-planner
Produces reviewable geometry and supplied-text overlap plans for proposed redactions. This package does not redact or erase any PDF content.
Install and quick start
npm install @lp-labs/pdf-redaction-plannerimport { planPdfRedactions } from '@lp-labs/pdf-redaction-planner';
const plan = planPdfRedactions(
[
{
id: 'mark-1',
page: 0,
box: { x: 30, y: 40, width: 80, height: 20 },
reason: 'sensitive',
},
],
[
{
id: 'text-1',
page: 0,
text: 'account number',
box: { x: 34, y: 42, width: 70, height: 12 },
},
],
[{ width: 612, height: 792 }],
);
console.log(plan.status, plan.items[0].matchedText);API, types, and customization
RedactionMarkandRedactionTextItemcontain zero-based pages and page-spaceRedactionBoxgeometry.planPdfRedactions(marks, textItems, pageSizes, options?)checks bounds, intersects supplied text boxes, and reports whole-box coverage and partial intersections.- The result type
RedactionPlanalways hasstatus: 'planning-only',contentRemoved: false, andrequiresPdfAdapter: true. Per-mark warnings identify partial text coverage and marks without indexed text.PdfRedactionPlannerErrorusesinvalidandlimit. - Defaults cap inputs at 5,000 marks and 100,000 text items; override
maxMarksandmaxTextItemsto fit a reviewed workload. Overlap work scans supplied text items per mark.
Interoperability and scope
This is not redaction. A visual cover does not remove selectable text, images, metadata, or underlying objects. The plan is only as complete as supplied geometry and text. Apply changes with a PDF-aware redaction adapter, then independently inspect and verify the resulting file before sharing.
ESM, CommonJS, and TypeScript declarations are included. There are no runtime or peer dependencies; TypeScript and Prettier are development-only.
Support
If this library is useful to you, consider supporting its maintenance with a donation via PayPal.
Author
Created by Libin Prasanth. Connect on LinkedIn for updates and discussion.
