UNPKG

@compdfkit_pdf_sdk/react_native

Version:

ComPDFKit for React Native is a comprehensive SDK that allows you to quickly add PDF functionality to Android, iOS, and React Native applications.

82 lines 3.15 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CPDFSquareAnnotation = void 0; /** * Copyright © 2014-2026 PDF Technologies, Inc. All Rights Reserved. * * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. * This notice may not be removed from this file. */ const CPDFOptions_1 = require("../configuration/CPDFOptions"); const CPDFEnumUtils_1 = require("../util/CPDFEnumUtils"); const CPDFAnnotation_1 = require("./CPDFAnnotation"); /** * @class CPDFSquareAnnotation * @group Annotations * @property { string } [borderColor] The color of the border. * @property { number } [borderAlpha] The alpha of the border. * @property { string } [fillColor] The color of the fill. * @property { number } [fillAlpha] The alpha of the fill. * @property { number } [borderWidth] The width of the border. * @property { CPDFBorderEffectType } [bordEffectType] The border effect type. * @property { number } [dashGap] The dash gap for dashed border effect. */ class CPDFSquareAnnotation extends CPDFAnnotation_1.CPDFAnnotation { borderColor; borderAlpha; fillColor; fillAlpha; borderWidth; bordEffectType; dashGap; constructor(params) { super(params); this.type = 'square'; this.borderColor = params.borderColor ?? '#000000'; this.borderAlpha = params.borderAlpha ?? 255; this.fillColor = params.fillColor ?? '#FFFFFF'; this.fillAlpha = params.fillAlpha ?? 255; this.borderWidth = params.borderWidth ?? 1; this.dashGap = params.dashGap ?? 0; this.bordEffectType = (0, CPDFEnumUtils_1.safeParseEnumValue)(params.bordEffectType, Object.values(CPDFOptions_1.CPDFBorderEffectType), CPDFOptions_1.CPDFBorderEffectType.SOLID); } /** * Update square annotation properties with type safety * @param updates Partial object containing properties to update * @returns this instance for chaining * * @example * squareAnnotation.update({ * title: 'Updated Title', * content: 'Updated content', * borderColor: '#FF0000', * borderAlpha: 200, * fillColor: '#00FF00', * fillAlpha: 150, * borderWidth: 2, * bordEffectType: CPDFBorderEffectType.DASHED, * dashGap: 4 * }); * await document.updateAnnotation(squareAnnotation); */ update(updates) { Object.assign(this, updates); return this; } toJSON() { return { ...super.toJSON(), borderColor: this.borderColor, borderAlpha: this.borderAlpha, fillColor: this.fillColor, fillAlpha: this.fillAlpha, borderWidth: this.borderWidth, bordEffectType: this.bordEffectType, dashGap: this.dashGap, }; } } exports.CPDFSquareAnnotation = CPDFSquareAnnotation; //# sourceMappingURL=CPDFSquareAnnotation.js.map