Unplanned
Last Updated: 21 Jul 2021 07:24 by ADMIN
Martin
Created on: 21 Jul 2021 07:22
Category: PdfProcessing
Type: Feature Request
1
PdfProcessing: Support for annotations of type Redact

According to the PDF Specification: A redaction annotation (PDF 1.7) identifies content that is intended to be removed from the document.

There are two possible options to workaround this functionality:

  1. To iterate the document content and replace the matches which meet certain conditions with an empty string:
    foreach (RadFixedPage page in document.Pages)
    {
    	foreach (ContentElementBase elementBase in page.Content)
    	{
    		if (elementBase is TextFragment textFragment)
    		{
    			if (IsValidEmail(textFragment.Text))
    			{
    				textFragment.Text = string.Empty;
    			}
    		}
    	}
    }
    Note: the desired content could be split into several text fragments and if so a custom parser should be created.
  2. To iterate the document content and check if the TextFragment position is within a specific RectangleGeometry
    foreach (RadFixedPage page in document.Pages)
    {
    	foreach (ContentElementBase elementBase in page.Content)
    	{
    		if (elementBase is TextFragment textFragment)
    		{
    			if (IsIntersecting(rectangleGeometry, textFragment))
    			{
    				textFragment.Text = string.Empty;
    			}
    		}
    	}
    }
    Note: it should be taken into account that the text fragment could flow out of the rectangle.
0 comments