@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.
58 lines • 2.08 kB
JavaScript
/**
* 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.
*/
import { CPDFEditType } from "../configuration/CPDFOptions";
import { CPDFEditArea } from "./CPDFEditArea";
export class CPDFEditTextArea extends CPDFEditArea {
text;
alignment;
fontSize;
color;
// 0-255
alpha;
familyName;
styleName;
constructor(params) {
super({ type: CPDFEditType.TEXT, uuid: params.uuid, page: params.page });
this.text = params.text ?? '';
this.alignment = params.alignment ?? 'left';
this.fontSize = params.fontSize ?? 12.0;
this.color = params.color ?? '#000000';
this.alpha = params.alpha ?? 255;
this.familyName = params.familyName ?? 'Helvetica';
this.styleName = params.styleName ?? 'Regular';
}
static fromJson(json) {
return new CPDFEditTextArea({
uuid: json?.uuid ?? '',
page: Number(json?.page ?? 0),
text: json?.text ?? '',
alignment: json?.alignment ?? 'left',
fontSize: Number((json?.fontSize ?? 12.0)),
color: json?.color ?? '#000000',
alpha: Number((json?.alpha ?? 255)),
familyName: json?.familyName ?? 'Helvetica',
styleName: json?.styleName ?? 'Regular',
});
}
toJson() {
return {
type: 'text',
uuid: this.uuid,
page: this.page,
text: this.text,
alignment: this.alignment,
fontSize: this.fontSize,
color: this.color,
alpha: this.alpha,
familyName: this.familyName,
styleName: this.styleName,
};
}
}
//# sourceMappingURL=CPDFEditTextArea.js.map