react-native-pdf-jsi 3.4.2 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -1
- package/android/.gradle/5.6.1/fileChanges/last-build.bin +0 -0
- package/android/.gradle/5.6.1/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/5.6.1/gc.properties +0 -0
- package/android/.gradle/8.5/checksums/checksums.lock +0 -0
- package/android/.gradle/8.5/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/8.5/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/8.5/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/8.5/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/8.5/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/8.5/fileChanges/last-build.bin +0 -0
- package/android/.gradle/8.5/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/8.5/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/index.d.ts +24 -2
- package/ios/PERMISSIONS.md +106 -0
- package/ios/RNPDFPdf/FileDownloader.h +15 -0
- package/ios/RNPDFPdf/FileDownloader.m +567 -0
- package/ios/RNPDFPdf/FileManager.h +12 -0
- package/ios/RNPDFPdf/FileManager.m +201 -0
- package/ios/RNPDFPdf/ImagePool.h +61 -0
- package/ios/RNPDFPdf/ImagePool.m +162 -0
- package/ios/RNPDFPdf/LazyMetadataLoader.h +78 -0
- package/ios/RNPDFPdf/LazyMetadataLoader.m +184 -0
- package/ios/RNPDFPdf/MemoryMappedCache.h +71 -0
- package/ios/RNPDFPdf/MemoryMappedCache.m +264 -0
- package/ios/RNPDFPdf/PDFExporter.h +1 -1
- package/ios/RNPDFPdf/PDFExporter.m +475 -19
- package/ios/RNPDFPdf/PDFNativeCacheManager.h +11 -1
- package/ios/RNPDFPdf/PDFNativeCacheManager.m +283 -19
- package/ios/RNPDFPdf/StreamingPDFProcessor.h +86 -0
- package/ios/RNPDFPdf/StreamingPDFProcessor.m +314 -0
- package/package.json +1 -1
- package/src/managers/ExportManager.js +9 -3
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
## ⚡ Performance Benchmarks (
|
|
11
|
+
## ⚡ Performance Benchmarks (v4.0.0)
|
|
12
12
|
|
|
13
13
|
**World-class performance proven with real-world testing:**
|
|
14
14
|
|
|
@@ -87,6 +87,37 @@ Starting November 1, 2025, Google Play will require apps to support 16KB page si
|
|
|
87
87
|
- ✅ **Google Play Approved** - Meets all current and future requirements
|
|
88
88
|
- ✅ **Drop-in Replacement** - Easy migration from existing libraries
|
|
89
89
|
|
|
90
|
+
## 🎉 Version 4.0.0 - iOS Feature Parity & Major Improvements!
|
|
91
|
+
|
|
92
|
+
**Complete iOS pro features port with full feature parity between Android and iOS platforms!**
|
|
93
|
+
|
|
94
|
+
### 🚀 **What's New in v4.0.0:**
|
|
95
|
+
|
|
96
|
+
#### ✨ **New Features**
|
|
97
|
+
- **📱 iOS Pro Features Port** - Complete feature parity with Android! All pro features now available on iOS:
|
|
98
|
+
- File download and management (FileDownloader, FileManager)
|
|
99
|
+
- PDF export operations (split, merge, extract, rotate, delete)
|
|
100
|
+
- Export to images (PNG/JPEG) with quality control
|
|
101
|
+
- PDF compression with smart presets
|
|
102
|
+
- Text extraction and search capabilities
|
|
103
|
+
- **⚡ iOS Performance Optimizations**:
|
|
104
|
+
- **ImagePool** - Efficient UIImage reuse and memory management
|
|
105
|
+
- **LazyMetadataLoader** - Deferred PDF metadata loading for faster initial load
|
|
106
|
+
- **MemoryMappedCache** - Zero-copy file access using mmap() system call
|
|
107
|
+
- **StreamingPDFProcessor** - Chunk-based processing for large files (60MB-200MB+)
|
|
108
|
+
- **🌐 Cross-Platform Compatibility** - Platform.OS checks for method signature differences (Android 3 args vs iOS 2 args for splitPDF)
|
|
109
|
+
|
|
110
|
+
#### 🐛 **Bug Fixes**
|
|
111
|
+
- **📝 TypeScript Definitions** - Fixed malformed comment blocks in `index.d.ts` that made functional props appear commented out. All props (spacing, password, renderActivityIndicator, enableAntialiasing, enablePaging, enableRTL, enableAnnotationRendering, enableDoubleTapZoom, fitPolicy) now properly documented
|
|
112
|
+
- **🤖 Android splitPDF** - Fixed argument count mismatch error. Android requires 3 arguments (filePath, ranges, outputDir) while iOS requires 2 (filePath, ranges)
|
|
113
|
+
- **💥 Promise Resolution** - Fixed EXC_BAD_ACCESS crashes by ensuring all promise callbacks execute on main thread
|
|
114
|
+
- **📁 File Download** - Removed unstable native folder creation code, using react-native-blob-util for reliable folder operations
|
|
115
|
+
|
|
116
|
+
#### 🔄 **Technical Improvements**
|
|
117
|
+
- **Simplified File Management** - Removed subfolderName/folderName parameters, using react-native-blob-util for folder creation
|
|
118
|
+
- **Enhanced Stability** - Removed unstable iOS code that caused crashes, replaced with proven react-native-blob-util implementation
|
|
119
|
+
- **Better Error Handling** - Improved promise handling and thread safety across all native modules
|
|
120
|
+
|
|
90
121
|
## 🎉 Version 3.4.0 - Enhanced Navigation & File Path Handling!
|
|
91
122
|
|
|
92
123
|
**Major improvements to navigation reliability and file path tracking for better bookmarking, export, and PDF operations!**
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
File without changes
|
package/index.d.ts
CHANGED
|
@@ -40,15 +40,37 @@ export interface PdfProps {
|
|
|
40
40
|
showsVerticalScrollIndicator?: boolean,
|
|
41
41
|
scrollEnabled?: boolean,
|
|
42
42
|
/**
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
* Space between pages in pixels
|
|
44
|
+
*/
|
|
45
45
|
spacing?: number,
|
|
46
|
+
/**
|
|
47
|
+
* Password for encrypted PDFs
|
|
48
|
+
*/
|
|
46
49
|
password?: string,
|
|
50
|
+
/**
|
|
51
|
+
* Custom loading indicator component
|
|
52
|
+
* @param progress - Progress value from 0 to 1
|
|
53
|
+
*/
|
|
47
54
|
renderActivityIndicator?: (progress: number) => React.ReactElement,
|
|
55
|
+
/**
|
|
56
|
+
* Enable antialiasing for smoother rendering
|
|
57
|
+
*/
|
|
48
58
|
enableAntialiasing?: boolean,
|
|
59
|
+
/**
|
|
60
|
+
* Enable page-by-page navigation mode
|
|
61
|
+
*/
|
|
49
62
|
enablePaging?: boolean,
|
|
63
|
+
/**
|
|
64
|
+
* Enable right-to-left layout support
|
|
65
|
+
*/
|
|
50
66
|
enableRTL?: boolean,
|
|
67
|
+
/**
|
|
68
|
+
* Enable rendering of PDF annotations
|
|
69
|
+
*/
|
|
51
70
|
enableAnnotationRendering?: boolean,
|
|
71
|
+
/**
|
|
72
|
+
* Enable double-tap to zoom functionality
|
|
73
|
+
*/
|
|
52
74
|
enableDoubleTapZoom?: boolean;
|
|
53
75
|
/**
|
|
54
76
|
* Fit policy. This will adjust the initial zoom of the PDF based on the initial size of the view and the scale factor.
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# iOS Permissions Guide
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
This document explains the permissions required and how they are handled in the iOS implementation.
|
|
5
|
+
|
|
6
|
+
## Required Permissions
|
|
7
|
+
|
|
8
|
+
### 1. Notification Permissions
|
|
9
|
+
**Status**: ✅ Properly Handled
|
|
10
|
+
|
|
11
|
+
**What it's used for**:
|
|
12
|
+
- Showing download completion notifications in `FileDownloader`
|
|
13
|
+
|
|
14
|
+
**How it's handled**:
|
|
15
|
+
- Permissions are requested **on-demand** when a notification needs to be shown (not on module initialization)
|
|
16
|
+
- Permission status is checked before attempting to show notifications
|
|
17
|
+
- Graceful fallback if permissions are denied (logs warning, doesn't crash)
|
|
18
|
+
- Error handling included in permission request
|
|
19
|
+
|
|
20
|
+
**Info.plist Requirements**:
|
|
21
|
+
- ❌ **No Info.plist entry required** - Local notifications don't require usage descriptions
|
|
22
|
+
|
|
23
|
+
**Code Location**:
|
|
24
|
+
- `ios/RNPDFPdf/FileDownloader.m` - `requestNotificationPermissionsWithCompletion:` and `showDownloadNotification:`
|
|
25
|
+
|
|
26
|
+
### 2. File System Access
|
|
27
|
+
**Status**: ✅ No Special Permissions Required
|
|
28
|
+
|
|
29
|
+
**What it's used for**:
|
|
30
|
+
- Accessing app's Documents directory
|
|
31
|
+
- Creating folders in app's sandbox
|
|
32
|
+
- Copying files within app's container
|
|
33
|
+
|
|
34
|
+
**How it's handled**:
|
|
35
|
+
- Uses `NSDocumentDirectory` which is within the app's sandbox
|
|
36
|
+
- No special permissions needed - apps have full access to their own sandbox
|
|
37
|
+
- Uses `NSFileManager` for file operations
|
|
38
|
+
|
|
39
|
+
**Info.plist Requirements**:
|
|
40
|
+
- ❌ **No Info.plist entry required** - Accessing app's own sandbox doesn't require permissions
|
|
41
|
+
|
|
42
|
+
**Code Location**:
|
|
43
|
+
- `ios/RNPDFPdf/FileDownloader.m` - File operations
|
|
44
|
+
- `ios/RNPDFPdf/FileManager.m` - File operations
|
|
45
|
+
|
|
46
|
+
### 3. UIDocumentPickerViewController
|
|
47
|
+
**Status**: ✅ No Special Permissions Required
|
|
48
|
+
|
|
49
|
+
**What it's used for**:
|
|
50
|
+
- Opening Files app to show downloaded files
|
|
51
|
+
- Providing user access to exported files
|
|
52
|
+
|
|
53
|
+
**How it's handled**:
|
|
54
|
+
- Uses `UIDocumentPickerViewController` which doesn't require special permissions
|
|
55
|
+
- Multiple fallback strategies for maximum compatibility
|
|
56
|
+
- Handles cases where Files app might not be available
|
|
57
|
+
|
|
58
|
+
**Info.plist Requirements**:
|
|
59
|
+
- ❌ **No Info.plist entry required** - `UIDocumentPickerViewController` doesn't need permissions
|
|
60
|
+
|
|
61
|
+
**Code Location**:
|
|
62
|
+
- `ios/RNPDFPdf/FileManager.m` - `openDownloadsFolder:`
|
|
63
|
+
|
|
64
|
+
## Permission Request Flow
|
|
65
|
+
|
|
66
|
+
### Notification Permissions
|
|
67
|
+
```
|
|
68
|
+
1. User triggers download/export
|
|
69
|
+
2. FileDownloader.showDownloadNotification() is called
|
|
70
|
+
3. Check current authorization status
|
|
71
|
+
4. If not authorized → Request permissions
|
|
72
|
+
5. If authorized → Show notification
|
|
73
|
+
6. If denied → Log warning, continue without notification
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### File Access
|
|
77
|
+
```
|
|
78
|
+
1. No permission request needed
|
|
79
|
+
2. Direct access to NSDocumentDirectory (app's sandbox)
|
|
80
|
+
3. Create folders/files as needed
|
|
81
|
+
4. No user interaction required
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Best Practices Implemented
|
|
85
|
+
|
|
86
|
+
1. ✅ **On-Demand Permission Requests**: Permissions are requested when needed, not on app startup
|
|
87
|
+
2. ✅ **Permission Status Checks**: Always check authorization status before using protected resources
|
|
88
|
+
3. ✅ **Graceful Degradation**: App continues to work even if permissions are denied
|
|
89
|
+
4. ✅ **Error Handling**: All permission requests include error handling
|
|
90
|
+
5. ✅ **No Info.plist Pollution**: Only request permissions that are actually needed
|
|
91
|
+
|
|
92
|
+
## Testing Checklist
|
|
93
|
+
|
|
94
|
+
- [ ] Test notification permission request flow
|
|
95
|
+
- [ ] Test notification display when permissions granted
|
|
96
|
+
- [ ] Test graceful handling when permissions denied
|
|
97
|
+
- [ ] Test file operations in Documents directory
|
|
98
|
+
- [ ] Test UIDocumentPickerViewController on different iOS versions
|
|
99
|
+
- [ ] Verify no crashes when permissions are denied
|
|
100
|
+
|
|
101
|
+
## Notes
|
|
102
|
+
|
|
103
|
+
- **No Info.plist modifications needed** - All permissions are handled programmatically
|
|
104
|
+
- **No external dependencies** - Uses only iOS system frameworks
|
|
105
|
+
- **Backward compatible** - Works on iOS 11.0+ with appropriate fallbacks
|
|
106
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025-present, Punith M (punithm300@gmail.com)
|
|
3
|
+
* FileDownloader for iOS - Downloads files to Documents directory or iCloud Drive
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
*
|
|
6
|
+
* Downloads files to public storage and shows notifications
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
#import <React/RCTBridgeModule.h>
|
|
10
|
+
#import <React/RCTEventEmitter.h>
|
|
11
|
+
|
|
12
|
+
@interface FileDownloader : RCTEventEmitter <RCTBridgeModule>
|
|
13
|
+
|
|
14
|
+
@end
|
|
15
|
+
|