Some test text!


Redact a PDF document in PHP

To redact content from a PDF document.

$vec = new VectorRedaction();
$vec->push(new Redaction(1, new Rect(0.0, 0.0, 600.0, 600.0), false, "Top Secret"));
$vec->push(new Redaction(2, new Rect(0.0, 0.0, 100.0, 100.0), false, "foo"));
$vec->push(new Redaction(2, new Rect(100.0, 100.0, 200.0, 200.0), false, "bar"));
$vec->push(new Redaction(2, new Rect(300.0, 300.0, 400.0, 400.0), false, ""));
$vec->push(new Redaction(2, new Rect(500.0, 500.0, 600.0, 600.0), false, ""));
$vec->push(new Redaction(3, new Rect(0.0, 0.0, 700.0, 20.0), false, ""));

$doc = new PDFDoc($filename);
Redactor::Redact($doc, $vec);

PDF redaction
Full code sample which shows how to use pdftron.PDF.Redactor to remove potentially sensitive content within PDF documents.

About redactor

PDFTron Redactor makes sure that if a portion of an image, text, or vector graphics is contained in a redaction region, that portion of the image or path data is destroyed and is not hidden with clipping or image masks. PDFTron SDK API can also be used to review and remove metadata and other content that can exist in a PDF document, including XML Forms Architecture (XFA) content and Extensible Metadata Platform (XMP) content.

The redaction process in PDFTron SDK consists of two steps:

1. Content identification
A user applies redact annotations that specify the pieces or regions of content that should be removed. The content for redaction can be identified either interactively (e.g. using ‘pdftron.PDF.PDFViewCtrl’ as shown in PDFView sample) or programmatically (e.g. using ‘pdftron.PDF.TextSearch’ or ‘pdftron.PDF.TextExtractor’). Up until the next step is performed, the user can see, move and redefine these annotations.

2. Content removal
Using ‘pdftron.PDF.Redactor.Redact()’ the user instructs PDFTron SDK to apply the redact regions, after which the content in the area specified by the redact annotations is removed. The redaction function includes number of options to control the style of the redaction overlay (including color, text, font, border, transparency, etc.).

Get the answers you need: Support

Upcoming Webinar: PDFTron SDK Tech Review | Nov 29, 2022 at 2 pm ET


The Platform


© 2022 PDFTron Systems Inc. All rights reserved.


Terms of Use