Questions tagged [pdfjs-dist]
92 questions
14
votes
5 answers
Additional loader for pdfjs-dist in react app?
I have the pdfjs-dist dependency in my react app and it isn't working - I'm not sure what I changed to cause this. I'm running node v14.16.1, npm v7.9.0, react 17.0.2, react-scripts 4.0.3, and pdfjs-dist 2.7.570. I'm getting the following error…

shahjahan
- 145
- 1
- 1
- 5
13
votes
6 answers
Looking for help to make npm/pdfjs-dist work with Webpack and Django
I've been trying for a few hours replacing a link-based pdf.js with an npm install of pdfjs-dist, since I noticed that my links were not meant to be used as cdns and could become unstable as described here.
I could not find much documentation on how…

Giampaolo Ferradini
- 529
- 1
- 6
- 17
11
votes
4 answers
Mozilla PDF - how to view PDFs from url in react app?
I have followed a quick tutorial on how to implement Mozilla's PDF viewer with React. I have made a codesanbox here. I would like to know if this is possible to implement with importing node module of pdfjs.
So, instead of downloading the package in…

Ludwig
- 1,401
- 13
- 62
- 125
7
votes
1 answer
Use mozilla pdf.js in create-react-app with typescript
I try to find some documentation for how to include the mozilla pdf.js into a create-react-app with typescript configured. Unfortunately I only find a lot of people who are asking the same quetion but no working solutions.
At the moment I use the…

Patrick
- 2,128
- 16
- 24
6
votes
3 answers
[TypeError: Cannot read property 'GlobalWorkerOptions' of undefined]
My version of pdfjs-dist: "pdfjs-dist": "^2.4.456"
This is import my code:
import PDFJS from 'pdfjs-dist'
import pdfjsWorker from 'pdfjs-dist/build/pdf.worker.entry'
and when I call :
PDFJS.GlobalWorkerOptions.workerSrc =…

DFX Nguyễn
- 495
- 5
- 21
5
votes
1 answer
How to add UI and toolbar to PDF.js viewer?
I'm trying to implement PDF.js on my project, but it's being harder than expected.
At the moment, I'm able to render a entire PDF inside a div, but I'm not able to render the standard toolbar viewer; you can see an example what I want at top of this…

Isaac Bosca
- 1,588
- 1
- 15
- 34
4
votes
1 answer
How to enable annotation in PDFJS viewer
I am using PDFJS and the viewer. I do however have the problem that annotation are not shown correctly like the are in the pdfs demo viewer https://mozilla.github.io/pdf.js/web/viewer.html.
Annotation correctly displayed in pdfs demo viewer:
Here…

Jørgen Rasmussen
- 1,143
- 14
- 31
4
votes
1 answer
Using pdf.js to render a PDF but it doesn't work and I don't get any error messages to help me debug the issue
I'm trying to build a Flask app where I upload pdf's and I'm working on previewing them before submitting to the back-end.
The script I'm using is as follows:
const imageUploadValidation = (function () {
"use strict";
…

Edgar Armando Negrón Rabell
- 53
- 1
- 1
- 8
4
votes
4 answers
How to import Mozilla PDF.js in Vue project?
The question is simple. How do I correctly import the PDF.js library into a Vuejs project?
The library is undefined when I log it.
See my problem in a codesandbox live here.
This is how I am trying it now: