Turn assignment documents, question photos, and handwritten notes into authentic, photographed-quality handwritten notebook PDFs in real time.
33 Neural Handwriting Styles · 30 Real Notebook & Assignment Sheets · PyTorch IAM-OnDB Stroke Synthesis · Instant Handwriting & Page Cloning · Optical Scan & Searchable PDF Exports
- Overview
- Key Features
- Working Application Screenshots
- Neural Stroke Synthesis & Contextual Realism Engine
- Realistic Physical Sheet & Camera Engine
- Handwriting & Page Clone Engine
- Architecture & Project Structure
- API Routes Overview
- Getting Started
- Testing & Verification
- Privacy & Security
- MIT License & Open-Source Certificates
- Author & Contact
InkScript (Assignment Studio) is a full-stack Next.js 15 web application built for students, educators, and researchers who want typed documents, question PDFs, or images converted into genuinely realistic handwritten assignment pages — or want to restyle existing handwritten notes onto authentic notebook sheets.
Unlike tools that stamp flat cursive computer fonts over bright digital white backgrounds, InkScript combines a neural vector stroke synthesis engine, continuous handwriting motor dynamics, realistic physical sheet stock rendering, and clean searchable PDF export:
- 33 Neural-Calibrated Handwriting Templates modeled with a 15-metric style profile (
lib/handwriting-analysis.ts) and IAM-OnDB PyTorch Handwriting Synthesis stroke banks (lib/neural-stroke-bank.ts,lib/neural-stroke-renderer.ts) - 30 Authentic Physical Notebook & Assignment Sheets with non-sterile matte paper reflectance, multi-scale cellulose pulp grain, subtle ruling ink bow, true-depth 2-hole/3-hole punches, metallic wire spirals, torn perforation teeth, printed
Topic / DateandPage No. / Datestamps, underlying pad slivers, and per-page asymmetric desk lighting (lib/paper-sheet-realism.ts,lib/notebook-paper.ts) - Contextual Glyph Variation & Continuous Motor Rhythm (
lib/glyph-variation.ts,lib/writing-rhythm.ts) using correlated AR(1) slant, size, spacing, and baseline waves so repeated words never look stamp-cloned - Clean Academic Content & Math Engine (
lib/content-processor.ts) stripping raw Markdown/LaTeX symbols into readable academic notation (O(log n),x²,≤,→,λ) with orphan-safe smart pagination (lib/page-fitting.ts) - Instant Handwriting & Page Clone Engine (
lib/handwriting-clone.ts,lib/handwriting-clone-browser.ts) that inpaint-cleans any uploaded notebook photo in ~200ms while preserving its real sheet grain, ruling spacing, and ink style - Searchable High-DPI PDF Exports (
lib/pdf-export.ts) embedding an aligned invisible selectable text layer underneath crisp page images
- Multi-Format Document Ingestion (
/workspace): Upload PDF (text or scanned via browser Tesseract OCR), DOCX / DOC / ODT / RTF, TXT / MD / HTML, or PNG / JPG / WEBP question photos parsed by Vision AI. - 5-Step Guided Workspace:
- Upload — Drag-and-drop file parser or paste questions directly with automatic subject, title, and target length inference.
- Questions — Select/deselect individual questions or subquestions, edit marks, filter source PDF page ranges (
1, 3-5), reorder, or arrange cleanly with AI. - Answers — Parallel streaming AI answer generation (
4xconcurrency), clean Markdown/LaTeX structuring (###,-,1., code blocks,$math$), live editing, and target word-length tuning. - Handwriting — Instant Handwriting & Page Clone uploader, Live Neural Synthesizer Lab, 33 handwriting styles, 30 real paper sheets, and deterministic page-count fitting (
Auto,Exact,Min,Max). - Preview & Export — Real-time
requestAnimationFrame-coalesced preview, editable assignment title & student details (Keep/Remove), page number position & starting index, camera/scan filters, and Searchable PDF / PNG / Print / TXT export.
- Dedicated Handwriting & Page Restyler (
/restyle): Upload photos or scanned PDFs of an existing handwritten assignment, extract/clean text inClean & structureorExact wordingmode, and re-render onto a fresh sheet, ink color, or cloned template. - 33 Handwriting Templates (
/styles): Filter across 10 academic categories, test live custom text across all 30 notebook paper templates, toggle ink presets, and star favorites. - Local Assignment Vault (
/assignments) & Settings (/settings): Automatic browserlocalStoragepersistence with search, duplicate, inline rename, direct PDF export, default preferences, and one-click storage wipe. - Custom App Icon & Dynamic Metadata: Branded InkScript mark (
public/inkscript-logo.jpg) wired into Next.js App Router icons and OpenGraph preview (app/icon.tsx,app/apple-icon.tsx,app/opengraph-image.tsx).
4K Walkthrough Video (
3840×2160, Voiceover & Subtitles):docs/videos/inkscript-linkedin-demo.mp4(62.7s, H.264 UHD + AAC stereo, ~23 MB — ready for direct GitHub hosting & LinkedIn upload).All screenshots below were captured directly from the running application (
http://localhost:3000) at1440×900in headless Chromium.
Editorial hero featuring live interactive handwritten sample tabs (Neat Student, Natural Cursive, Compact Notes) rendered onto slightly-gray register, cream 3-hole, and university assignment sheets.
Browse all 33 handwriting styles across 10 categories, enter custom preview prose, swap pen inks, switch among 30 physical paper sheets, and inspect slant/density specs.
Upload multi-format files or paste raw assignment questions; title, subject, source page count, and question marks are parsed automatically.
View Empty Upload Dropzone & Populated Extraction State
Toggle questions or nested subquestions (4(a), 4(b)), edit marks, filter source PDF pages, add manual questions, or run AI question arrangement.
Generate, edit, and regenerate structured academic answers with headings, bullet points, equations, and code blocks calibrated to marks and length.
Pick from 33 handwriting styles and 30 realistic sheet stocks, configure stroke neatness bias or open the Live Neural Lab, clone any uploaded page, and set output page-count constraints.
Matte cool-gray pad stock with realistic dark-depth punched cutouts, rim highlights, double rose margin, double header rule, and organic nib stroke shading.
Royal ballpoint blue ink (#1E4499), hand-swept light-cyan heading highlights, Q1./Ans. margin cues, circled numbers (①, ②), Page No. : 01 stamp box, subtle directional phone-photo lighting shadow, and mild page tilt.
Upload existing handwritten notebook pages or PDFs and restyle their handwriting, paper sheet, ink, header metadata, page numbers, and scan appearance in a dedicated workflow.
Saved Assignments Manager (/assignments) |
Default Preferences & Privacy (/settings) |
|---|---|
![]() |
![]() |
InkScript upgrades computer-font rendering with authentic stroke synthesis and motor biomechanics:
- PyTorch IAM-OnDB Neural Stroke Engine (
lib/neural-stroke-bank.ts,lib/neural-stroke-renderer.ts):- Synthesizes continuous pen trajectories across 94 printable ASCII characters (
33..126) with smooth Catmull-Rom / quadratic curves, natural entry/exit ligature tails, and 5 simulated pen nib types (ballpoint,fine-liner,gel,fountain,marker). - Supports interactive Stroke Neatness / Bias (
0.40–2.00) plus an optional browser ONNX synthesis studio (NeuralSynthesizerModal.tsx) backed byonnxruntime-web.
- Synthesizes continuous pen trajectories across 94 printable ASCII characters (
- Contextual Glyph Variation (
lib/glyph-variation.ts):- Assigns non-repeating structural stroke variants across frequent characters (
a, e, t, s, r, h, g, l, i, n, o, d, c, m, u, p) using adjacent glyph memory so consecutive letters (e.g.,ll,ss,tt,ee) never clone identical outlines.
- Assigns non-repeating structural stroke variants across frequent characters (
- Continuous Writing Rhythm (
lib/writing-rhythm.ts):- Correlated AR(1) motor state smoothly modulates letter height (
xHeightScale), character width, slant drift, word spacing, and micro baseline undulation across whole words and phrases rather than random per-letter jitter.
- Correlated AR(1) motor state smoothly modulates letter height (
- 15-Metric Reference Presets (
lib/handwriting-analysis.ts):- Fine Cursive Assignment (
fine-cursive-assignment) — Fine slate-navy ink (#243963),-2.6°slant, connected lowercase strokes, handwritten code indentation. - Spacious Student Handwriting (
spacious-student) — Dark blue-charcoal (#1B253A), wider rhythmic pacing,1)margin markers. - Neat Blue Assignment Notes (
neat-blue-notes) — Royal blue ink (#1E4499), cyan highlighter sweeps, circled point badges (① ② ③), andQ1./Ans.margin labels.
- Fine Cursive Assignment (
Powered by lib/paper-sheet-realism.ts, lib/notebook-paper.ts, and lib/handwriting-realism.ts:
- 30 Calibrated Real Sheet Templates (
PAPER_TEMPLATES):- Academic & Register Sheets:
University Assignment Sheet,2-Hole Punched Assignment Pad,Torn-Edge Spiral Assignment Pad,Slightly Gray Ruled Paper,Classroom A4 Ruled Register,Practical Notebook Page,Exam Answer Booklet,University Exam Bluebook - Everyday Notebooks & Pads:
Standard Ruled,Wide-Ruled Paper,College-Ruled Paper,Narrow-Ruled Paper,Light Cream Ruled,Light Blue Ruled,Loose-Leaf Binder Sheet,Spiral Notebook Page,Spiral Dot-Grid Journal,Classic Composition Notebook,Yellow Legal Pad,Cornell Notes Sheet - Technical, Vintage & IAM Sheets:
Plain White Paper(matte A4 bond),Graph Paper,Dotted Paper,Engineering Grid Pad,Millimeter Technical Sheet,Warm Vintage Sheet,Recycled Eco Paper,Textured Academic Linen,IAM Toolkit Canvas Grid,IAM Toolkit Script Sheet
- Academic & Register Sheets:
- Physical Details: Multi-scale cellulose pulp mottling, curved fiber lint threads, offset-printed ruling ink halo & gentle horizontal bow wave, dark-backed binder hole cutouts with bevel edges, metallic wire shadows, serrated spiral tear notches, sewn charcoal composition spine,
Topic / Date&Page No. / Dateforms, and subtle right-edge underlying sheet stack slivers. - 7 Camera & Scan Presets + 4 PDF Formation Modes:
- Presets:
Original Clean,CamScanner Clean,Natural Phone Photo,Flatbed Scanner PDF,B&W Photocopy (Xerox),Warm Desk Lamp,Soft Aged Print - PDF Modes:
Clean Print PDF,Scanned PDF (App Scan),Compact Portal PDF,Grayscale Scan PDF— all embedding aligned invisible searchable PDF text.
- Presets:
Located across lib/handwriting-clone.ts, lib/handwriting-clone-browser.ts, and components/HandwritingClonePanel.tsx:
- Instant Client-Side Pixel Analysis (~200ms):
- Samples genuine ink hex, stroke weight, estimated character scale, left margin rule offset, and horizontal ruling pitch, while normalizing dim camera paper safely (
normalizeCleanPaperHex). - Runs
inpaintInkFromPagePixelsto cleanly remove old handwriting, page boxes, and cyan/yellow highlighter strokes while keeping the original notebook lines and fiber grain intact.
- Samples genuine ink hex, stroke weight, estimated character scale, left margin rule offset, and horizontal ruling pitch, while normalizing dim camera paper safely (
- Non-Blocking Vision AI Refinement:
- Optionally refines slant angle, join style, and academic cues via
/api/nvidia/analyze-handwriting-clonewithout ever stalling user interaction.
- Optionally refines slant angle, join style, and academic cues via
- Two Seamless Modes:
- Exact uploaded page: Writes your generated assignment onto your cleaned photographed page aligned directly with its original rulings.
- Same page style: Applies extracted ink color, slant, scale, and matched ruled paper cleanly across unlimited pages.
├── app/
│ ├── api/
│ │ ├── documents/parse/ # In-memory PDF (unpdf), DOCX (mammoth), TXT/HTML/RTF parser
│ │ └── nvidia/ # Server-side AI routes (generate, analyze-questions, read-image,
│ │ # analyze-handwriting-clone, restyle-handwriting, models)
│ ├── assignments/ # Saved browser drafts manager
│ ├── restyle/ # Handwriting & Page Restyler route
│ ├── settings/ # Default formatting & privacy controls
│ ├── styles/ # 33-style Handwriting & 30-sheet Library
│ ├── workspace/ # 5-step Assignment Workspace
│ ├── icon.tsx / apple-icon.tsx # Branded InkScript favicon & Apple touch icon
│ ├── opengraph-image.tsx # Dynamic OpenGraph social share card
│ ├── layout.tsx # Root layout loading 21 SIL OFL handwriting font families
│ └── page.tsx # Landing showcase
├── components/
│ ├── HandwritingClonePanel.tsx # Upload & instant pixel-clean cloning UI
│ ├── HandwrittenSamplePreview.tsx # Lazy IntersectionObserver canvas preview renderer
│ ├── HeroNotebookShowcase.tsx # Interactive landing sheet switcher
│ ├── NeuralSynthesizerModal.tsx # Live ONNX/IAM Neural Stroke Lab modal
│ ├── TopNav.tsx / Footer.tsx # Navigation + interactive About/Privacy/Terms/Help modals
│ ├── restyler/ # Restyler interactive client UI
│ └── workspace/ # StepUpload, StepQuestions, StepAnswers, StepHandwriting, StepPreview
├── docs/screenshots/ # Verified application screenshots (1440×900)
├── lib/
│ ├── content-processor.ts # Markdown & LaTeX cleanup into clean academic notation
│ ├── glyph-variation.ts # Contextual glyph variants with consecutive-repeat prevention
│ ├── handwriting-analysis.ts # 15-metric style analysis + reference presets
│ ├── handwriting-clone.ts # Pixel analysis, ink/highlighter inpainting & clone resolver
│ ├── handwriting-clone-browser.ts # Non-blocking browser canvas clone pipeline
│ ├── handwriting-realism.ts # Line drift, mistakes/cuts, page folds, camera filters & PDF profiles
│ ├── handwriting-renderer.ts # Core HTML5 Canvas realistic handwriting & ink halo renderer
│ ├── model-selection.ts # Dynamic Vision & LLM model ranking/fallback chain
│ ├── neural-stroke-bank.ts # 94-glyph IAM-OnDB vector trajectory stroke bank
│ ├── neural-stroke-renderer.ts # Continuous pen curve & nib pressure renderer
│ ├── notebook-paper.ts # Cellulose texture, offset rulings, punches, spirals & lighting
│ ├── page-fitting.ts # Orphan-safe pagination & page-count constraint solver
│ ├── page-numbering.ts # Keep/remove & custom starting page numbers
│ ├── paper-sheet-realism.ts # Asymmetric lighting, pad stack slivers & binder hole physics
│ ├── pdf-export.ts # Searchable jsPDF (invisible text layer), PNG, TXT & print export
│ ├── question-parser.ts # Structured question/subquestion/marks extraction
│ ├── restyler-utils.ts # OCR cleanup & Markdown block builder for Restyler
│ ├── storage.ts # Client-side localStorage persistence & preferences
│ ├── templates.ts # 33 handwriting templates & 30 realistic notebook paper definitions
│ └── writing-rhythm.ts # Correlated AR(1) slant, baseline & spacing motor engine
├── public/
│ ├── inkscript-logo.jpg # Brand logo & icon mark
│ ├── models/ / ort/ # Client-side ONNX synthesis weights & WASM runtime assets
│ └── assets/aistudio/ # Reference handwritten assignment pages
├── LICENSE # MIT License
└── .env.example # Environment variable template
| Endpoint | Method | Purpose |
|---|---|---|
/api/documents/parse |
POST |
Parses uploaded PDF, DOCX, DOC, ODT, RTF, TXT, MD, or HTML in memory and flags scanned pages for client OCR |
/api/nvidia/analyze-questions |
POST |
Structures extracted assignment text into numbered questions, subquestions, marks, and context |
/api/nvidia/generate |
POST |
Streams academic answers via Server-Sent Events (SSE) with automatic model fallback and <think> tag filtering |
/api/nvidia/read-image |
POST |
Vision AI transcription for uploaded question images or handwritten assignments |
/api/nvidia/analyze-handwriting-clone |
POST |
Vision AI style estimation (slant, cursive join style, heading style, question numbering) for cloned sheets |
/api/nvidia/restyle-handwriting |
POST |
Cleans and structures raw handwritten OCR transcripts in Clean & structure or Exact wording mode |
/api/nvidia/models |
GET |
Lists and ranks healthy chat & vision models |
- Node.js 20+ and npm
npm installCopy .env.example to .env.local and supply your server-side API keys (never commit .env.local or expose secrets with NEXT_PUBLIC_):
cp .env.example .env.localRelevant environment variables defined in .env.example:
NVIDIA_API_KEY— Server-side API key used by/api/nvidia/*routes for streaming answer generation, question analysis, and Vision OCR.GEMINI_API_KEY— Server-side Gemini API key (configured via runtime environment secrets).APP_URL— Public deployment URL used for self-referential metadata/OpenGraph links.
npm run devOpen http://localhost:3000 in your browser.
npm run build
npm run startInkScript includes 47 automated unit tests (node:test via tsx) covering contextual glyph variation, continuous AR(1) motor rhythm, neural stroke rendering, clean Markdown/LaTeX processing, physical paper reflectance & lighting, pixel inpainting, margin drift, strike-cut planning, fold variation, camera/PDF profiles, question parsing, model fallback logic, page numbering, searchable PDF generation, and orphan-safe pagination:
# Run all 47 unit tests
npx --yes tsx --test lib/*.test.ts
# Run ESLint validation
npm run lint
# Verify production build
npm run build- Uploaded PDFs, DOCX files, and images are processed strictly in server memory during the active request and discarded immediately afterward.
- API keys (
NVIDIA_API_KEY,GEMINI_API_KEY) remain strictly server-side and are never transmitted to browser code. - Draft assignments and user preferences stay inside the user's browser
localStorageand can be cleared anytime from/settings.
================================================================================
OPEN SOURCE LICENSE CERTIFICATE
================================================================================
Software : InkScript — AI Assignment to Handwriting Studio
License Type : MIT License (SPDX: MIT)
Copyright Year : 2026
Copyright Holder: Rehan Ahmad (rehan515ahmad@gmail.com | @reyhanamd)
Status : Approved Open Source Initiative (OSI) Permissive License
================================================================================
This software is released under the MIT License — see the LICENSE file for the complete legal text:
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- Handwriting Synthesis Architecture Credit (MIT License):
Neural stroke trajectory modeling and IAM-OnDB calibration inspired by
X-rayLaser/pytorch-handwriting-synthesis-toolkit(MIT License). - Handwriting Typography (SIL Open Font License 1.1 — OFL):
All 21 handwriting font families loaded via
next/font/googleinapp/layout.tsx(Caveat,Patrick Hand,Kalam,Indie Flower,Shadows Into Light,Architects Daughter,Gloria Hallelujah,Homemade Apple,Reenie Beanie,Satisfy,Handlee,Sedgwick Ave,Edu NSW ACT Foundation,Bad Script,Coming Soon,Dancing Script,Just Another Hand,Covered By Your Grace,Nothing You Could Do,Mali,Courgette) alongside UI fonts (Plus Jakarta Sans,DM Sans,JetBrains Mono) are licensed under the SIL Open Font License, Version 1.1, certifying free commercial, personal, and academic PDF embedding. - Core Open-Source Packages:
Next.js,React,Tailwind CSS,Motion,jsPDF,pdfjs-dist,unpdf,onnxruntime-web— MIT / Apache-2.0Tesseract.js— Apache-2.0Lucide React— ISCMammoth— BSD-2-Clause
- Author: Rehan Ahmad
- Email: rehan515ahmad@gmail.com
- GitHub: @reyhanamd











