@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.
50 lines • 1.92 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 { NativeModules, findNodeHandle } from 'react-native';
import { CPDFEditorHistoryManager } from '../history/CPDFEditorHistoryManager';
const { CPDFViewManager } = NativeModules;
export class CPDFEditManager {
_viewerRef;
_historyManager;
constructor(viewerRef) {
this._viewerRef = viewerRef;
this._historyManager = new CPDFEditorHistoryManager(this._viewerRef);
}
/**
* Gets the history manager associated with this edit manager.
* @example
* ```typescript
* const manager = pdfReaderRef.current._editManager;
* const historyManager = manager.historyManager;
* await historyManager.canUndo();
* ```
* @returns {CPDFEditorHistoryManager} The history manager instance.
*/
get historyManager() {
return this._historyManager;
}
/**
* Changes the current editing modes.
* @example
* ```typescript
* const manager = pdfReaderRef.current._editManager;
* await manager.changeEditType([CPDFEditType.Text, CPDFEditType.Image]);
* ```
* @param editTypes An array of `CPDFEditType` values representing the desired editing modes.
* @returns
*/
changeEditType = (editTypes) => {
const tag = findNodeHandle(this._viewerRef);
if (tag) {
return CPDFViewManager.changeEditType(tag, editTypes);
}
return Promise.reject(new Error('Unable to find the native view reference'));
};
}
//# sourceMappingURL=CPDFEditManager.js.map