Wrapping the default PDF.js viewer as a web component #20817
Replies: 2 comments 1 reply
-
|
Please note that we explicitly ask users not to utilize the viewer as-is, to avoid custom deployments being mistaken for the built-in Firefox PDF Viewer since that causes end-user confusion and "incorrect" bug reports against the PDF.js project; as mentioned in http://mozilla.github.io/pdf.js/getting_started/#introduction (emphasis mine):
|
Beta Was this translation helpful? Give feedback.
-
|
I created an issue in the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi PDF.js team and community 👋
While integrating PDF.js into a modern web application stack, I found that many developers struggle with embedding the full viewer in component-based frameworks (Vue, React, etc.). The official viewer works great as a standalone application, but integrating it cleanly into SPA architectures can require quite a bit of setup.
To simplify this, I created a small wrapper project called pdfjs-viewer-element that exposes the PDF.js viewer as a Web Component.
The idea is to provide a simple integration layer so developers can use the viewer like this:
Internally it loads the official viewer and manages the iframe/worker setup.
I want to emphasize that:
Repository:
https://github.com/alekswebnet/pdfjs-viewer-element
Before promoting this approach more widely, I wanted to ask the maintainers and community:
Any feedback would be very valuable. My goal is to make PDF.js easier to adopt without going against the intended usage patterns.
Thanks for the amazing project and all the work you put into it.
Beta Was this translation helpful? Give feedback.
All reactions