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.

81 lines 2.8 kB
"use strict"; /** * 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. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.CPDFEditArea = void 0; const CPDFOptions_1 = require("../configuration/CPDFOptions"); class CPDFEditArea { type; uuid; page; constructor(params) { this.type = params.type; this.uuid = params.uuid; this.page = params.page; } static create(json) { const type = this.stringToCPDFEditType(json?.type ?? "none"); if (type === CPDFOptions_1.CPDFEditType.TEXT) { const CPDFEditTextArea = require("./CPDFEditTextArea").CPDFEditTextArea; return CPDFEditTextArea.fromJson(json); } else if (type === CPDFOptions_1.CPDFEditType.IMAGE) { const CPDFEditImageArea = require("./CPDFEditImageArea").CPDFEditImageArea; return CPDFEditImageArea.fromJson(json); } else { return this.fromJson(json); } } static fromJson(json) { const type = this.stringToCPDFEditType(json?.type ?? "none"); return new CPDFEditArea({ type, uuid: json?.uuid ?? "", page: Number(json?.page ?? 0), }); } toJson() { return { type: CPDFEditArea.editTypeToString(this.type), uuid: this.uuid, page: this.page, }; } static stringToCPDFEditType(typeString) { switch (typeString) { case "none": return CPDFOptions_1.CPDFEditType.NONE; case "text": return CPDFOptions_1.CPDFEditType.TEXT; case "image": return CPDFOptions_1.CPDFEditType.IMAGE; case "path": return CPDFOptions_1.CPDFEditType.PATH; default: return CPDFOptions_1.CPDFEditType.NONE; } } static editTypeToString(editType) { switch (editType) { case CPDFOptions_1.CPDFEditType.NONE: return "none"; case CPDFOptions_1.CPDFEditType.TEXT: return "text"; case CPDFOptions_1.CPDFEditType.IMAGE: return "image"; case CPDFOptions_1.CPDFEditType.PATH: return "path"; default: return "none"; } } } exports.CPDFEditArea = CPDFEditArea; //# sourceMappingURL=CPDFEditArea.js.map