This sample code searches a PDF document for all instances of a search pattern and redacts these instances.
PDF redaction
Full code sample which shows how to use Apryse's PDFNet.Redactor
to remove potentially sensitive content within PDF documents.
Apryse 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. Apryse 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 Apryse 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. This example uses PDFNet.TextSearch
to identify the content for redaction programmatically, but it can also be identified in other ways such as using PDFNet.TextExtractor
, or interactively (e.g. using WebViewer). Up until the next step is performed, the user can see, move and redefine these annotations.
2. Content removal
Using PDFNet.Redactor.redact()
the user instructs Apryse SDK to apply the redact regions, after which the content in the area specified by the redact annotations is removed. The redaction function includes a number of options to control the style of the redaction overlay (including color, text, font, border, transparency, etc.)
Did you find this helpful?
Trial setup questions?
Ask experts on DiscordNeed other help?
Contact SupportPricing or product questions?
Contact Sales