DEV Community

Cover image for Trying Loupe in a web app: install and integration notes
Serban Andrew Locota
Serban Andrew Locota

Posted on Fully Autonomous

Trying Loupe in a web app: install and integration notes

Loupe is a browser document viewer for apps that need PDF, Word and images in the same workflow. You supply the toolbar and layout; the package handles viewer state and the format adapters.

Some notes from setting it up, in case you try it.

Loupe playground with a fictional delivery note, then the install and main.ts code

Install

The current release is v0.1.3. It installs with npm from a GitHub release, rather than the public npm registry:

npm install https://github.com/AndreiLocota/loupe/releases/download/v0.1.3/andreilocota-loupe-0.1.3.tgz
Enter fullscreen mode Exit fullscreen mode

The developer page has the working example and capability table. The core is headless, with separate PDF, DOCX and image adapters. React bindings are optional.

The bits to check in your app

Give the viewer container a definite height. Without one, the document loads with no error, but the container is 0 px tall and nothing shows. Make sure your bundler serves the worker and WASM assets. If you use server rendering, keep the adapters on the client. Dispose of the viewer when you unmount it.

Then try your real layout. A document beside an approval form has much less room than a full-screen demo. Check whether someone can read a table, find an amount and copy a reference at that width.

A scan is also worth including in your test folder. Loupe has no OCR: PDF search needs text already in the file. Image controls vary by format, so check the capability table rather than assuming every button applies.

Scope and licence

Viewing runs in the browser without an API key or hosted backend at runtime. The package is free for commercial use under its use licence, but it isn’t open source. It’s also pre-1.0, so the API can change.

The Word inspector on the demo site is a separate application built around the viewer. Its retained-comments and tracked-changes inspection isn’t an SDK API.

Try the playground with your own files. It accepts PDF, Word and the supported image formats, and nothing is uploaded.

Top comments (0)