Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vaporware #65

Open
brandonros opened this issue Oct 24, 2017 · 3 comments
Open

Vaporware #65

brandonros opened this issue Oct 24, 2017 · 3 comments

Comments

@brandonros
Copy link

Nothing more frustrating than spending a day trying to drop packages into your project that are supposed to be plug and play and they don't work so you start spiraling down a list of alternatives trying anything hoping something will work, only to still be bombing out on your fourth attempt.

pdf.js:17939 Uncaught (in promise) TypeError: Cannot read property 'firstElementChild' of null
    at new PDFViewer (pdf.js:17939)
    at pdf.js:12985
    at new Promise (<anonymous>)
    at Object._initializeViewerComponents (pdf.js:12973)
    at pdf.js:12884
    at <anonymous>

Template: <pdfjs-viewer data="ctrl.pdfData"></pdfjs-viewer>

Controller: ctrl.pdfData = new Uint8Array(UtilitiesService.generatePdfTable(categoryColumns, results, pdfTableOptions, pdfFilename, 'data'));

Total garbage. Not sure if it is your package or pdf.js but Jesus Christ is this frustrating.

@brandonros
Copy link
Author

Mild progress as I continue to have to dump time into this "plug and play" package:

function PDFViewer(options) {
  this.container = options.container;
  this.viewer = options.viewer || options.container.firstElementChild;
var container = appConfig.mainContainer;
   var viewer = appConfig.viewerContainer;
   self.pdfViewer = new PDFViewer({
    container: container,

legalthings/pdf.js-viewer#23

@DiV666
Copy link

DiV666 commented Dec 28, 2017

Hi,

This happens because the DOM is not ready when the window.PDFJS.webViewerLoad() function is called;

To make a quick fix, I've wrapped that function and everything that follows in a $timeout:

$timeout(function () {
    window.PDFJS.webViewerLoad();

    function onPdfInit() {
        ...
}, 0);

@psyklopz
Copy link

I also am unable to figure out a solution and need to move on to another project. It's a shame, this looked like the best fit. I'm eagerly awaiting a fix for this, and I'll be switching back when that's available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants