SearchAndAddRedactionRegions Method (GdPicturePDF)
Searches for all occurrences of a given regular expression pattern within the currently loaded PDF document and adds redaction region for every occurrence found.
public GdPictureStatus SearchAndAddRedactionRegions(
string ,
bool ,
byte ,
byte ,
byte ,
byte ,
ref int
)
public function SearchAndAddRedactionRegions(
: String;
: Boolean;
: Byte;
: Byte;
: Byte;
: Byte;
var : Integer
): GdPictureStatus;
public function SearchAndAddRedactionRegions(
: String,
: boolean,
: byte,
: byte,
: byte,
: byte,
: int
) : GdPictureStatus;
public: GdPictureStatus SearchAndAddRedactionRegions(
string* ,
bool ,
byte ,
byte ,
byte ,
byte ,
ref int
)
public:
GdPictureStatus SearchAndAddRedactionRegions(
String^ ,
bool ,
byte ,
byte ,
byte ,
byte ,
int%
)
'Declaration
Public Function SearchAndAddRedactionRegions( _
ByVal As String, _
ByVal As Boolean, _
ByVal As Byte, _
ByVal As Byte, _
ByVal As Byte, _
ByVal As Byte, _
ByRef As Integer _
) As GdPictureStatus
Parameters
- Pattern
- The regular expression pattern to search for.
- CaseSensitive
- Set this parameter to true if you want to apply case-sensitive search, otherwise set it to false.
- Red
- The amount of red color to be used for the resulting region color. Use the value between 0 and 255.
- Green
- The amount of green color to be used for the resulting region color. Use the value between 0 and 255.
- Blue
- The amount of blue color to be used for the resulting region color. Use the value between 0 and 255.
- Alpha
- The transparency value of the resulting region color. Use the value between 0 (full transparency) and 255 (full opacity).
- Occurrences
- Output parameter. If the method has been successfully followed, then the parameter will return number of occurrences found.
Return Value
A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK.
We strongly recommend always checking this status first.
How to redact all occurrences of text string in PDF document.
Using gdpicturePDF As New GdPicturePDF
gdpicturePDF.LoadFromFile("input.pdf")
Dim occurrences As Integer = 0
gdpicturePDF.SearchAndAddRedactionRegions("Sensitive text string", True, 0, 0, 0, 255, occurrences)
If occurrences > 0 Then
gdpicturePDF.ApplyRedaction()
End If
gdpicturePDF.SaveToFile("output.pdf")
End Using
using (GdPicturePDF gdpicturePDF = new GdPicturePDF())
{
gdpicturePDF.LoadFromFile("input.pdf");
int occurrences = 0;
gdpicturePDF.SearchAndAddRedactionRegions("Sensitive text string", true, 0, 0, 0, 255, ref occurrences);
if (occurrences > 0)
{
gdpicturePDF.ApplyRedaction();
}
gdpicturePDF.SaveToFile("output.pdf");
}