Skip to content

BaseMax/online-docx-viewer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

📄 DOCX Viewer (Online & Offline Word File Viewer)

A fast, privacy-focused .docx / .doc viewer that runs entirely in the browser. No uploads. No servers. Fully client-side.

👉 Live / Repo:

https://basemax.github.io/online-docx-viewer


✨ Features

  • 📂 Drag & drop or browse files
  • 📄 Supports .docx and .doc
  • 🔒 100% offline-first your files never leave your device
  • ⚡ Fast rendering using mammoth.js
  • 📑 Automatic pagination
  • 🔍 Zoom controls (50% → 250%)
  • ⌨️ Keyboard navigation (← → PgUp PgDown Home End)
  • 🖨️ Print / Export to PDF
  • 📱 Fully responsive UI
  • 🌐 Service Worker caching (PWA-ready)

🚀 Demo

Open index.html directly in your browser no build step required.


📦 Tech Stack

  • Vanilla JavaScript (no framework)
  • Service Worker (offline caching)
  • mammoth.js for DOCX parsing
  • Pure CSS (no dependencies)

📁 Project Structure

.
├── index.html      # Main UI + logic
├── sw.js           # Service Worker (offline support)
└── README.md

⚙️ How It Works

DOCX

  • Parsed using mammoth.js
  • Converted to clean HTML
  • Paginated based on content size

DOC (Legacy)

  • Attempted via mammoth (limited support)
  • Fallback: plain text extraction

Offline Mode

  • index.html cached on install
  • mammoth.js cached on first load
  • Works offline after first visit

🧠 Key Design Decisions

  • No backend → zero privacy risk
  • HTML-based rendering → selectable text, accessible
  • Pagination heuristic → balances readability and performance
  • Graceful fallback for .doc instead of failure

⌨️ Keyboard Shortcuts

Key Action
→ / PageDown Next page
← / PageUp Previous page
Home First page
End Last page
Ctrl/Cmd + + Zoom in
Ctrl/Cmd + - Zoom out
Ctrl/Cmd + 0 Reset zoom
Ctrl/Cmd + P Print / PDF

⚠️ Limitations

  • .doc support is best-effort only

  • Complex Word features may not fully render:

    • Advanced layouts
    • Embedded objects
    • Some tables/styles
  • Pagination is approximate (not true Word layout engine)


📌 Roadmap Ideas

  • Better .doc parsing
  • Search in the document
  • Dark mode
  • Highlight / annotations
  • Multi-file tabs
  • Drag multiple files

🛠️ Development

No setup required:

git clone https://github.com/BaseMax/online-docx-viewer.git
cd online-docx-viewer
open index.html

For proper Service Worker behavior, use a local server:

npx serve
# or
python -m http.server

🔐 Privacy

  • Files are never uploaded
  • All processing happens in-browser
  • No analytics, no tracking

📜 License

MIT License © 2026

Seyyed Ali Mohammadiyeh (Max Base)

About

A fast, privacy-focused .docx / .doc viewer that runs entirely in the browser. No uploads. No servers. Fully client-side.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors