bundled-es-modules / pdfjs-dist Goto Github PK
View Code? Open in Web Editor NEWThis is a mirror of pdfjs-dist, bundled and exposed as an ES module
License: Apache License 2.0
This is a mirror of pdfjs-dist, bundled and exposed as an ES module
License: Apache License 2.0
This repo is currently behind the latest version of pdfjs-dist by several minor versions: v2.5.207 vs. current v2.13.216. We should update to the latest version of pdfjs-dist and other dependencies; hopefully in doing so, things are ironed out so that upgrades are just a matter of running npm run build
.
I attempted to just update pdfjs-dist to the latest, but this gave an error during the build step due to optional chaining not supported in the older v1.x version of Rollup. I then updated rollup and all other dev depdencies (see package.json), but am getting this other error now:
./src/core/pdf.js โ ./build/pdf.js...
[!] (plugin at position 5) SyntaxError: Unexpected token (1376:26) in pdfjs-dist\node_modules\pdfjs-dist\build\pdf.js
SyntaxError: Unexpected token (1376:26) in pdfjs-dist\node_modules\pdfjs-dist\build\pdf.js
at Parser.pp$4.raise (pdfjs-dist\node_modules\acorn\dist\acorn.js:2757:13)
at Parser.pp.unexpected (pdfjs-dist\node_modules\acorn\dist\acorn.js:647:8)
at Parser.pp$3.parseExprAtom (pdfjs-dist\node_modules\acorn\dist\acorn.js:2196:10)
at Parser.pp$3.parseExprSubscripts (pdfjs-dist\node_modules\acorn\dist\acorn.js:2047:19)
at Parser.pp$3.parseMaybeUnary (pdfjs-dist\node_modules\acorn\dist\acorn.js:2024:17)
at Parser.pp$3.parseExprOps (pdfjs-dist\node_modules\acorn\dist\acorn.js:1966:19)
at Parser.pp$3.parseMaybeConditional (pdfjs-dist\node_modules\acorn\dist\acorn.js:1949:19)
at Parser.pp$3.parseMaybeAssign (pdfjs-dist\node_modules\acorn\dist\acorn.js:1925:19)
at Parser.pp$3.parseMaybeConditional (pdfjs-dist\node_modules\acorn\dist\acorn.js:1954:28)
at Parser.pp$3.parseMaybeAssign (pdfjs-dist\node_modules\acorn\dist\acorn.js:1925:19)
I suspect it's some incompatibility with a plugin, but I'm new to rollup, so don't know where to begin in troubleshooting this. The fork I'm working with is here: https://github.com/Lukenickerson/pdfjs-dist
Need automated tests pretty badly
Using latest stencil.js to create webcomponent for rendering pdf document unsuccessful, Rollup is unable to pack:
[ ERROR ] Rollup: Plugin Error: ../../../node_modules/@bundled-es-modules/pdfjs-dist/build/pdf.js:15011:3
Unexpected token (15011:3) in
/[...redacted..]/node_modules/@bundled-es-modules/pdfjs-dist/build/pdf.js (plugin:
commonjs, transform)
L15010: }
L15011: return success;
L15012: }
I'm trying to use (a customised version of) the viewer application as mentioned here. However, I think that the current build is missing exports for:
PDFViewerApplication
PDFViewerApplicationOptions
getViewerConfiguration()
webViewerLoad()
which are also from https://github.com/mozilla/pdf.js/blob/master/web/viewer.js. I'm a noob when it comes to JS packaging so if I have got hold of the wrong end of the stick a hint as to how to get to those objects would be most welcome. (I have managed to get hold of, for example, PDFViewer
).
pdfjs-dist published v2.2.228 back in July. need to investigate
Can we update pdf.js, including the viewer, to a latest version? This would solve some problems with IE11 especially related to Symbol.iterator
used in current bundle.
See vaadin/vaadin-pdf-viewer#23 (comment) for details.
It throws an error SyntaxError: Unexpected token export.
I have an error using browserify babelify
"browserify": "16.3.0",
"@babel/core": "7.10.4",
"@babel/polyfill": "7.10.4",
"@babel/preset-env": "7.10.4",
And I'm having the following error
Error: Parsing file XXX/node_modules/@bundled-es-modules/pdfjs-dist/build/pdf.js: 'import' and 'export' may appear only with 'sourceType: module' (27612:0)
I'm able to fix this changing last line of build/pdf.js
from export default pdf_1;
to module.exports = pdf_1;
Any change of changing this?
I use below code to create PDFThumbnailViewer object,
import PDFViewer from "@bundled-es-modules/pdfjs-dist/web/pdf_viewer"; let pdfThumbnailViewer = new PDFViewer.PDFThumbnailViewer({ container: this.thumbnailView, renderingQueue: this.pdfViewer.renderingQueue, linkService: this.pdfLinkService });
At runtime , exception throw
Unhandled Promise rejection: Uncaught (in promise): TypeError: bundled_es_modules_pdfjs_dist_web_pdf_viewer__WEBPACK_IMPORTED_MODULE_2_.default.PDFThumbnailViewer is not a constructor
TypeError: bundled_es_modules_pdfjs_dist_web_pdf_viewer__WEBPACK_IMPORTED_MODULE_2_.default.PDFThumbnailViewer is not a
constructor
Look inside file "https://github.com/bundled-es-modules/pdfjs-dist/blob/master/web/module.js", I don't see the implement for class PDFThumbnailViewer. The original for class PDFThumbnailViewer at https://github.com/mozilla/pdf.js/blob/master/web/pdf_thumbnail_viewer.js
Do you guys have any plans for this?
I was using the OG pdfjs-dist but had some issues with Vite, so I switched to this one. However, there seems to be something off because now I'm getting ReferenceError: document is not defined
error when I try to load PDF as ArrayBuffer with pdfjs.getDocument({ data: pdfData, disableAutoFetch: true })
.
Line 19231 in 597a62c
You run into this rollup/rollup#2326
The final build is missing an if condition, but the if body still exists and throws always.
To solve this simply update the used rollup version to 1.11.3
Hi, we have been evaluating this project to get ES module version of pdf.js
in order to make a web component wrapper for it. So I would like to request a build for pdf-viewer.js
(currently missing).
I'm going to try updating the Rollup config to make this happen, and then submit a PR.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.