Ticket Splitter - In-Browser PDF Splitter

Project Overview
A fully client-side web app that splits multi-page event-ticket PDFs into individually named single-page PDFs, with automatic field detection powered by a Rust core compiled to WebAssembly.
Context & Stack
Project Details
Project Metrics
Key Features
Privacy by Design
100% in-browser processing, no file is ever uploaded to a server
Automatic Field Detection
Finds each configured field's value (Seat, Block...) by locating its keyword on the page, automatically across every ticket
Split & ZIP Export
Turns a multi-page PDF into named single-page PDFs bundled in a downloadable archive
Zone Recalibration
If a field is misdetected, just select the right area on the preview to fix the detection across all tickets
Technical Skills
Rust ↔ WebAssembly Interop
Learned wasm-bindgen, a JSON-string boundary between JS and Rust, and the wasm32 gotchas (getrandom wasm_js backend, lopdf without rayon)
Spatial Detection Algorithm
Designing an anchor-and-region locator over positioned tokens, with coordinate normalization and a three-tier Keyword/Relative/Absolute model
Low-Level PDF Manipulation
Splitting PDFs and building ZIP archives in Rust with lopdf and the zip crate, all running inside WebAssembly
Multi-Stage Build Pipeline
Chaining a Rust→WASM artifact into a Vite build and an nginx image through a multi-stage Dockerfile and GitLab CI
Detailed Description
Ticket Splitter is a fully client-side web application (zero upload, GDPR-by-design) that splits a large multi-page event-ticket PDF into individually named single-page PDFs and exports them as a ZIP archive. Reading, field detection, splitting and archiving all run entirely in the browser, with no file ever sent to a server, which is verifiable in the network tab and backed by publicly auditable source code.
The application follows a hybrid architecture combining pdf.js on the JavaScript side (text extraction and canvas preview) with a Rust processing core compiled to WebAssembly via wasm-bindgen, the two sides communicating through a single boundary where data crosses as JSON strings. The Rust core locates each field through a three-tier Locator system (Keyword, Relative, Absolute): a keyword is matched as a whole-word anchor and the value is read from a region relative to it, with detection run in batch across every page at once. A user can redraw a detection zone on the preview to recalibrate a field, and the fix re-applies to every ticket in a single re-run.
The frontend is a React 19 and TypeScript single-page app built with Vite, Tailwind CSS 4 and shadcn/ui, featuring a guided onboarding tour, light/dark theming and a live file-naming preview. PDF splitting and ZIP packaging are handled in Rust with lopdf and the zip crate, configured for the wasm32 target (no threads, getrandom wasm_js backend). The whole stack ships through a multi-stage Docker build (Rust→WASM, Vite build, nginx-unprivileged runner) and a GitLab CI/CD pipeline where the WASM artifact produced by the Rust job feeds the web build, with Kaniko containerization and SSH deployment.