IronPDF How-Tos Redact Text & Regions How to Redact Text and Regions Curtis Chau Updated:July 28, 2025 Redacting text involves permanently removing or obscuring sensitive or confidential information from a document. This is usually done by covering the text with a black box or using a tool to delete the text entirely. Redaction ensures that the information cannot be accessed or viewed, providing privacy and security for sensitive content. Your business is spending too much on yearly subscriptions for PDF security and compliance. Consider IronSecureDoc, which provides solutions for managing SaaS services like digital signing, redaction, encryption, and protection, all for a one-time payment. Explore IronSecureDoc documentation and features Similarly, redacting a region obscures the specified areas on the document. This process requires a bit more work since the coordinates, width, and height of the region must be provided. Get started with IronPDF Start using IronPDF in your project today with a free trial. First Step: Start for Free How to Redact Text and Regions Download the C# library to redact text and regions Prepare the PDF document for redaction Use the RedactTextOnAllPages method to redact text on the entire document Use the RedactRegionsOnAllPages method to redact regions on every page of the document Save or export the PDF document as a new document Redact Text Example Text redaction can be easily accomplished with the help of IronPDF. Use the RedactTextOnAllPages method to remove a specified phrase from the entire document. Let's use a PDF example document. :path=/static-assets/pdf/content-code-examples/how-to/redact-text-redact-text.cs using IronPdf; PdfDocument pdf = PdfDocument.FromFile("novel.pdf"); // Redact 'Alaric' phrase from all pages pdf.RedactTextOnAllPages("Alaric"); pdf.SaveAs("redacted.pdf"); Imports IronPdf Private pdf As PdfDocument = PdfDocument.FromFile("novel.pdf") ' Redact 'Alaric' phrase from all pages pdf.RedactTextOnAllPages("Alaric") pdf.SaveAs("redacted.pdf") $vbLabelText $csharpLabel Output PDF Result PDF from redacting the 'Alaric' phrase from all pages. Use RedactTextOnPage and RedactTextOnPages methods to redact text from a single or multiple pages, respectively. Here are the parameters of the redact text methods and their purposes: ReplaceText: This is the text string that you want to redact. CaseSensitive: A boolean value indicating whether the search should be case-sensitive. If true, it will match capital and lower-case letters exactly. The default is false. OnlyMatchWholeWords: A boolean value specifying whether to match only whole words. The default is true. DrawRectangles: A boolean value determining whether to draw black rectangles around the redacted areas. The default is true. ReplacementText: This is the text that will be written in place of the redacted items. The default replacement text is "*". Redact Regions Example Redacting specific regions on the document works really well. Invoke the RedactRegionsOnAllPages method with the RectangleF object to redact the region of the targeted document. Let's use the same PDF example document from the example above. :path=/static-assets/pdf/content-code-examples/how-to/redact-text-redact-region.cs using IronPdf; using IronSoftware.Drawing; PdfDocument pdf = PdfDocument.FromFile("novel.pdf"); RectangleF rectangle = new RectangleF(5, 700, 50, 50); // Redact region on coordinates(5,700) with width and height 50 pixels pdf.RedactRegionsOnAllPages(rectangle); pdf.SaveAs("redactedRegion.pdf"); Imports IronPdf Imports IronSoftware.Drawing Private pdf As PdfDocument = PdfDocument.FromFile("novel.pdf") Private rectangle As New RectangleF(5, 700, 50, 50) ' Redact region on coordinates(5,700) with width and height 50 pixels pdf.RedactRegionsOnAllPages(rectangle) pdf.SaveAs("redactedRegion.pdf") $vbLabelText $csharpLabel Output PDF The result PDF is from redacting a region on the coordinates (5,700) with a width and height of 50 pixels. Use RedactRegionOnPage and RedactRegionOnPages methods to redact regions from a single or multiple pages, respectively. Ready to see what else you can do? Check out our tutorial page here: Edit PDFs Frequently Asked Questions What is the process of redacting text in PDFs? Redacting text in PDFs involves using methods like RedactTextOnAllPages in IronPDF, which allows you to remove or obscure specific text throughout a document to ensure privacy and security. How do I redact a specific region in a PDF document? You can redact a specific region in a PDF by using IronPDF's RedactRegionsOnAllPages method. This requires specifying the coordinates, width, and height of the area you wish to redact using a RectangleF object. Can I redact text from only one page of a PDF? Yes, you can use the RedactTextOnPage method in IronPDF to redact text from a single page within a PDF document. What are the parameters available for text redaction in PDFs? IronPDF offers parameters such as ReplaceText, CaseSensitive, OnlyMatchWholeWords, DrawRectangles, and ReplacementText to customize the redaction process according to your needs. How can I ensure that only whole words are redacted in a PDF? IronPDF provides the OnlyMatchWholeWords parameter that, when set to true, ensures that only whole words are matched and redacted in the PDF document. Is it possible to use a custom replacement text for redacted content? Yes, IronPDF allows you to specify custom replacement text using the ReplacementText parameter, with the default being an asterisk (*). How does IronPDF handle case sensitivity during text redaction? IronPDF uses the CaseSensitive parameter, which can be set to true if you want the text redaction to be case-sensitive, matching the case of letters exactly. What methods are available for redacting multiple pages in a PDF? For redacting multiple pages, IronPDF provides the RedactTextOnPages and RedactRegionOnPages methods, allowing you to specify ranges or specific pages for redaction. Curtis Chau Chat with engineering team now Technical Writer Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals....Read More Ready to Get Started? Free NuGet Download Total downloads: 15,030,178 View Licenses