question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

build without the generic viewer

See original GitHub issue

I just need to use the API (I want to create a custom viewer)

How to…

  • build WITHOUT the generic viewer
  • build with all dependencies
  • compatible with all browsers
  • build a worker file together with one pdf.js file where all source files are merged together
# npm install -g gulp-cli
# cd /path/to/pdfjs
# npm install
# gulp bundle

/var/www/pdfjs/node_modules/webpack/lib/webpack.js:7
const Compiler = require("./Compiler");
^^^^^
SyntaxError: Use of const in strict mode.
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/var/www/pdfjs/gulpfile.js:36:16)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

5reactions
clarkkcommented, Apr 16, 2017

What is pdf_viewer.js for? I keep getting

Uncaught (in promise) TypeError: Cannot read property 'getDirection' of undefined
    at webViewerLocalized (pdf_viewer.js:5173)

I’m trying out pageviewer because it looks more like the old version I have used

Is it not possible just to grap pdf.js, pdf_worker.js and textlayer-something and make it work like in the good old days? I don’t need the whole project

0reactions
timvandermeijcommented, Apr 17, 2017

The regressions have been fixed and the examples are working again. The steps outlined in https://github.com/mozilla/pdf.js/issues/8292#issuecomment-294376046 should make all examples work for you as well. I think most problems you decribed happened because we have been refactoring the codebase to use ES6 syntax and you uncovered something we forgot about during the refactoring.

The pageviewer/simpleviewer examples are about as easy as it gets while still having the functionality you ask for, so I don’t think there is more we can do here. Of course, if you feel improvements can be made, feel free to submit a pull request for review. Closing for now as all actionable issues seem to have been resolved.

Read more comments on GitHub >

github_iconTop Results From Across the Web

B1 not producing graphics! No current viewer, how to properly ...
During Geant4 installation, I created three directories: build , install/4.10.06.p01 , GEANT4_WORK inside the parent ${SOFTWARE}/academic/geant4 ...
Read more >
Extension methods must be defined in a non-generic static class
I'd like to know what causes the bug? But the work-around is to write a new Extension class (not nested) even in same...
Read more >
Build a Generic CSV Writer/Reader Using Reflection
In this guide, I will explain how to write a generic CSV Writer/Reader that will automatically pick data from the public properties of...
Read more >
Storing and managing build logs | Cloud Build Documentation
Select Logging > Logs Viewer role. Click Save. If your build logs are in the default Google-created Cloud Storage bucket, grant the Project...
Read more >
Getting Started
Please refer to this wiki page for information about supported browsers. Prebuilt (modern browsers). Includes the generic build of PDF.js and the viewer....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found