react-native-pdfrender 0.1.0 → 0.1.4
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.
|
@@ -1172,7 +1172,24 @@ fun PdfRendererView(
|
|
|
1172
1172
|
|
|
1173
1173
|
try {
|
|
1174
1174
|
val contentResolver = context.contentResolver
|
|
1175
|
-
|
|
1175
|
+
|
|
1176
|
+
// Download http/https URIs to a temp file so ContentResolver can open them
|
|
1177
|
+
val effectiveUri: Uri = if (uri.scheme == "http" || uri.scheme == "https") {
|
|
1178
|
+
loadingStatus = "Downloading PDF..."
|
|
1179
|
+
withContext(Dispatchers.IO) {
|
|
1180
|
+
val tempFile = java.io.File(context.cacheDir, "pdf_dl_${uri.hashCode()}.pdf")
|
|
1181
|
+
if (!tempFile.exists()) {
|
|
1182
|
+
java.net.URL(uri.toString()).openStream().use { input ->
|
|
1183
|
+
tempFile.outputStream().use { output -> input.copyTo(output) }
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
Uri.fromFile(tempFile)
|
|
1187
|
+
}
|
|
1188
|
+
} else {
|
|
1189
|
+
uri
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
val tempPfd = contentResolver.openFileDescriptor(effectiveUri, "r")
|
|
1176
1193
|
|
|
1177
1194
|
if (tempPfd == null) {
|
|
1178
1195
|
Log.e("PdfRenderer", "Failed to open PDF file")
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!--
|
|
3
|
+
Resource IDs used as View tag keys in PdfViewerFabricManager.kt.
|
|
4
|
+
Android requires every R.id.* used with View.setTag(id, value) to be
|
|
5
|
+
declared here — otherwise the build fails with "No resource found" error.
|
|
6
|
+
-->
|
|
7
|
+
<resources>
|
|
8
|
+
<item name="tag_pdf_uri" type="id" />
|
|
9
|
+
<item name="tag_page_index" type="id" />
|
|
10
|
+
<item name="tag_max_width" type="id" />
|
|
11
|
+
<item name="tag_screen_pct" type="id" />
|
|
12
|
+
<item name="tag_default_zoom" type="id" />
|
|
13
|
+
<item name="tag_fullscreen" type="id" />
|
|
14
|
+
<item name="tag_right_layout" type="id" />
|
|
15
|
+
<item name="tag_back_text" type="id" />
|
|
16
|
+
<item name="tag_header_text" type="id" />
|
|
17
|
+
<item name="tag_icon_urls" type="id" />
|
|
18
|
+
<item name="tag_icon_style" type="id" />
|
|
19
|
+
</resources>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-pdfrender",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "React Native PDF rendering library with TurboModules and Fabric components",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
],
|
|
37
37
|
"repository": {
|
|
38
38
|
"type": "git",
|
|
39
|
-
"url": "git+https://github.com/
|
|
39
|
+
"url": "git+https://github.com/shubham_95/react-native-pdfrender.git"
|
|
40
40
|
},
|
|
41
|
-
"homepage": "https://github.com/
|
|
41
|
+
"homepage": "https://github.com/shubham_95/react-native-pdfrender#readme",
|
|
42
42
|
"bugs": {
|
|
43
|
-
"url": "https://github.com/
|
|
43
|
+
"url": "https://github.com/shubham_95/react-native-pdfrender/issues"
|
|
44
44
|
},
|
|
45
45
|
"author": "Shubham Keshari <shubham.keshari@cosmiq.co.in>",
|
|
46
46
|
"license": "MIT",
|
|
@@ -105,5 +105,8 @@
|
|
|
105
105
|
}
|
|
106
106
|
]
|
|
107
107
|
]
|
|
108
|
+
},
|
|
109
|
+
"dependencies": {
|
|
110
|
+
"react-native-pdfrender": "^0.1.0"
|
|
108
111
|
}
|
|
109
112
|
}
|
|
@@ -6,12 +6,12 @@ Pod::Spec.new do |s|
|
|
|
6
6
|
s.name = "react-native-pdfrender"
|
|
7
7
|
s.version = package["version"]
|
|
8
8
|
s.summary = package["description"]
|
|
9
|
-
s.homepage = package["homepage"] || "https://github.com/
|
|
9
|
+
s.homepage = package["homepage"] || "https://github.com/shubham_95/react-native-pdfrender"
|
|
10
10
|
s.license = package["license"]
|
|
11
11
|
s.authors = package["author"]
|
|
12
12
|
s.platforms = { :ios => "13.0" }
|
|
13
13
|
|
|
14
|
-
s.source = { :git => "https://github.com/
|
|
14
|
+
s.source = { :git => "https://github.com/shubham_95/react-native-pdfrender.git",
|
|
15
15
|
:tag => "v#{s.version}" }
|
|
16
16
|
|
|
17
17
|
# All Swift and ObjC++ library sources live in ios/
|