https://github.com/nyxcode/svelte-pdf-viewer
(experimental) PDF viewer for svelte
https://github.com/nyxcode/svelte-pdf-viewer
Last synced: 5 months ago
JSON representation
(experimental) PDF viewer for svelte
- Host: GitHub
- URL: https://github.com/nyxcode/svelte-pdf-viewer
- Owner: NyxCode
- Created: 2022-08-06T20:06:13.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-08-13T01:05:52.000Z (over 3 years ago)
- Last Synced: 2025-02-06T11:53:23.308Z (about 1 year ago)
- Language: JavaScript
- Size: 5.89 MB
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# svelte-pdf-viewer
> :warning: very experimental - **here be dragons**
## [demo](https://svelte-pdf-viewer.nyxcode.com/)
## goals
- [ ] Fast
- [ ] Fast renders
- [ ] Smooth scrolling / zooming / panning
- [ ] Fast initial load
- [ ] SSR of PDFs
- [ ] Embeddable
- [ ] Directly embed in a svelte app
- [ ] Using ``
- [ ] Customizable
- [ ] themeable
- [ ] Extensible
- [ ] Custom annotations
- [ ] Plug-and-play renderers
## supported renderers
- [x] **Pdfium** *(using WASM through [pdfium-render](https://github.com/ajrcarey/pdfium-render))*
- [ ] **PDF.js**
## supported browsers
- [x] **Chrome**
- [x] **Firefox**
## why is it so slow?
- [x] only render visible pages
- [x] only render visible thumbnails
- [ ] only render visible parts of pages when zooming
- [x] pdfium: re-use bitmap buffer
- [x] implement rendering queue to discard outdated requests
- [x] pdfium: render asynchronous in a webworker
- [ ] pdfium: pre-load pdfium
- [x] preemptively render pages
- [x] preemptively render thumbnails
- [ ] preload PDF
- [ ] progressively load aspect ratios of pages instead of all at once
## todo
- [ ] touch gestures
- [ ] text layer
- [ ] display title or filename
- [ ] download
- [x] loading animation/indicator
- [ ] print
- [ ] rotate
- [ ] progress bar
- [ ] document details
- [ ] side-by-side view
- [ ] full-screen / presentation mode
- [ ] profiling
- [ ] publish package
- [ ] plug-and-play renderers
- [ ] make extendable
- [ ] annotations
- [ ] streamline build [^1]
- [ ] investigate render quality [^2]
- [ ] re-render if device pixel ratio changes
## bugs
- [x] thumbnails sometimes render at the wrong size
- [x] pages flicker on when zooming
- [x] Pages look blurry on high-DPI devices
[^1]: Currently, getting the thing to build is a pain due to the emscripten-generated `pdfium-js.js` and `pdfium.wasm`.
`pdfium.wasm` is duplicated, once in `src/lib/backend/` and once in `/static/assets` since vite seems to be fine with
the first one (in dev), but rollup needs the 2nd one (when building).
[^2]: Is the render quality as good as it could be? What causes the slight misalignment when zooming? Are there weird rounding errors?