|
@@ -1,23 +1,124 @@
|
|
|
import { NativeModules } from 'react-native';
|
|
|
|
|
|
declare module 'react-native' {
|
|
|
- interface NativeModulesStatic {
|
|
|
- ComPDFKit: {
|
|
|
- getVersionCode() : () => Promise<string>;
|
|
|
- getSDKBuildTag() : () => Promise<string>;
|
|
|
- init_: (license : string) => void;
|
|
|
- initialize: (androidOnlineLicense: string, iosOnlineLicense : string) => void;
|
|
|
- openDocument : (document : string, password : string, configuration : string) => void;
|
|
|
- };
|
|
|
- }
|
|
|
+ interface NativeModulesStatic {
|
|
|
+ ComPDFKit: {
|
|
|
+ testConfig(configuration: string): () => void;
|
|
|
+ /**
|
|
|
+ * Get the version number of the ComPDFKit SDK.
|
|
|
+ * For example : '2.0.0'
|
|
|
+ * @memberof ComPDFKit
|
|
|
+ * @returns { Promise<string> } A Promise returning ComPDFKit PDF SDK Version Code
|
|
|
+ *
|
|
|
+ * @example
|
|
|
+ * ComPDFKit.getVersionCode().then((versionCode : string) => {
|
|
|
+ * console.log('ComPDFKit SDK Version:', versionCode)
|
|
|
+ * })
|
|
|
+ */
|
|
|
+ getVersionCode(): () => Promise<string>;
|
|
|
+ /**
|
|
|
+ * Get the build tag of the ComPDFKit PDF SDK.
|
|
|
+ *
|
|
|
+ * For example: "build_beta_2.0.0_42db96987_202404081007"
|
|
|
+ * @memberof ComPDFKit
|
|
|
+ * @returns { Promise<string> } A Promise returning ComPDFKit PDF SDK Build Tag.
|
|
|
+ *
|
|
|
+ * @example
|
|
|
+ * ComPDFKit.getSDKBuildTag().then((buildTag : string) => {
|
|
|
+ * console.log('ComPDFKit Build Tag:', buildTag)
|
|
|
+ * })
|
|
|
+ */
|
|
|
+ getSDKBuildTag(): () => Promise<string>;
|
|
|
+ /**
|
|
|
+ * Initialize the ComPDFKit PDF SDK using offline authentication.
|
|
|
+ * Each ComPDFKit license is bound to a specific app bundle ID(Android Application ID).
|
|
|
+ *
|
|
|
+ * @method init_
|
|
|
+ * @memberof ComPDFKit
|
|
|
+ * @param { string } [license] Your ComPDFKit for React Native license key.
|
|
|
+ * @returns { Promise<boolean> } Returns ```true``` if initialization is successful, otherwise returns ```false```.
|
|
|
+ *
|
|
|
+ * @example
|
|
|
+ * ComPDFKit.init_('your compdfkit license')
|
|
|
+ *
|
|
|
+ */
|
|
|
+ init_: (license: string) => Promise<boolean>;
|
|
|
+ /**
|
|
|
+ * Initialize the ComPDFKit PDF SDK using online authentication.
|
|
|
+ * Each ComPDFKit license is bound to a specific app bundle ID(Android Application ID).
|
|
|
+ *
|
|
|
+ * @method initialize
|
|
|
+ * @memberof ComPDFKit
|
|
|
+ * @param { string } [androidOnlineLicense] Your ComPDFKit for React Native Android online license key.
|
|
|
+ * @param { string } [iosOnlineLicense] Your ComPDFKit for React Native iOS online license key.
|
|
|
+ * @returns { Promise<boolean> } Returns ```true``` if initialization is successful, otherwise returns ```false```.
|
|
|
+ *
|
|
|
+ * @example
|
|
|
+ * ComPDFKit.initialize('your android compdfkit license', 'your ios compdfkit license')
|
|
|
+ */
|
|
|
+ initialize: (androidOnlineLicense: string, iosOnlineLicense: string) => Promise<boolean>;
|
|
|
+ /**
|
|
|
+ * Used to present a PDF document.
|
|
|
+ * @method openDocument
|
|
|
+ * @memberof ComPDFKit
|
|
|
+ * @param { string } [document] document The path to the PDF document to be presented.
|
|
|
+ *
|
|
|
+ * * (Android) For local storage file path:
|
|
|
+ * ```tsx
|
|
|
+ * document = 'file:///storage/emulated/0/Download/sample.pdf'
|
|
|
+ * ```
|
|
|
+ * * (Android) For content Uri:
|
|
|
+ * ```tsx
|
|
|
+ * document = 'content://...'
|
|
|
+ * ```
|
|
|
+ * * (Android) For assets path:
|
|
|
+ * ```tsx
|
|
|
+ * document = "file:///android_asset/..."
|
|
|
+ * ```
|
|
|
+ * ---
|
|
|
+ * * ios
|
|
|
+ * ```tsx
|
|
|
+ * document = 'pdf_document.pdf'
|
|
|
+ * ```
|
|
|
+ *
|
|
|
+ * @param { string } [password] PDF document password.
|
|
|
+ * @param { string } [configuration] Configuration objects to customize the appearance and behavior of ComPDFKit. See [CPDFConfiguration](configuration/CPDFConfiguration.ts)
|
|
|
+ * @returns { void }
|
|
|
+ *
|
|
|
+ * @example
|
|
|
+ * const fileName = 'pdf_document.pdf';
|
|
|
+ * const document =
|
|
|
+ * Platform.OS === 'ios' ? fileName
|
|
|
+ * : 'file:///android_asset/' + fileName;
|
|
|
+ *
|
|
|
+ * const configuration : CPDFConfiguration = {
|
|
|
+ * modeConfig: {
|
|
|
+ * initialViewMode: CPDFModeConfig.ViewMode.VIEWER,
|
|
|
+ * availableViewModes: [
|
|
|
+ * CPDFModeConfig.ViewMode.VIEWER,
|
|
|
+ * CPDFModeConfig.ViewMode.ANNOTATIONS,
|
|
|
+ * CPDFModeConfig.ViewMode.CONTENT_EDITOR,
|
|
|
+ * CPDFModeConfig.ViewMode.FORMS,
|
|
|
+ * CPDFModeConfig.ViewMode.SIGNATURES
|
|
|
+ * ]
|
|
|
+ * }
|
|
|
+ * }
|
|
|
+ *
|
|
|
+ * ComPDFKit.openDocument(document, 'password', JSON.stringify(configuration))
|
|
|
+ *
|
|
|
+ */
|
|
|
+ openDocument: (document: string, password: string, configuration: string) => void;
|
|
|
+ };
|
|
|
}
|
|
|
+}
|
|
|
|
|
|
-interface ComPDFKit{
|
|
|
- getVersionCode() : Promise<string>;
|
|
|
- getSDKBuildTag() : Promise<string>;
|
|
|
- init_(license : string) : void;
|
|
|
- initialize(androidOnlineLicense : string, iosOnlineLicense : string) : void;
|
|
|
- openDocument(document : string, password : string, configurationJson : string) : void;
|
|
|
+interface ComPDFKit {
|
|
|
+ testConfig(configuration: string): void;
|
|
|
+ getVersionCode(): Promise<string>;
|
|
|
+ getSDKBuildTag(): Promise<string>;
|
|
|
+ init_(license: string): Promise<boolean>;
|
|
|
+ initialize(androidOnlineLicense: string, iosOnlineLicense: string): Promise<boolean>;
|
|
|
+ openDocument(document: string, password: string, configurationJson: string): void;
|
|
|
}
|
|
|
|
|
|
const ComPDFKit = NativeModules.ComPDFKit
|