react-native-pdf-renderer 1.0.0 → 1.0.1
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
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
[](https://www.npmjs.com/package/react-native-pdf-renderer)
|
|
5
5
|
[](#install-with-react-native-link)
|
|
6
6
|
|
|
7
|
-
⚛ A blazing fast, zero dependencies, pure native, typed PDF Renderer for Android and iOS.
|
|
7
|
+
⚛ A zoomable, blazing fast, zero dependencies, pure native, typed PDF Renderer for Android and iOS.
|
|
8
|
+
|
|
9
|
+
It uses [PdfRenderer](https://developer.android.com/reference/android/graphics/pdf/PdfRenderer) for Android and [PdfKit](https://developer.apple.com/documentation/pdfkit) for iOS.
|
|
8
10
|
|
|
9
11
|
|Android|iOS|
|
|
10
12
|
|-|-|
|
|
@@ -55,9 +57,9 @@ const App = () => {
|
|
|
55
57
|
export default App;
|
|
56
58
|
```
|
|
57
59
|
|
|
58
|
-
The `source` prop must point to a file
|
|
60
|
+
The `source` prop must point to a file stored inside device memory.
|
|
59
61
|
|
|
60
|
-
If the file is online, you can use some third part library like `expo-file-system` or `
|
|
62
|
+
If the file is online, you can use some third part library like `expo-file-system`, `rn-fetch-blob` or `react-native-blob-util` to download and save locally.
|
|
61
63
|
|
|
62
64
|
For more details, see the [Sample Project](https://github.com/douglasjunior/react-native-pdf-renderer/blob/master/Sample/App.tsx).
|
|
63
65
|
|
|
@@ -81,7 +83,7 @@ New features, bug fixes and improvements are welcome! For questions and suggesti
|
|
|
81
83
|
|
|
82
84
|
## Thanks to
|
|
83
85
|
|
|
84
|
-
|
|
86
|
+
This lib is only possible thanks to the community help:
|
|
85
87
|
|
|
86
88
|
- RecyclerView `notifyDataSetChanged()` not working on React Native: https://stackoverflow.com/a/49381907/2826279
|
|
87
89
|
- Add pinch to zoom on RecyclerView: https://stackoverflow.com/a/37895783/2826279
|
|
@@ -40,7 +40,7 @@ NSMutableDictionary *maxScaleFactors;
|
|
|
40
40
|
|
|
41
41
|
RNPDFView *view = [[RNPDFView alloc] init];
|
|
42
42
|
view.tag = [[NSDate new] timeIntervalSince1970];
|
|
43
|
-
|
|
43
|
+
|
|
44
44
|
return view;
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -64,6 +64,10 @@ RCT_EXPORT_VIEW_PROPERTY(onPageChange, RCTBubblingEventBlock)
|
|
|
64
64
|
RCT_CUSTOM_VIEW_PROPERTY(source, NSString, RNPDFView)
|
|
65
65
|
{
|
|
66
66
|
if (json != nil) {
|
|
67
|
+
if (![json hasPrefix:@"file://"]) {
|
|
68
|
+
json = [NSString stringWithFormat:@"%@%@", @"file://", json];
|
|
69
|
+
}
|
|
70
|
+
|
|
67
71
|
NSURL *url = [NSURL URLWithString:json];
|
|
68
72
|
PDFDocument *pdfDocument = [[PDFDocument alloc] initWithURL:url];
|
|
69
73
|
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-pdf-renderer",
|
|
3
3
|
"displayName": "React-Native Pdf Renderer",
|
|
4
|
-
"version": "1.0.
|
|
5
|
-
"description": "⚛ A blazing fast, zero dependencies, pure native, typed PDF Renderer for Android and iOS.",
|
|
4
|
+
"version": "1.0.1",
|
|
5
|
+
"description": "⚛ A zoomable, blazing fast, zero dependencies, pure native, typed PDF Renderer for Android and iOS.",
|
|
6
6
|
"main": "dist",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"private": false,
|