Introduction
In many enterprise web applications—like maintenance systems, quality control apps, or internal portals—users need to view documents (PDF, DOCX, etc.) even when internet connectivity is lost.
Offline document preview enables users to access and read files that were previously downloaded, without reconnecting to the server.
In this article, we’ll explore how to implement an offline document preview system using Angular (frontend) and ASP.NET Core (backend) with a focus on PDF and DOCX files.
Why Offline Preview Matters
Offline functionality improves user experience and reliability, especially in scenarios like:
Remote sites with weak or unstable networks.
Mobile users accessing internal portals.
Industries like manufacturing, aviation, or field inspection where documents must be available 24×7.
With proper caching and synchronization, users can view their required documents even without a live connection, and the system updates automatically when online again.
Key Technologies Used
| Layer | Technology | Purpose |
|---|---|---|
| Frontend | Angular 17 | SPA for document preview |
| Backend | ASP.NET Core 8 Web API | File API and metadata management |
| Storage | IndexedDB (via Service Worker) | Local caching of files |
| File Formats | PDF, DOCX | Supported document types |
| Library | PDF.js / Docx Previewer | Rendering documents in browser |
High-Level Architecture
+-------------------+ +--------------------------+| Angular Frontend | <---> | ASP.NET Core File API ||-------------------| |--------------------------|| Service Worker | | File Storage / DB || IndexedDB Cache | | API Controller || PDF/DOCX Viewer | | Authentication Filter |+-------------------+ +--------------------------+
↑
| (Offline access via cached data)
↓
+-----------------------------+| User Browser (Cache + UI) |+-----------------------------+Technical Workflow (Flowchart)
┌───────────────────────┐
│ User Requests File │
└──────────┬────────────┘
│
▼
┌────────────────────────┐
│ Check IndexedDB Cache │
└──────────┬─────────────┘
Cache Hit │ Cache Miss
▼
┌────────────────────────┐
│ Load from Cache Offline│
└────────────────────────┘
│
▼
┌────────────────────────┐
│ Fetch from API (Online)│
└──────────┬─────────────┘
│
▼
┌────────────────────────┐
│ Store in IndexedDB │
└──────────┬─────────────┘
│
▼
┌────────────────────────┐
│ Render PDF/DOCX Viewer │
└────────────────────────┘
Step 1: Setting Up the ASP.NET Core Backend
Let’s start by building the backend API for serving document files securely.

Comments
Join the conversation! Your thoughts help the community grow.