Class PdfRedaction
Represents a redactor for a loaded page.
Inheritance
System.Object
PdfRedaction
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Syncfusion.Pdf.Redaction
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public class PdfRedaction
Examples
//Load the document.
PdfLoadedDocument lDoc = new PdfLoadedDocument("input.pdf");
//Get the first page from the document.
PdfLoadedPage page = lDoc.Pages[0] as PdfLoadedPage;
//Create a redaction object
PdfRedaction redaction = new PdfRedaction(new RectangleF(40, 40, 50, 20));
//Add redaction object into redaction collection of loaded page
page.Redactions.Add(redaction);
//Save and Close the document.
lDoc.Save("sample.pdf");
lDoc.Close(true);
'Load the document.
Dim lDoc As PdfLoadedDocument = New PdfLoadedDocument("input.pdf")
//Create a redaction object
Dim redaction As PdfRedaction = New PdfRedaction(New RectangleF(40, 40, 50, 20))
//Add redaction object into collection
page.Redactions.Add(redaction)
'Save the document.
lDoc.Save("sample.pdf")
lDoc.Close(True)
Constructors
PdfRedaction(RectangleF)
Initializes a new instance of the PdfRedaction class.
Declaration
public PdfRedaction(RectangleF bounds)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.RectangleF | bounds | The rectangle bounds to be redact. |
PdfRedaction(RectangleF, Color)
Initializes a new instance of the PdfRedaction class.
Declaration
public PdfRedaction(RectangleF bounds, Color fillColor)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.RectangleF | bounds | The rectangle bounds to be redact. |
System.Drawing.Color | fillColor | The fill color on the redaction bounds. |
Properties
Appearance
Gets or sets the appearance on the redaction bounds (Read only).
Declaration
public PdfTemplate Appearance { get; }
Property Value
Type | Description |
---|---|
PdfTemplate |
Examples
//Load the document.
PdfLoadedDocument lDoc = new PdfLoadedDocument("input.pdf");
//Get the first page from the document.
PdfLoadedPage page = lDoc.Pages[0] as PdfLoadedPage;
//Create a redaction object
PdfRedaction redaction = new PdfRedaction(new RectangleF(40, 40, 100, 20));
//Set appearance on the redaction bounds
redaction.Appearance.Graphics.DrawString("Redacted", new PdfStandardFont(PdfFontFamily.Helvetica, 10), PdfBrushes.Black, PointF.Empty);
//Add redaction object into redaction collection of loaded page
page.Redactions.Add(redaction);
//Save and Close the document.
lDoc.Save("sample.pdf");
lDoc.Close(true);
'Load the document.
Dim lDoc As PdfLoadedDocument = New PdfLoadedDocument("input.pdf")
//Create a redaction object
Dim redaction As PdfRedaction = New PdfRedaction(New RectangleF(40, 40, 100, 20))
//Set appearance on the redaction bounds
redaction.Appearance.Graphics.DrawString("Redacted", New PdfStandardFont(PdfFontFamily.Helvetica, 10), PdfBrushes.Black, PointF.Empty)
//Add redaction object into collection
page.Redactions.Add(redaction)
'Save the document.
lDoc.Save("sample.pdf")
lDoc.Close(True)
FillColor
Gets or sets the fill color on the redaction bounds (Read only).
Declaration
public Color FillColor { get; set; }
Property Value
Type | Description |
---|---|
System.Drawing.Color |
Examples
//Load the document.
PdfLoadedDocument lDoc = new PdfLoadedDocument("input.pdf");
//Get the first page from the document.
PdfLoadedPage page = lDoc.Pages[0] as PdfLoadedPage;
//Create a redaction object
PdfRedaction redaction = new PdfRedaction(new RectangleF(40, 40, 50, 20));
//Set fill color for the redaction bounds
redaction.FillColor = System.Drawing.Color.Green;
//Add redaction object into redaction collection of loaded page
page.Redactions.Add(redaction);
//Save and Close the document.
lDoc.Save("sample.pdf");
lDoc.Close(true);
'Load the document.
Dim lDoc As PdfLoadedDocument = New PdfLoadedDocument("input.pdf")
//Create a redaction object
Dim redaction As PdfRedaction = New PdfRedaction(New RectangleF(40, 40, 50, 20))
//Set fill color for the redaction bounds
redaction.FillColor = Color.Green
//Add redaction object into collection
page.Redactions.Add(redaction)
'Save the document.
lDoc.Save("sample.pdf")
lDoc.Close(True)