Skip to content

Getting started ​

Open a diagram locally, understand the current limits, and embed the same viewer in your application.

Initial viewer support, not Visio certification

This is a public beta. Do not use a successful file open as evidence that every shape, formula or format feature is represented faithfully. See the capability ledger.

Try the local playground ​

  1. Open the playground to see an original sample document.
  2. Choose a local .vsdx file using the file picker or drop area.
  3. Switch pages, adjust zoom, fit the page and select a shape.
  4. Review compatibility notes. Compare important files with their Microsoft Visio rendering.

No document upload is performed. The controls support search, display layers, experimental plain-text editing, bounded undo/redo, SVG export and explicit VSDX-copy downloads. Print snapshots are API-only preparation. File > Export can create a picture-page PDF, but vector or text-selectable PDF output, general drawing and most legacy binary .vsd features are outside this build.

The other framework builds of the same playground are listed on the demos page.

Install a framework package ​

Install one viewer package for your framework. Each includes the shared viewer, its adapter, workers and document API.

bash
npm install visio-react-viewer react
bash
npm install visio-vue-viewer vue
bash
npm install visio-angular-viewer
bash
npm install visio-svelte-viewer svelte
bash
npm install visio-solid-viewer solid-js
bash
npm install visio-vanilla-viewer
FrameworkPackageExport
Vanillavisio-vanilla-viewermountViewer
Reactvisio-react-viewerVisioViewer
Vue 3visio-vue-viewerVisioViewer
Angularvisio-angular-viewerVisioViewerComponent
Svelte 5visio-svelte-viewerdefault VisioViewer
Solidvisio-solid-viewerVisioViewer

All six adapters forward the same controller, properties, events and imperative handle through the shared viewer. See the framework guides and the binding contract.

Mount a viewer ​

The container must have a height. A browser File, Blob, Uint8Array or ArrayBuffer can be passed to load.

ts
import { mountViewer } from 'visio-vanilla-viewer';

const viewer = mountViewer(host, {
	events: { 'shape-select': (shape) => console.log(shape) },
});

await viewer.load(file); // A local File or bytes
viewer.fit();

// When your view unmounts:
viewer.destroy();

Run the development workspace ​

The viewer is part of the ooxml monorepo, a Bun workspace. Install once at the repository root with bun install; ooxml-core (src/core/visio) and ooxml-ui (src/ui/src/visio) resolve to the packages in the same checkout, so no linking step is needed.

bash
bun install
cd viewers/visio
bun run check
bun run dev

Use the local URL printed by Vite. This starts a development server; it does not publish the site.

Experimental plain-text editing ​

Load a local source package, select a supported shape, and use its text controls. replacePlainText(pageId, shapeId, text), undo() and redo() expose the same operations through each handle. A model assigned with document has no package bytes and stays read-only.

Editing rejects master-linked text, rich text, fields, signed packages and macro content. History is bounded and can discard old undo states. Saved formula caches are not recalculated. Shape formatting, geometry and drawing commands have their own limits, listed in the viewer API.

exportVsdx() returns original or edited package bytes and diagnostics for an explicit copy download. It never overwrites the input file. Native Visio reopening is verified only for the recorded cases in the verification record, and lossless round-trip fidelity remains unverified.

Export a static SVG ​

viewer.exportSvg() returns the current page's SVG string, dimensions, byte length and compatibility diagnostics. It leaves selection, zoom and the source document unchanged. The playground's Export SVG button performs an explicit local download.

Supported background content and validated raster images are embedded. Fonts are not embedded; wrapping and other approximations remain visible in the SVG description and metadata. Export is limited to 16 MiB, with conservative early resource checks. Callers can lower the limit with { maxBytes }. This is not editable VSDX output. Downstream rasterizers must independently cap dimensions and pixel area.

Prepare page snapshots ​

createPrintSnapshot() returns immutable SVG page artifacts and diagnostics through the API. It preserves drawing dimensions but does not apply native printer settings, open a print dialog or implement PDF export. This prepares data for a future print workflow.

Properties and events ​

SurfaceCurrent contract
Propertiesdocument, pageIndex, zoom, showToolbar, canEdit, readOnly, locale, ribbonAddIns, collaboration, storage, fileProviders, customization
Eventsdocument-load, document-change, document-error, page-change, zoom-change, shape-select, selection-change, office-ribbon-add-in, collaboration-change, file-command
Lifecycleupdate, load, fit, exportSvg, createPrintSnapshot, replacePlainText, undo, redo, cancelEdit, exportVsdx, destroy

canEdit is the editing permission (editable by default in the viewer; false is read-only), collaboration shares the open drawing in a room, and document-change reports kind edit, undo, redo, remote or save. After the host has persisted the bytes from exportVsdx(), controller.markClean() clears the dirty flag. To compose your own UI from the viewer's parts see the building blocks, and to share a drawing see collaboration.

Mount after the host exists and call destroy() when the framework view unmounts. Repeated destruction is safe. Partial updates leave omitted properties unchanged. The full reference is the viewer API.

Verification before adoption ​

Run bun run check and bun run test:browser in viewers/visio. Core parser tests live with the engine in src/core/visio (run them with the repository's bun run test). These checks establish only their asserted behavior; they do not establish Microsoft Visio visual parity.

Released under the Apache-2.0 License.