How can I help you?
PdfRedactionRegion
16 Mar 20263 minutes to read
Represents the redaction process in a PDF document
// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
// Add redactions to the collection
let redactions: PdfRedactionRegion[] = [];
// Initialize a new instance of the `PdfRedactor` class
let redactor: PdfRedactor = new PdfRedactor(document);
// Initialize a new instance of the `PdfRedactionRegion` class.
let redaction: PdfRedactionRegion = new PdfRedactionRegion(0, {x: 40, y: 41.809, width: 80, height: 90});
// Sets the fill color used to fill the redacted area.
redaction.fillColor = {r: 255, g: 0, b: 0};
redactions.push(redaction);
// Add redactions with specified options.
redactor.add(redactions);
// Apply redactions on the PDF document
redactor.redactSync();
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();Properties
Get appearance PdfAppearance
Get the appearance of the pdf redaction
Get bounds Rectangle
Gets the bounds of the redaction area.
Set bounds void
Sets the rectangular bounds that define areas to be redacted
| Parameter | Type | Description |
|---|---|---|
| value | Rectangle |
The rectangular bounds that define the areas to be redacted. |
Get fillColor PdfColor
Gets the fill color used to fill the redacted area.
Set fillColor void
Sets the fill color used to fill the redacted area.
| Parameter | Type | Description |
|---|---|---|
| value | PdfColor |
An array of numbers representing the RGB color used to fill the redacted area. |
Get isTextOnly boolean
Gets a value indicating whether only the text should be redacted.
Set isTextOnly void
Sets a value indicating whether only the text within the bounds should be redacted.
The default value is false.
| Parameter | Type | Description |
|---|---|---|
| value | boolean |
A boolean flag indicating text only redaction. |
Get pageIndex number
Gets the page index of the PDF document where redaction is to be applied.
Set pageIndex void
Sets the page index of the PDF document where redaction is to be applied.
| Parameter | Type | Description |
|---|---|---|
| value | number |
The page index of the PDF document where redaction is to be applied. |