zero-upload-pdf-studio--page-reorder

Zero-Upload PDF Studio & Page Reorder
Interactive Web Application & Whitepaper

Zero-Upload PDF Studio & Page Reorder

Air-gapped, client-side in-memory PDF page manipulator, splitter, and merger with 100% data sovereignty.

🚀 5-Step "Just Type Continue" AI Pipeline

Paste this master prompt into ChatGPT, Claude, or Cursor. Your AI will code the application across 5 progressive milestones; at each stage, simply reply with "continue" to build the next layer!

ROLE: Senior Web Architect and Interactive Pair-Programmer.
TASK: Build the complete single-file web application "Zero-Upload PDF Studio & Page Reorder" across 5 progressive milestones.

⚠️ STRICT INTERACTIVE PIPELINE RULE:
1. Do NOT generate the entire application at once.
2. In your first response, deliver ONLY Milestone 1.
3. At the end of EACH milestone, STOP and output exactly:
   "✅ Milestone [X] Complete! Reply with 'continue' to proceed to Milestone [X+1]."
4. When I reply with "continue", deliver the next milestone building directly upon the previous code.
5. All code must be zero-dependency, pure HTML+CSS+JS, mobile-friendly (min 44px touch targets).

📋 THE 5 MILESTONES:
- Milestone 1: Base Architecture, Air-Gapped Security Shell, and Canvas 2D Page Framework
- Milestone 2: Native In-Memory Binary Parser, DecompressionStream Engine, and Real Text Extraction
- Milestone 3: HTML5 and Touch Drag-and-Drop Reordering Engine with Keyboard Accessibility
- Milestone 4: Dual-Mode Page Inspector (Canvas & Native PDF), Splitting, and Cryptographic Telemetry
- Milestone 5: Web Audio Acoustic Synthesis, True-Content %PDF-1.4 Binary Compiler, and Production Hardening

👉 INSTRUCTION:
Begin NOW with Milestone 1 ONLY.

Level 1: Beginner - Foundation, Air-Gapped Shell, and Canvas Viewport

ROLE: Senior Frontend Engineer and Systems Architect.
PROMPT:
Generate Milestone 1 of the "Zero-Upload PDF Studio & Page Reorder" single-file application.
Focus exclusively on building the structural layout, CSS custom properties, and initial Canvas 2D thumbnail container.

Technical Requirements:
1. Pure vanilla HTML5 with semantic landmarks (<header>, <nav>, <main>, <section>, <footer>).
2. Deep oceanic slate design system using HSL color tokens: base hue 222, saturation 22%, lightness 8% for the canvas background, and 13% for card surfaces.
3. Air-gapped trust badge with an animated CSS pulse indicator signaling 100% client-side execution.
4. Clean empty state dropzone with accessible file input accepting PDF and image formats (.pdf, .png, .jpg, .webp).
5. Minimum touch target size of 44x44 pixels for all interactive triggers.
6. Responsive CSS Grid for page card layouts with fluid typography calculated via clamp().
7. Ensure zero external dependencies (no CDNs, no web fonts, no external image URLs).
8. Conclude response with: "✅ Milestone 1 Complete! Reply with 'continue' to proceed to Milestone 2."

Description: Milestone 1 establishes the rock-solid visual foundation and architectural scaffold. It sets up the mathematical HSL color variables, fluid typography, touch ergonomics, and the empty state drag-and-drop landing area while strictly prohibiting external libraries or unverified network connections.

Level 2: Intermediate - Real PDF Object Parser, DecompressionStream, and Authentic Previews

ROLE: Senior JavaScript Systems Developer.
PROMPT:
Continue to Milestone 2 of "Zero-Upload PDF Studio & Page Reorder".
Build directly on top of Milestone 1 by implementing the in-memory indirect object parser, FlateDecode decompression, and Canvas 2D rendering pipeline.

Technical Requirements:
1. Build a binary-safe PDF lexer (parsePdfObjects) that scans ArrayBuffers for indirect objects (<id> <gen> obj...endobj), extracting dictionaries and raw stream byte arrays.
2. Implement page tree resolution traversing /Catalog -> /Pages -> /Kids down to leaf /Page objects, inheriting /MediaBox, /Rotate, and /Resources.
3. Integrate native DecompressionStream('deflate') and DecompressionStream('deflate-raw') to unpack /Filter /FlateDecode content streams without external libraries.
4. Implement a PostScript stream operator interpreter extracting actual document text strings (Tj, TJ), font sizes (Tf), coordinates (Td, Tm), rectangles (re), and colors (rg, RG).
5. Build a Canvas 2D rendering function renderPageToCanvas(page, canvas, options) that draws the extracted authentic text and vector rectangles onto the thumbnail.
6. Add instant demo presets (Financial, Legal, Technical) pre-compiled as valid PDF objects so users can test immediately.
7. Conclude response with: "✅ Milestone 2 Complete! Reply with 'continue' to proceed to Milestone 3."

Description: Milestone 2 breathes life into the application by creating the core data models and rendering engine. It handles binary file ingestion in local memory, decompresses PDF content streams via browser-native streams, extracts real text and vector shapes, and renders authentic page previews on Canvas 2D.

Level 3: Advanced - Drag-and-Drop Reordering, Touch Gestures, and Batch Actions

ROLE: UI/UX Motion and Interaction Architect.
PROMPT:
Continue to Milestone 3 of "Zero-Upload PDF Studio & Page Reorder".
Implement complete page manipulation, drag-and-drop reordering, and batch operational commands.

Technical Requirements:
1. Native HTML5 Drag and Drop API:
   - Make page canvas cards draggable with visual dragover indicators (border-left/border-right insertion markers).
   - Smoothly update page order in the internal array on drop without layout flickering.
2. Mobile Touch Reordering Engine:
   - Attach touchstart, touchmove, and touchend handlers with distance thresholds to distinguish scrolling from dragging.
   - Display a floating ghost preview canvas following the user's touch coordinates.
3. Keyboard Accessible Reordering:
   - Add step-by-step "Move Left" and "Move Right" action buttons on each card with disabled states at array boundaries.
4. Batch Manipulation Controls:
   - Multi-select checkboxes with "Select All", "Deselect", and "Invert" buttons.
   - Batch 90° Clockwise and Counter-Clockwise rotation.
   - Sequence inversion (Reverse document page order).
   - Batch delete with an interactive "Undo" toast notification system.
5. Conclude response with: "✅ Milestone 3 Complete! Reply with 'continue' to proceed to Milestone 4."

Description: Milestone 3 delivers the signature interactive capabilities of the studio. It introduces dual-mode reordering (HTML5 desktop drag-and-drop plus mobile touch gestures), keyboard accessible navigation, and high-productivity batch controls for multi-page rotations, deletions, and reversals.

Level 4: Expert - Dual-Mode Inspector, Document Splitting, and Cryptographic Telemetry

ROLE: Senior Security and Frontend Architect.
PROMPT:
Continue to Milestone 4 of "Zero-Upload PDF Studio & Page Reorder".
Implement the Page Inspector with dual Canvas 2D and Native PDF modes, document splitting sub-routines, and the zero-egress cryptographic audit monitor.

Technical Requirements:
1. High-Resolution Page Inspector Modal:
   - Render pages at 2x scale on an enlarged Canvas 2D viewport.
   - Add "Switch to Native PDF View" toggle that compiles an ephemeral single-page PDF Blob and mounts it inside a sandboxed <iframe>, allowing users to inspect the exact vector document via their browser's built-in PDF reader.
   - In-modal quick controls for page duplication and orientation flipping.
2. Document Split Modal:
   - Sub-workflow 1: "Extract Selected Pages Only" into a new isolated document.
   - Sub-workflow 2: "Explode Into Individual Pages" triggering sequential single-page downloads.
   - Sub-workflow 3: "Split Document in Half" dividing pages at the exact midpoint into Part 1 and Part 2.
3. Zero-Upload Security Telemetry Engine:
   - Monitored network interceptors monkey-patching window.fetch and window.XMLHttpRequest to mathematically verify zero remote transmissions.
   - Client-side SHA-256 calculation via crypto.subtle.digest() updating dynamically as pages are reordered.
   - Live telemetry card displaying memory allocation, active page count, and digest hash.
4. Conclude response with: "✅ Milestone 4 Complete! Reply with 'continue' to proceed to Milestone 5."

Description: Milestone 4 adds enterprise-grade inspection, advanced extraction workflows, and provable cryptographic security. It provides deep zoom inspection with dual Canvas and Native PDF viewing modes, multiple document splitting patterns, and an active network monitor proving zero data leaves the client sandbox.

Level 5: Remix - Procedural Audio, True-Content %PDF-1.4 Binary Compiler, and Production Sealing

ROLE: Principal Full-Stack Web Architect.
PROMPT:
Continue to Milestone 5 of "Zero-Upload PDF Studio & Page Reorder".
Deliver the finalized, fully sealed, production-hardened single-file application incorporating procedural Web Audio synthesis and the true-content binary PDF compiler.

Technical Requirements:
1. Procedural Web Audio API Sound Engine:
   - Synthesize lifelike acoustic micro-interactions without audio assets: page lift glide (220Hz-360Hz), drop thud (180Hz-80Hz), rotation blip (440Hz-660Hz), deletion sweep (300Hz-90Hz), and export fanfare arpeggio (C5-E5-G5-C6).
   - Add master mute toggle with responsive visual state indicator.
2. True-Content Pure JavaScript %PDF-1.4 Binary Compiler:
   - Never replace document content with synthetic templates. Crawl transitive object graphs (crawlQueue) from every selected /Page dictionary, preserving original /Contents streams, font descriptors, and image /XObject dictionaries byte-for-byte.
   - Remap indirect object identifiers across multiple merged documents to eliminate ID collisions.
   - Dynamically inject updated /Rotate angles and updated /Parent pointers to the new root /Pages catalog.
   - Compute byte-precise cross-reference table (xref) and trailer offsets with startxref markers.
   - Generate application/pdf Blobs and trigger instantaneous local file downloads.
3. Production Polish:
   - Full keyboard shortcuts (Ctrl+A, Delete, R, Ctrl+Z, Escape).
   - Theme toggle between Oceanic Dark Mode and High-Contrast Light Mode.
   - Add @media (prefers-reduced-motion: reduce) safety blocks.
   - Ensure zero console errors, zero warnings, and clean single-file sealing.
4. Output the complete, unabridged, single-file HTML code ready for direct deployment.

Description: Milestone 5 seals the application into a complete, standalone masterwork. It integrates mathematical audio synthesis, builds the true-content binary PDF compilation engine with transitive reference crawling, ensures full keyboard and theme accessibility, and verifies production readiness.

Advertisement / Sponsor
📢

Share This Interactive Lab

Help developers and creators discover this workspace across the web