@@ -120,8 +120,8 @@ open ios/Podfile
120120``` diff
121121target 'MyApp' do
122122 # ...
123- + pod "ComPDFKit", podspec:'https://file.compdf.com/cocoapods/ios/compdfkit_pdf_sdk/2.4.1 /ComPDFKit.podspec'
124- + pod "ComPDFKit_Tools", podspec:'https://file.compdf.com/cocoapods/ios/compdfkit_pdf_sdk/2.4.1 /ComPDFKit_Tools.podspec'
123+ + pod "ComPDFKit", podspec:'https://file.compdf.com/cocoapods/ios/compdfkit_pdf_sdk/2.4.3 /ComPDFKit.podspec'
124+ + pod "ComPDFKit_Tools", podspec:'https://file.compdf.com/cocoapods/ios/compdfkit_pdf_sdk/2.4.3 /ComPDFKit_Tools.podspec'
125125 # ...
126126end
127127```
131131``` diff
132132target 'MyApp' do
133133 # ...
134- + pod 'ComPDFKit', :git => 'https://github.com/ComPDFKit/compdfkit-pdf-sdk-ios-swift.git', :tag => '2.4.1 '
135- + pod 'ComPDFKit_Tools', :git => 'https://github.com/ComPDFKit/compdfkit-pdf-sdk-ios-swift.git', :tag => '2.4.1 '
134+ + pod 'ComPDFKit', :git => 'https://github.com/ComPDFKit/compdfkit-pdf-sdk-ios-swift.git', :tag => '2.4.3 '
135+ + pod 'ComPDFKit_Tools', :git => 'https://github.com/ComPDFKit/compdfkit-pdf-sdk-ios-swift.git', :tag => '2.4.3 '
136136 # ...
137137end
138138```
@@ -200,7 +200,7 @@ Here is the sample code for `App.tsx`:
200200
201201import React , { Component } from ' react' ;
202202import {
203- SafeAreaView
203+ SafeAreaView
204204} from ' react-native' ;
205205import { ComPDFKit , CPDFReaderView } from ' @compdfkit_pdf_sdk/react_native' ;
206206import { Platform } from ' react-native' ;
@@ -209,72 +209,67 @@ type Props = {};
209209
210210export default class App extends Component <Props > {
211211
212- state = {
213- versionCode: ' '
214- }
215-
216- constructor (props : Props ) {
217- super (props )
218- this .initialize ()
219- this .getVersionCode ()
220- }
212+ state = {
213+ versionCode: ' '
214+ }
221215
222- async getVersionCode() {
223- // Get the version code of ComPDFKit SDK
224- var version = await ComPDFKit .getVersionCode ()
225- this .setState ({
226- versionCode: version
227- })
228- }
216+ constructor (props : Props ) {
217+ super (props )
218+ this .initialize ()
219+ this .getVersionCode ()
220+ }
229221
230- async initialize() {
231- // Online certification, Fill in your online license
232- // Returns true if initialization is successful, otherwise returns false.
233- // var result = await ComPDFKit.initialize('compdfkit android license', 'compdfkit ios license')
234- // console.log("ComPDFKitRN", "initialize:", result)
222+ async getVersionCode() {
223+ // Get the version code of ComPDFKit SDK
224+ var version = await ComPDFKit .getVersionCode ()
225+ this .setState ({
226+ versionCode: version
227+ })
228+ }
235229
236- // Offline authentication, Fill in your offline license
237- var result = await ComPDFKit .init_ (' compdfkit license' )
238- console .log (" ComPDFKitRN" , " init_:" , result )
239- }
230+ async initialize() {
231+ // use license file
232+ var result = await ComPDFKit .initWithPath (Platform .OS == " android" ? " assets://license_key_rn_android.xml" : " license_key_rn_ios.xml" )
233+ console .log (" ComPDFKitRN" , " init_:" , result )
234+ }
240235
241- /**
236+ /**
242237 * Open the sample document embedded in Android or iOS project.
243238 */
244- openSample() {
245- var samplePDF: string = Platform .OS == ' android' ? ' file:///android_asset/PDF_Document.pdf' : ' PDF_Document.pdf'
246- // We provide default UI and PDF property related configurations here, you can modify configuration options according to your needs.
247- var config = ComPDFKit .getDefaultConfig ({
239+ openSample() {
240+ var samplePDF: string = Platform .OS == ' android' ? ' file:///android_asset/PDF_Document.pdf' : ' PDF_Document.pdf'
241+ // We provide default UI and PDF property related configurations here, you can modify configuration options according to your needs.
242+ var config = ComPDFKit .getDefaultConfig ({
248243
249- })
250- ComPDFKit .openDocument (samplePDF , ' ' , config )
251- }
244+ })
245+ ComPDFKit .openDocument (samplePDF , ' ' , config )
246+ }
252247
253- samplePDF = Platform .OS === ' android'
254- ? ' file:///android_asset/PDF_Document.pdf'
255- : ' PDF_Document.pdf' ;
248+ samplePDF = Platform .OS === ' android'
249+ ? ' file:///android_asset/PDF_Document.pdf'
250+ : ' PDF_Document.pdf' ;
256251
257- const onPageChanged = (pageIndex : number ) => {
258- // console.log('ComPDFKitRN --- onPageChanged:', pageIndex);
259- }
252+ const onPageChanged = (pageIndex : number ) => {
253+ // console.log('ComPDFKitRN --- onPageChanged:', pageIndex);
254+ }
260255
261- const saveDocument = () => {
262- console .log (' ComPDFKitRN saveDocument' );
263- }
256+ const saveDocument = () => {
257+ console .log (' ComPDFKitRN saveDocument' );
258+ }
264259
265- render() {
266- return (
267- <SafeAreaView style = { { flex: 1 }} >
268- <CPDFReaderView
269- document = { this .samplePDF }
270- onPageChanged = { onPageChanged }
271- saveDocument = { saveDocument }
272- configuration = { ComPDFKit .getDefaultConfig ({})}
273- style = { { flex: 1 }}
274- />
275- </SafeAreaView >
276- );
277- }
260+ render() {
261+ return (
262+ <SafeAreaView style = { { flex: 1 }} >
263+ <CPDFReaderView
264+ document = { this .samplePDF }
265+ onPageChanged = { onPageChanged }
266+ saveDocument = { saveDocument }
267+ configuration = { ComPDFKit .getDefaultConfig ({})}
268+ style = { { flex: 1 }}
269+ />
270+ </SafeAreaView >
271+ );
272+ }
278273}
279274```
280275
0 commit comments