Skip to content

Open-source Android PDF and document toolkit with PDF tools, Office viewing, XLSX editing, scanning, and image editing. Built with Kotlin and Jetpack Compose.

fix: ship every bundled licence in the app, build with cargo --locked, correct the docs (fdroid)

Josh092ac4af7f32
diff --git a/NOTICE b/NOTICE
index 393ef11..8b3502a 100644
--- a/NOTICE
+++ b/NOTICE
@@ -42,8 +42,9 @@ Android app (apps/pdfcraft-android):
- JNA (https://github.com/java-native-access/jna) — Apache-2.0 (dual-licensed with LGPL-2.1; used
under Apache-2.0).
- AndroidX, Jetpack Compose, ExifInterface and kotlinx.coroutines — Apache-2.0.
-- Ocrs text-recognition models (fetched into assets/models by apps/pdfcraft-android/fetch-models.sh,
- not committed) by Robert Knight — CC-BY-SA-4.0. The app ships them unmodified with their licence.
+- Ocrs text-recognition models (assets/models, committed so the build downloads nothing;
+ apps/pdfcraft-android/fetch-models.sh fetches them again) by Robert Knight — CC-BY-SA-4.0. The app
+ ships them unmodified with their licence.
Required notices:
diff --git a/apps/pdfcraft-android/README.md b/apps/pdfcraft-android/README.md
index 79b8bad..a686786 100644
--- a/apps/pdfcraft-android/README.md
+++ b/apps/pdfcraft-android/README.md
@@ -35,9 +35,10 @@ You need:
- [cargo-ndk](https://github.com/bbqsrc/cargo-ndk): `cargo install cargo-ndk`
- the Android SDK with NDK 29.0.14206865 (Android Studio → SDK Manager → SDK Tools → NDK)
- JDK 17 or newer (Android Studio's bundled one is fine)
-- optionally the text-recognition models: `./fetch-models.sh` from this folder (12 MB,
- CC-BY-SA-4.0; `cargo xtask models` in the full PdfCraft workspace); without them the app builds
- and Recognize text says it isn't installed
+- the text-recognition models (12 MB, CC-BY-SA-4.0) are committed in `assets/models/`, so the
+ build downloads nothing; `./fetch-models.sh` from this folder fetches them again (`cargo xtask
+ models` in the full PdfCraft workspace). Without them the app builds and Recognize text says it
+ isn't installed
Then open `apps/pdfcraft-android/android` in Android Studio and press Run, or from a terminal:
diff --git a/apps/pdfcraft-android/android/app/build.gradle.kts b/apps/pdfcraft-android/android/app/build.gradle.kts
index 93fb23c..4ed67c5 100644
--- a/apps/pdfcraft-android/android/app/build.gradle.kts
+++ b/apps/pdfcraft-android/android/app/build.gradle.kts
@@ -86,7 +86,7 @@ abstract class CargoNdkBuild : DefaultTask() {
environment("CARGO_ENCODED_RUSTFLAGS", remap.joinToString("\u001f"))
commandLine(
listOf(cargo.get(), "ndk") + targets +
- listOf("--platform", apiLevel.get().toString(), "-o", out, "build", "--release", "-p", "pdfcraft-android", "--lib"),
+ listOf("--platform", apiLevel.get().toString(), "-o", out, "build", "--release", "--locked", "-p", "pdfcraft-android", "--lib"),
)
}
// cargo-ndk copies every shared library cargo left behind (dylib builds of a few
@@ -111,7 +111,7 @@ abstract class UniffiBindgen : DefaultTask() {
execOperations.exec {
workingDir(workspaceDir.get())
commandLine(
- cargo.get(), "run", "--quiet", "-p", "pdfcraft-android-bindgen", "--",
+ cargo.get(), "run", "--quiet", "--locked", "-p", "pdfcraft-android-bindgen", "--",
"generate", library.get().asFile.absolutePath, "--language", "kotlin", "--out-dir", out.absolutePath, "--no-format",
)
}
@@ -119,9 +119,10 @@ abstract class UniffiBindgen : DefaultTask() {
}
/**
- * Files from PdfCraft's `assets/` the app ships, copied at build time rather than duplicated:
- * its app icon, its UI font Inter (OFL) and the font's licence. [targets] maps each file name to
- * its path in the generated resource (or asset) folder.
+ * Files from PdfCraft's `assets/` (and `vendor/`) the app ships, copied at build time rather than
+ * duplicated: its app icon, its UI font Inter (OFL), and the licences of what the library bundles
+ * (fonts, icons). [targets] maps each file name to its path in the generated resource (or asset)
+ * folder.
*/
abstract class PdfcraftAssets : DefaultTask() {
@get:InputFiles @get:PathSensitive(PathSensitivity.NAME_ONLY) abstract val files: ConfigurableFileCollection
@@ -321,8 +322,16 @@ androidComponents {
targets.set(map.mapKeys { (k, _) -> k.substringAfterLast('/') })
}
val licences = tasks.register<PdfcraftAssets>("pdfcraftLicences$name") {
- files.from(File(assetsDir, "fonts/OFL-Inter.txt"), File(assetsDir, "icons/LICENSE-lucide.txt"))
- targets.set(mapOf("OFL-Inter.txt" to "licences/OFL-Inter.txt", "LICENSE-lucide.txt" to "licences/LICENSE-lucide.txt"))
+ // the Licences screen shows each (the Adobe CMaps' notice, from a crates.io crate, is a
+ // plain asset: app/src/main/assets/licences)
+ val map = mapOf(
+ File(assetsDir, "fonts/OFL-Inter.txt") to "licences/OFL-Inter.txt",
+ File(assetsDir, "icons/LICENSE-lucide.txt") to "licences/LICENSE-lucide.txt",
+ File(assetsDir, "fonts/OFL-DancingScript.txt") to "licences/OFL-DancingScript.txt",
+ File(cargoWorkspaceDir, "vendor/hayro-interpret/assets/LICENSE_FOXIT") to "licences/LICENSE-foxit.txt",
+ )
+ files.from(map.keys)
+ targets.set(map.mapKeys { (k, _) -> k.name })
}
val icons = tasks.register<LucideIconsTask>("lucideIcons$name") {
iconsDir.set(File(assetsDir, "icons"))
diff --git a/apps/pdfcraft-android/android/app/src/main/assets/licences/LICENSE-adobe-cmaps.txt b/apps/pdfcraft-android/android/app/src/main/assets/licences/LICENSE-adobe-cmaps.txt
new file mode 100644
index 0000000..2552cc9
--- /dev/null
+++ b/apps/pdfcraft-android/android/app/src/main/assets/licences/LICENSE-adobe-cmaps.txt
@@ -0,0 +1,28 @@
+Copyright 1990-2023 Adobe. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+
+Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+Neither the name of Adobe nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/apps/pdfcraft-android/android/app/src/main/java/io/github/artcraftandroid/pdfcraft/ui/AppRoot.kt b/apps/pdfcraft-android/android/app/src/main/java/io/github/artcraftandroid/pdfcraft/ui/AppRoot.kt
index 364dfc4..8579f6d 100644
--- a/apps/pdfcraft-android/android/app/src/main/java/io/github/artcraftandroid/pdfcraft/ui/AppRoot.kt
+++ b/apps/pdfcraft-android/android/app/src/main/java/io/github/artcraftandroid/pdfcraft/ui/AppRoot.kt
@@ -204,8 +204,12 @@ private fun LicencesScreen(vm: AppViewModel) {
val c = pdfColors
val context = LocalContext.current
androidx.activity.compose.BackHandler { vm.showLicences = false }
- val inter = remember { runCatching { context.assets.open("licences/OFL-Inter.txt").bufferedReader().readText() }.getOrDefault("") }
- val lucide = remember { runCatching { context.assets.open("licences/LICENSE-lucide.txt").bufferedReader().readText() }.getOrDefault("") }
+ // the full texts of the bundled notices, in the order of the entries below
+ val texts = remember {
+ listOf("LICENSE-lucide.txt", "OFL-Inter.txt", "OFL-DancingScript.txt", "LICENSE-foxit.txt", "LICENSE-adobe-cmaps.txt").map { name ->
+ runCatching { context.assets.open("licences/$name").bufferedReader().readText() }.getOrDefault("")
+ }
+ }
Column(Modifier.fillMaxSize().background(c.surface).safeTopPadding().navigationBarsPadding()) {
Row(Modifier.fillMaxWidth().height(56.dp), verticalAlignment = Alignment.CenterVertically) {
Box(Modifier.width(56.dp), contentAlignment = Alignment.Center) { BarIcon(LucideIcons.ArrowLeft, stringResource(R.string.common_back), { vm.showLicences = false }) }
@@ -223,12 +227,15 @@ private fun LicencesScreen(vm: AppViewModel) {
entry("AndroidX, Jetpack Compose, Kotlin coroutines", "Apache-2.0")
entry(stringResource(R.string.root_licence_lucide), "ISC, Lucide Contributors")
entry(stringResource(R.string.root_licence_inter), "SIL Open Font License 1.1, The Inter Project Authors")
+ entry(stringResource(R.string.root_licence_dancing_script), "SIL Open Font License 1.1, The Dancing Script Project Authors")
+ entry(stringResource(R.string.root_licence_foxit), "BSD-3-Clause, Foxit Software Inc. and the PDFium Authors")
+ entry(stringResource(R.string.root_licence_cmaps), "BSD-3-Clause, Adobe")
entry(stringResource(R.string.root_licence_ocrs), stringResource(R.string.root_licence_ocrs_terms))
entry(stringResource(R.string.root_licence_rust), stringResource(R.string.root_licence_rust_terms))
- Spacer(Modifier.height(20.dp))
- Text(lucide, color = c.textSecondary, fontSize = 11.sp)
- Spacer(Modifier.height(20.dp))
- Text(inter, color = c.textSecondary, fontSize = 11.sp)
+ for (licence in texts.filter { it.isNotBlank() }) {
+ Spacer(Modifier.height(20.dp))
+ Text(licence, color = c.textSecondary, fontSize = 11.sp)
+ }
Spacer(Modifier.height(32.dp))
}
}
diff --git a/apps/pdfcraft-android/android/app/src/main/res/values/strings.xml b/apps/pdfcraft-android/android/app/src/main/res/values/strings.xml
index 60647f0..7dc135c 100644
--- a/apps/pdfcraft-android/android/app/src/main/res/values/strings.xml
+++ b/apps/pdfcraft-android/android/app/src/main/res/values/strings.xml
@@ -364,6 +364,9 @@
<string name="root_licence_pdfcraft_terms">MIT OR Apache-2.0, by storytold and contributors</string>
<string name="root_licence_lucide">Lucide icons</string>
<string name="root_licence_inter">Inter typeface</string>
+ <string name="root_licence_dancing_script">Dancing Script typeface (typed signatures)</string>
+ <string name="root_licence_foxit">Foxit fonts (for PDFs that don\'t embed their standard fonts)</string>
+ <string name="root_licence_cmaps">Adobe CMap resources (for reading Chinese, Japanese and Korean PDFs)</string>
<string name="root_licence_ocrs">Text recognition models (ocrs)</string>
<string name="root_licence_ocrs_terms">CC-BY-SA-4.0, Robert Knight; trained on HierText</string>
<string name="root_licence_rust">hayro, lopdf, boa and the engine\'s other Rust dependencies</string>
diff --git a/apps/pdfcraft-android/fetch-models.sh b/apps/pdfcraft-android/fetch-models.sh
index 77a6cbd..8c6749a 100755
--- a/apps/pdfcraft-android/fetch-models.sh
+++ b/apps/pdfcraft-android/fetch-models.sh
@@ -1,7 +1,9 @@
#!/usr/bin/env bash
# Fetches the text-recognition models (Recognize text) into assets/models/, checked by SHA-256,
# with their licence and an attribution note: what `cargo xtask models` does in the full PdfCraft
-# workspace. The app builds without them; Recognize text then says it isn't installed.
+# workspace. The public repository (artcraft-android/pdfcraft-android) commits them, so its builds
+# (F-Droid's too) download nothing; this fetches them again. Without them the app still builds, and
+# Recognize text says it isn't installed.
set -euo pipefail
root="$(cd "$(dirname "$0")/../.." && pwd)"
diff --git a/fastlane/metadata/android/en-US/changelogs/2012.txt b/fastlane/metadata/android/en-US/changelogs/2012.txt
index dee2825..b65fe50 100644
--- a/fastlane/metadata/android/en-US/changelogs/2012.txt
+++ b/fastlane/metadata/android/en-US/changelogs/2012.txt
@@ -1,7 +1,5 @@
-First release on F-Droid.
* Edit PDF: lists, spell check, images from the camera
* Comments: move and resize them, set their opacity and width; undo and redo while drawing
* Read aloud: pick the language, keep listening in the background, resume where you stopped
* Select several files on Home; files reopen at the same spot and zoom
* Page menu on a long press; pick which pages to export as images
-* Reproducible builds: the APK F-Droid builds matches the one on GitHub
diff --git a/fastlane/metadata/android/en-US/full_description.txt b/fastlane/metadata/android/en-US/full_description.txt
index 98b6aa8..5c71946 100644
--- a/fastlane/metadata/android/en-US/full_description.txt
+++ b/fastlane/metadata/android/en-US/full_description.txt
@@ -1,4 +1,4 @@
-An open-source, reimplementation of Adobe Acrobat Reader in Rust while using Kotlin as the UI framework.
+An open-source PDF reader and editor in Rust while using Kotlin as the UI framework.
PdfCraft is a PDF reader and editor for Android, built on the PdfCraft engine. It follows the layout and the tools of Acrobat Reader for phones, and everything stays on your phone: no account, no cloud.