Browse Source

compdfkit(rn) - xfdf文件选择判断

yangliuhua 2 months ago
parent
commit
ce02135f4c
1 changed files with 5 additions and 5 deletions
  1. 5 5
      example/src/CPDFReaderViewControllerExample.tsx

+ 5 - 5
example/src/CPDFReaderViewControllerExample.tsx

@@ -119,15 +119,15 @@ const CPDFReaderViewControllerExampleScreen = () => {
                     pickerResult.then(async (res) => {
                         const file = res[0];
                         const fileName = file?.name;
-                        if (!fileName?.endsWith('xfdf')) {
-                            console.log('ComPDFKitRN please select xfdf format file');
-                            return;
-                        }
-
+                    
                         console.log('fileUri:', file?.uri);
                         console.log('fileCopyUri:', file?.fileCopyUri);
                         console.log('fileType:', file?.type);
                         const path = file!!.fileCopyUri!!
+                        if (!path?.endsWith('xml') && !path?.endsWith('xfdf')) {
+                            console.log('ComPDFKitRN please select xfdf format file');
+                            return;
+                        }
 
                         const importResult = await pdfReaderRef.current?.importAnnotations(path);
                         console.log('ComPDFKitRN importAnnotations:', importResult);