mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-14 10:34:06 +02:00
impl migration to pdfium for split (#6410)
## Summary Migrates `SplitPDFController`, `SplitPdfByChaptersController`, `SplitPdfBySizeController` from PDFBox to JPDFium. `SplitPdfBySectionsController` and `AutoSplitPdfController` are intentionally left on PDFBox (require JPDFium 1.0.2 features that don't exist yet). ## Benchmark (audited on `audit/jpdfium-split`, file `app/core/src/test/java/stirling/software/SPDF/bench/SplitBenchmark.java`) | Workload | PDFBox heap | JPDFium heap | PDFBox wall | JPDFium wall | |---|---|---|---|---| | 100 pp, chunk 10 | +21-26 MB | **+0.02 MB** | 80-106 ms | **25 ms** | | 300 pp, chunk 10 | +59 MB | **+1.0 MB** | 232 ms | **76 ms** | **98-99.9% heap reduction. 3-4.2x faster wall.** ## Hybrid - AcroForm-bearing splits keep PDFBox `FormUtils.pruneOrphanedFormFields` post-pass (FPDF_ImportPagesByIndex drops AcroForm dict). Sub-bench shows +1.0 MB / +27 ms - tightly bounded. - Metadata extraction stays on PDFBox. - `SplitPdfBySectionsController` - JPDFium `PdfPageSplitter` only does 2-up halving, not arbitrary MxN. - `AutoSplitPdfController` - needs PDFRenderer + zxing for QR markers. ## Test plan - [ ] 30/30 unit tests pass with PDFBox `Loader.loadPDF` as the oracle (assert page counts + document totals) - [ ] Existing cucumber feature `split.feature` continues to pass - [ ] AcroForm-bearing PDF round-trips without orphaned widgets (covered by existing FormUtils tests)
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
# X64_JAVA_HOME path to an x86_64 JDK with jmods/
|
||||
# JLINK_MODULES comma-separated module list (matches desktop.yml)
|
||||
# OUTPUT_DIR target directory (will be wiped); defaults to
|
||||
# frontend/src-tauri/runtime/jre
|
||||
# frontend/editor/src-tauri/runtime/jre
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
@@ -19,7 +19,7 @@ set -euo pipefail
|
||||
: "${X64_JAVA_HOME:?X64_JAVA_HOME must be set}"
|
||||
: "${JLINK_MODULES:?JLINK_MODULES must be set}"
|
||||
|
||||
OUTPUT_DIR="${OUTPUT_DIR:-frontend/src-tauri/runtime/jre}"
|
||||
OUTPUT_DIR="${OUTPUT_DIR:-frontend/editor/src-tauri/runtime/jre}"
|
||||
|
||||
if [[ "$(uname -s)" != "Darwin" ]]; then
|
||||
echo "build-universal-mac-jre.sh only runs on macOS" >&2
|
||||
|
||||
@@ -51,7 +51,7 @@ npm run tauri-build
|
||||
To build the DLL standalone:
|
||||
|
||||
```bash
|
||||
cd frontend/src-tauri/thumbnail-handler
|
||||
cd frontend/editor/src-tauri/thumbnail-handler
|
||||
cargo build --release
|
||||
# Output: target/release/stirling_thumbnail_handler.dll
|
||||
```
|
||||
|
||||
@@ -31,14 +31,14 @@ if [ -n "${1:-}" ]; then
|
||||
BOOTJARS+=("$1")
|
||||
else
|
||||
for cand in app/core/build/libs/stirling-pdf-*.jar \
|
||||
frontend/src-tauri/libs/stirling-pdf-*.jar; do
|
||||
frontend/editor/src-tauri/libs/stirling-pdf-*.jar; do
|
||||
[ -f "$cand" ] || continue
|
||||
BOOTJARS+=("$cand")
|
||||
done
|
||||
fi
|
||||
if [ "${#BOOTJARS[@]:-0}" = 0 ]; then
|
||||
echo "bootJar not found (expected app/core/build/libs/stirling-pdf-*.jar" \
|
||||
"or frontend/src-tauri/libs/stirling-pdf-*.jar)"
|
||||
"or frontend/editor/src-tauri/libs/stirling-pdf-*.jar)"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user