import { PdfAppearance, Rectangle, PdfColor } from '@syncfusion/ej2-pdf'; /** * Represents the redaction process in a PDF document * * ```typescript * // 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(); * ``` */ export declare class PdfRedactionRegion { /** * Internal page index on which the redaction should be applied. * * @private */ _pageIndex: number; /** * Internal appearance container for custom redaction visuals. * * @private */ _appearance: PdfAppearance; /** * Internal rectangle bounds of the redaction region. * * @private */ _bounds: Rectangle; /** * Internal flag to indicate text-only redaction. * * @private */ _isTextOnly: boolean; /** * Internal fill color to paint the redaction overlay. * * @private */ _fillColor: PdfColor; /** * Internal flag indicating whether appearance is created/used. * * @private */ _appearanceEnabled: boolean; constructor(pageIndex: number, bounds: Rectangle, isTextOnly?: boolean, fillColor?: PdfColor); /** * Sets the page index of the PDF document where redaction is to be applied. * * @param {number} value The page index of the PDF document where redaction is to be applied. * * ```typescript * // 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 page index of the PDF document where redaction is to be applied. * redaction.pageIndex = 1; * 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(); * ``` */ /** * Gets the page index of the PDF document where redaction is to be applied. * * @returns {number} page index * * ```typescript * // Load an existing PDF document * let document: PdfDocument = new PdfDocument(data, password); * // Add redactions to the collection * let redactions: PdfRedactionRegion[] = []; * let redactor: PdfRedactor = new PdfRedactor(document); * let redaction: PdfRedactionRegion = new PdfRedactionRegion(0, {x: 40, y: 41.809, width: 80, height: 90}); * // Gets the page index of the PDF document where redaction is to be applied. * let index: number = redaction.pageIndex; * redactions.push(redaction); * redactor.add(redactions); * // Apply redactions on the PDF document * redactor.redactSync(); * // Save the document * document.save('output.pdf'); * // Destroy the document * document.destroy(); * ``` */ pageIndex: number; /** * Sets the rectangular bounds that define areas to be redacted * * @param {number} value The rectangular bounds that define the areas to be redacted. * * ```typescript * // 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 rectangular bounds that define areas to be redacted * redaction.bounds = {x: 40, y: 41.809, width: 80, height: 90}; * 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(); * ``` */ /** * Gets the bounds of the redaction area. * * @returns {Rectangle} A Rectangle object representing the boundaries of the redaction. * * // 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}); * // Gets the bounds of the redaction area. * let bounds: Rectangle = redaction.bounds; * 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(); * ``` */ bounds: Rectangle; /** * Sets a value indicating whether only the text within the bounds should be redacted. * The default value is `false`. * * @param {boolean} value A boolean flag indicating text only redaction. * * ```typescript * // 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.isTextOnly = true; * 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(); * ``` */ /** * Gets a value indicating whether only the text should be redacted. * * @returns {boolean} value indicating if only text should be redacted. * * // 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}); * // Gets a value indicating whether only the text should be redacted. * let textOnly: boolean = redaction.isTextOnly; * 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(); * ``` */ isTextOnly: boolean; /** * Sets the fill color used to fill the redacted area. * * @param {PdfColor} value An array of numbers representing the RGB color used to fill the redacted area. * * ```typescript * // 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(); * ``` */ /** * Gets the fill color used to fill the redacted area. * * @returns {PdfColor} value indicating array of numbers representing the RGB color values [R, G, B]. * * // 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}); * // Gets a value indicating whether only the text should be redacted. * let fillColor: PdfColor = redaction.fillColor; * 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(); * ``` */ fillColor: PdfColor; /** * Get the appearance of the pdf redaction * * @returns {PdfAppearance} Returns the appearance of the redaction. * * // Load an existing PDF document * let document: PdfDocument = new PdfDocument(data, password); * // Add redactions to the collection * let redactions: PdfRedactionRegion[] = []; * let region = { x: 40, y: 43.620000000000005, width: 80, height: 20}; * // Initialize a new instance of the `PdfRedactionRegion` class. * let redaction = new PdfRedactionRegion(0, {x: 0, y: 0, width: 80, height: 20}, true); * let font: PdfStandardFont = new PdfStandardFont(PdfFontFamily.helvetica, 10); * redaction.appearance.normal.graphics.drawString('Redacted Text', font, {x: 0, y: 0, width: 80, height: 20}, new PdfBrush({r: 255, g: 0, b: 0})); * redactions.push(redaction); * redaction = new PdfRedactionRegion(0, {x: 0, y: 0, width: 80, height: 20}, true); * region = { x: 40, y: 43.620000000000005, width: 80, height: 20}; * redactions.push(redaction); * // Initialize a new instance of the `PdfRedactor` class * let redactor: PdfRedactor = new PdfRedactor(document); * // 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(); * ``` */ readonly appearance: PdfAppearance; }