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.

68 lines 2.23 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CPDFLinkAnnotation = 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 CPDFAction_1 = require("../document/action/CPDFAction"); const CPDFAnnotation_1 = require("./CPDFAnnotation"); /** * @class CPDFLinkAnnotation * @group Annotations * @property {CPDFAction} action - The action associated with the link annotation. */ class CPDFLinkAnnotation extends CPDFAnnotation_1.CPDFAnnotation { /** * The action associated with the link annotation. * example: * - web link: * { type: 'uri', uri: 'https://www.compdf.com' } * * - email link: * { type: 'uri', uri: 'mailto:support@compdf.com' } * * - go to page: * { type: 'goTo', pageIndex: 2 } * * @see {@link CPDFURIAction} * @see {@link CPDFGoToAction} */ action; constructor(params) { super(params); this.type = 'link'; if (params.action != null) { this.action = CPDFAction_1.CPDFAction.fromJson(params.action); } } /** * Update link annotation properties with type safety * @param updates Partial object containing properties to update * @returns this instance for chaining * * @example * linkAnnotation.update({ * title: 'Updated Title', * content: 'Updated content', * action: CPDFGoToAction.toPage(2) * }); * await document.updateAnnotation(linkAnnotation); */ update(updates) { Object.assign(this, updates); return this; } toJSON() { return { ...super.toJSON(), action: this.action ? this.action.toJSON?.() ?? this.action : undefined, }; } } exports.CPDFLinkAnnotation = CPDFLinkAnnotation; //# sourceMappingURL=CPDFLinkAnnotation.js.map