react-native-pdf-jsi 1.0.2 → 2.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 CHANGED
@@ -1,7 +1,23 @@
1
- # React Native PDF Enhanced
2
- [![npm](https://img.shields.io/npm/v/react-native-pdf-enhanced.svg?style=flat-square)](https://www.npmjs.com/package/react-native-pdf-enhanced)
1
+ # react-native-pdf-jsi 🚀
2
+ [![npm](https://img.shields.io/npm/v/react-native-pdf-jsi.svg?style=flat-square)](https://www.npmjs.com/package/react-native-pdf-jsi)
3
+ [![Downloads](https://img.shields.io/npm/dm/react-native-pdf-jsi.svg?style=flat-square)](https://www.npmjs.com/package/react-native-pdf-jsi)
4
+ [![GitHub stars](https://img.shields.io/github/stars/126punith/react-native-enhanced-pdf.svg?style=flat-square)](https://github.com/126punith/react-native-enhanced-pdf)
3
5
 
4
- **A high-performance React Native PDF viewer with JSI integration, delivering up to 80x faster operations on Android.**
6
+ **The fastest React Native PDF viewer with JSI acceleration - up to 80x faster than traditional bridge!**
7
+
8
+ A high-performance React Native PDF viewer component with JSI (JavaScript Interface) integration for enhanced speed and efficiency. Perfect for large PDF files with lazy loading, smart caching, progressive loading, and zero-bridge overhead operations.
9
+
10
+ ## 🎉 Version 2.0.0 - Major Release!
11
+
12
+ **We've completely rewritten the core architecture with revolutionary performance improvements!**
13
+
14
+ - **🚀 Complete JSI Integration**: Full native C++ implementation for Android and iOS
15
+ - **📄 Lazy Loading System**: Revolutionary approach to handling large PDF files
16
+ - **🎯 Smart Caching Engine**: 30-day persistent cache with intelligent management
17
+ - **📊 Progressive Loading**: Batch-based loading for optimal user experience
18
+ - **💾 Advanced Memory Management**: Intelligent memory optimization for large documents
19
+
20
+ *This is a drop-in replacement for react-native-pdf with significant performance improvements.*
5
21
 
6
22
  ## 🚀 Performance Breakthrough
7
23
 
@@ -12,6 +28,27 @@
12
28
  | Cache Access | 8ms | 0.1ms | **80x faster** |
13
29
  | Text Search | 120ms | 15ms | **8x faster** |
14
30
 
31
+ ## 🔥 Why Choose react-native-pdf-jsi?
32
+
33
+ - **⚡ Up to 80x Faster**: Direct JavaScript-to-Native communication via JSI
34
+ - **📄 Lazy Loading**: Optimized loading for large PDF files with configurable preload radius
35
+ - **🎯 Smart Caching**: 30-day persistent cache with intelligent memory management
36
+ - **📱 Cross-Platform**: Full support for iOS, Android, and Windows
37
+ - **🔄 Progressive Loading**: Batch-based loading with configurable batch sizes
38
+ - **💾 Memory Optimized**: Advanced memory management for large documents
39
+ - **🔍 Advanced Search**: Cached text search with bounds detection
40
+ - **📊 Performance Metrics**: Real-time performance monitoring and analytics
41
+
42
+ ## 🆚 Alternative to react-native-pdf
43
+
44
+ **react-native-pdf-jsi** is the enhanced, high-performance alternative to the standard `react-native-pdf` package. If you're experiencing slow loading times with large PDF files or need better performance, this package provides:
45
+
46
+ - **Zero Bridge Overhead**: Direct native communication via JSI
47
+ - **Lazy Loading Support**: Perfect for large PDF files that take too long to load
48
+ - **Persistent Caching**: 30-day cache with automatic cleanup
49
+ - **Memory Optimization**: Intelligent memory management for better performance
50
+ - **Drop-in Replacement**: Compatible with existing react-native-pdf code
51
+
15
52
  ## ✨ Features
16
53
 
17
54
  ### Core Features
@@ -30,6 +67,7 @@
30
67
  * **Real-time Performance Metrics** - Monitor and optimize PDF operations
31
68
  * **Graceful Fallback** - Seamless bridge mode when JSI unavailable
32
69
  * **Progressive Loading** - Smart preloading with background queue processing
70
+ * **Lazy Loading** - Optimized loading for large PDF files with configurable preload radius
33
71
  * **Advanced Search** - Cached text search with bounds detection
34
72
  * **React Hooks** - Easy integration with `usePDFJSI` hook
35
73
  * **Enhanced Components** - Drop-in replacement with automatic JSI detection
@@ -436,7 +474,26 @@ if (stats.jsiEnabled) {
436
474
 
437
475
  ## 📝 Changelog
438
476
 
439
- ### v1.0.2 (2025) - Latest
477
+ ### v2.0.0 (2025) - Latest 🚀 MAJOR RELEASE
478
+ - 🎉 **Major Version Release**: Significant performance improvements and new features
479
+ - 🚀 **Complete JSI Integration**: Full Android and iOS JSI implementation with native C++ optimizations
480
+ - 📄 **Lazy Loading System**: Revolutionary lazy loading for large PDF files with configurable preload radius
481
+ - 🎯 **Smart Caching Engine**: 30-day persistent cache with LRU eviction and background cleanup
482
+ - 📊 **Progressive Loading**: Batch-based progressive loading with configurable batch sizes
483
+ - 💾 **Advanced Memory Management**: Intelligent memory optimization for large documents
484
+ - 🔍 **Enhanced Search**: Cached text search with bounds detection and performance tracking
485
+ - 📱 **Native Cache Managers**: Complete Android and iOS native cache implementations
486
+ - 🔧 **Performance Monitoring**: Real-time performance metrics and analytics
487
+ - 📚 **Comprehensive Examples**: Updated examples with lazy loading and advanced features
488
+ - 🏷️ **SEO Optimization**: Enhanced discoverability with 40+ keywords and better descriptions
489
+ - 📈 **Better Documentation**: Improved README with performance comparisons and usage examples
490
+
491
+ ### v1.0.3 (2025)
492
+ - 🔗 **GitHub URL Fix**: Corrected repository URLs to point to the actual GitHub repository
493
+ - 📚 **Documentation Fix**: Updated README with correct package name and installation instructions
494
+ - 🔧 **Package Clarity**: Clear distinction between npm package name (`react-native-pdf-jsi`) and import names (`react-native-pdf-enhanced`)
495
+
496
+ ### v1.0.2 (2025)
440
497
  - 📚 **Documentation Fix**: Updated README with correct package name and installation instructions
441
498
  - 🔧 **Package Clarity**: Clear distinction between npm package name (`react-native-pdf-jsi`) and import names (`react-native-pdf-enhanced`)
442
499
 
@@ -528,6 +585,71 @@ await EnhancedPdfUtils.clearAllCaches();
528
585
  await EnhancedPdfUtils.optimizeAllMemory();
529
586
  ```
530
587
 
588
+ ### Lazy Loading for Large PDF Files
589
+
590
+ ```jsx
591
+ import React, { useRef, useEffect } from 'react';
592
+ import { View } from 'react-native';
593
+ import Pdf from 'react-native-pdf-enhanced';
594
+
595
+ export default function LazyLoadingExample() {
596
+ const pdfRef = useRef(null);
597
+
598
+ const handlePageChange = async (page) => {
599
+ if (pdfRef.current) {
600
+ try {
601
+ // Lazy load pages around current page
602
+ const result = await pdfRef.current.lazyLoadPages(page, 3, 100);
603
+ console.log('🚀 Lazy loaded pages:', result.preloadedRange);
604
+
605
+ // Progressive loading for large PDFs
606
+ const progressiveResult = await pdfRef.current.progressiveLoadPages(
607
+ 1, // start page
608
+ 5, // batch size
609
+ (progress) => {
610
+ console.log(`📄 Loaded batch ${progress.batchStartPage}-${progress.batchEndPage}`);
611
+ }
612
+ );
613
+
614
+ console.log('📊 Progressive loading completed:', progressiveResult.totalLoaded, 'pages');
615
+
616
+ } catch (error) {
617
+ console.error('❌ Lazy loading error:', error);
618
+ }
619
+ }
620
+ };
621
+
622
+ const handleSmartCache = async () => {
623
+ if (pdfRef.current) {
624
+ try {
625
+ // Cache frequently accessed pages
626
+ const frequentPages = [1, 2, 10, 50, 100]; // Example pages
627
+ const result = await pdfRef.current.smartCacheFrequentPages(frequentPages);
628
+ console.log('🎯 Smart cached pages:', result.successfulCaches);
629
+ } catch (error) {
630
+ console.error('❌ Smart cache error:', error);
631
+ }
632
+ }
633
+ };
634
+
635
+ return (
636
+ <View style={{ flex: 1 }}>
637
+ <Pdf
638
+ ref={pdfRef}
639
+ source={{ uri: 'http://example.com/large-document.pdf' }}
640
+ onPageChanged={handlePageChange}
641
+ onLoadComplete={(numberOfPages) => {
642
+ console.log(`📄 PDF loaded: ${numberOfPages} pages`);
643
+ // Initialize smart caching after load
644
+ handleSmartCache();
645
+ }}
646
+ style={{ flex: 1 }}
647
+ />
648
+ </View>
649
+ );
650
+ }
651
+ ```
652
+
531
653
  ## 📊 Performance Characteristics
532
654
 
533
655
  ### Memory Usage
@@ -671,16 +793,16 @@ MIT License - see [LICENSE](LICENSE) file for details.
671
793
 
672
794
  ## 🔗 Links
673
795
 
674
- - 📖 [Documentation](https://github.com/126punith/react-native-pdf-enhanced/wiki)
675
- - 🐛 [Report Issues](https://github.com/126punith/react-native-pdf-enhanced/issues)
676
- - 💬 [Discussions](https://github.com/126punith/react-native-pdf-enhanced/discussions)
677
- - 📦 [NPM Package](https://www.npmjs.com/package/react-native-pdf-enhanced)
796
+ - 📖 [Documentation](https://github.com/126punith/react-native-enhanced-pdf/wiki)
797
+ - 🐛 [Report Issues](https://github.com/126punith/react-native-enhanced-pdf/issues)
798
+ - 💬 [Discussions](https://github.com/126punith/react-native-enhanced-pdf/discussions)
799
+ - 📦 [NPM Package](https://www.npmjs.com/package/react-native-pdf-jsi)
678
800
  - 🚀 [JSI Documentation](README_JSI.md)
679
801
 
680
802
  ## 📞 Support
681
803
 
682
804
  For issues and questions:
683
- - GitHub Issues: [react-native-pdf-enhanced](https://github.com/126punith/react-native-pdf-enhanced)
805
+ - GitHub Issues: [react-native-enhanced-pdf](https://github.com/126punith/react-native-enhanced-pdf)
684
806
  - Performance Issues: Include JSI stats and performance history
685
807
  - Build Issues: Include CMake logs and Android NDK version
686
808
  - Contact: punithm300@gmail.com
@@ -691,7 +813,7 @@ For issues and questions:
691
813
 
692
814
  *Transform your PDF viewing experience with enterprise-grade performance and reliability.*
693
815
 
694
- **v1.0.2 - Enhanced JSI Integration**
816
+ **v1.0.3 - Enhanced JSI Integration**
695
817
  **Copyright (c) 2025-present, Punith M (punithm300@gmail.com). Enhanced PDF JSI Integration. All rights reserved.**
696
818
 
697
819
  *Original work Copyright (c) 2017-present, Wonday (@wonday.org). All rights reserved.*