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.

89 lines 3.09 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CPDFStrikeOutAnnotation = exports.CPDFSquigglyAnnotation = exports.CPDFUnderlineAnnotation = exports.CPDFHighlightAnnotation = exports.CPDFMarkupAnnotation = 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 CPDFAnnotation_1 = require("./CPDFAnnotation"); /** * markup annotation class, highlight, underline, squiggly, strikeout * @class CPDFMarkupAnnotation * @group Annotations * @property { string } [markedText] The text that is marked by the annotation * @property { string } [color] The color of the annotation * @property { number } [alpha] The alpha of the annotation */ class CPDFMarkupAnnotation extends CPDFAnnotation_1.CPDFAnnotation { markedText; color; alpha; constructor(params) { super(params); this.markedText = params.markedText ?? ''; this.color = params.color ?? '#FFFF00'; const alpha = params.alpha ?? 200; this.alpha = Math.max(0, Math.min(255, alpha)); } /** * Update markup annotation properties with type safety * @param updates Partial object containing properties to update * @returns this instance for chaining * * @example * markupAnnotation.update({ * title: 'Updated Title', * content: 'Updated content', * markedText: 'New marked text', * color: '#FF0000', * alpha: 200 * }); * await document.updateAnnotation(markupAnnotation); */ update(updates) { Object.assign(this, updates); return this; } toJSON() { return { ...super.toJSON(), markedText: this.markedText, color: this.color, alpha: this.alpha, }; } } exports.CPDFMarkupAnnotation = CPDFMarkupAnnotation; class CPDFHighlightAnnotation extends CPDFMarkupAnnotation { constructor(params) { super(params); this.type = 'highlight'; } } exports.CPDFHighlightAnnotation = CPDFHighlightAnnotation; class CPDFUnderlineAnnotation extends CPDFMarkupAnnotation { constructor(params) { super(params); this.type = 'underline'; } } exports.CPDFUnderlineAnnotation = CPDFUnderlineAnnotation; class CPDFSquigglyAnnotation extends CPDFMarkupAnnotation { constructor(params) { super(params); this.type = 'squiggly'; } } exports.CPDFSquigglyAnnotation = CPDFSquigglyAnnotation; class CPDFStrikeOutAnnotation extends CPDFMarkupAnnotation { constructor(params) { super(params); this.type = 'strikeout'; } } exports.CPDFStrikeOutAnnotation = CPDFStrikeOutAnnotation; //# sourceMappingURL=CPDFMarkupAnnotation.js.map