Skip to content
 
 

Latest commit

 

History

53 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

web-doc

Any document. One canvas.

Releases · Upstream website · Live React demo · Documentation

web-doc is a framework-agnostic, browser-side document viewer with a TypeScript API and lazily loaded Rust/WASM adapters. It renders modern Office, qualified Word 97–2003 DOC and legacy XLS/PPT, PDF, images, SVG and delimited data without uploading documents to a conversion service.

About this fork

web-doc is a fork of Zrimo (@zrimo/viewer), maintained by @leonidkuznetsov18 and released independently under its own name. It carries changes that are proposed upstream but are needed before they land there — currently page-scoped search (SearchOptions.pageRange) and an approximate page hint with a fuzzy fallback (SearchOptions.nearPage / fuzzy, see the API reference). Everything else, including the upstream documentation, applies unchanged.

  • The package is web-doc on npm; @zrimo/viewer on npmjs.com is the upstream package and does not contain this fork's changes. Switching between the two is the dependency name and the import specifier — the runtime API, the CSS hooks (.zrimo-ui, --zrimo-*, data-zrimo-*) and the asset layout are identical.
  • Releases are automatic. Every merge to main produces a semantic version, a changelog entry, a GitHub release with the verified tarball, and an npm publication (see Commits and releases).

Supported formats

  • DOCX/DOCM, XLSX/XLSM, PPTX/PPTM/PPSX
  • Word 97–2003 DOC through the project-owned bounded Word Binary parser and in-memory DOCX serialization
  • BIFF8 XLS through bounded in-memory normalization with source-backed styles, sheet geometry, merges and safe hyperlinks; PPT through in-memory OOXML normalization
  • PDF
  • PNG, JPEG, WebP, GIF, BMP and multi-page TIFF
  • SVG, CSV and TSV

The viewer supports Latin/Cyrillic, CJK, Arabic-script and the agreed Indic scripts through application/system fonts plus lazy self-hosted Noto WOFF2 packs. Macros and document scripts never execute; spreadsheet formulas display stored cached values.

Install and quick start

npm install web-doc
npx web-doc-copy-assets public/vendor/zrimo

Every GitHub release also attaches the same tarball (web-doc-x.y.z.tgz) with SHA256SUMS and pack-report.json, so a build can be pinned by URL or verified before it is adopted. The second command copies workers, WASM modules and optional font assets into your application's public directory.

import { ViewerClient } from "web-doc";
import "web-doc/styles.css";

const client = ViewerClient.create({
  assetBaseUrl: new URL("/vendor/zrimo/", location.href),
});
const viewer = client.createViewer({
  container: document.querySelector("#viewer")!,
  ui: true,
  fit: "width",
});

await viewer.load(file, { fileName: file.name });
// Later:
await viewer.destroy();
await client.destroy();

Use web-doc/headless for UI-free integration and web-doc/worker for custom adapter infrastructure. The getting-started guide covers CDN/self-host layouts and MIME requirements.

Browser and privacy baseline

The target is Safari 16.4+ and the latest two stable Chrome, Edge, Firefox and Safari versions. Automated lifecycle/fallback scenarios run in Playwright Chromium, Firefox and WebKit; real-browser smoke is mandatory before a stable release.

Documents remain in the browser. There is no telemetry, server conversion or implicit external relationship fetch. Network traffic is limited to an explicit URL source and package/application-owned assets selected by the font and assetBaseUrl policies.

Develop and verify

Prerequisites are Node.js 22.13+ or 24+, npm 11, Rust 1.94.1 with wasm32-unknown-unknown, Chromium, and Rust nightly/cargo-fuzz only for the fuzz gate.

npm ci
npm run build
npm run check
npm run test:qualification
npm run test:e2e
npm run test:e2e:matrix
npm run test:pack

Release/security gates additionally include npm run fuzz:js, npm run fuzz:rust, npm run audit:vulnerabilities, npm run report:size, and npm run report:sbom.

Run either development example from the workspace root:

npm run dev --workspace @zrimo/example-vanilla
npm run dev --workspace @zrimo/example-react

Build and inspect the complete site — landing, documentation and the production React demo — locally:

npm run pages:build
npm run pages:preview
# open http://127.0.0.1:4174

Documentation

Built on open source

Zrimo stands on the work of excellent open-source projects. Thank you to every maintainer and contributor who made these building blocks available.

Project License How Zrimo uses it
Office Open XML Viewer (@silurus/ooxml) MIT Rust/WASM parsing and Canvas rendering for DOCX, XLSX and PPTX.
office_oxide MIT OR Apache-2.0 Compound-file handling, shared Office IR/writer utilities and browser-side legacy XLS/PPT conversion. Zrimo's Word Binary parser remains project-owned.
Mozilla PDF.js Apache-2.0 PDF parsing, font/CMap handling, Canvas rendering, links and selectable text.
@napi-rs/canvas MIT Optional Node canvas backend pulled by PDF.js; it is not used or bundled by Zrimo's browser runtime.
image and tiff MIT OR Apache-2.0 / MIT Multi-page TIFF decoding and PNG output inside the image WASM adapter.
wasm-bindgen MIT OR Apache-2.0 TypeScript/JavaScript bindings for Zrimo's Rust/WASM modules.
zip MIT Bounded in-memory ZIP/OOXML package manipulation during legacy Office conversion.
Serde, serde_json and thiserror MIT OR Apache-2.0 Typed serialization and structured errors in the Rust core and worker boundary.
core-js MIT Compatibility modules embedded in the PDF.js legacy browser build used by the supported browser matrix.
Noto Sans and Noto Sans CJK SIL Open Font License 1.1 Self-hosted, lazy WOFF2 fallback packs for Latin/Cyrillic, Arabic, Indic, CJK, Japanese and Korean text.
Heroicons MIT Consistent outline icons on the project landing page.

Third-party components retain their own licenses. See THIRD_PARTY_NOTICES.md for distribution notices and the generated artifacts/sbom.spdx.json for the complete pinned transitive inventory.

License

Zrimo's original source code and documentation are dual-licensed, at your option, under the MIT License or the Apache License 2.0. Copyright (c) 2026 Zrimo contributors.

Unless explicitly stated otherwise, any contribution intentionally submitted for inclusion in Zrimo is provided under the same MIT OR Apache-2.0 terms, without additional restrictions.

About

Embeddable, browser-private document viewer for PDF, Office, images, CSV and TSV — powered by Rust, WebAssembly and TypeScript.

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages