Hi everyone,
Currently trying to use this library to display a PDF from a URL such as this: https://firebasestorage.googleapis.com/v0/b/feeval-dev.appspot.com/o/content%2FLm5qhy9aOTIpbXtPuwTL%2FGQnpqX9voRiQYuiAAJqT%2F1EZS6tyrnqYQHDlCHTiA?alt=media&token=7106aa73-8b49-4ca7-9d98-f5936d22c9b7
This is a file stored in a 'Storage Bucket' on Google's Firebase platform.
When trying to load an image in, I get a number of errors/warning showing the console in this order:
Warning: Setting up fake worker. (pdf.js:549)
Uncaught SyntaxError: Unexpected token '<' (pdf.worker.js:1)
Error: Setting up fake worker failed: "Cannot read property 'WorkerMessageHandler' of undefined". (pdf.js:11210)
Just wondering if this might be because I'm loading the PDF through a URL maybe?
Currently on react-pdf version 4.2.0
Solved by importing the correct entry point, as shown in the sample folder.
My import statement looked like this:
import { Document, Page } from 'react-pdf';
When because i'm using webpack, it needed this instead:
import { Document, Page } from 'react-pdf/dist/entry.webpack';
Solved by importing the correct entry point, as shown in the sample folder.
My import statement looked like this:
import { Document, Page } from 'react-pdf';When because i'm using webpack, it needed this instead:
import { Document, Page } from 'react-pdf/dist/entry.webpack';
For me it works when I use this import as stated in the README file:
import { Document } from 'react-pdf/dist/esm/entry.webpack';
Most helpful comment
Solved by importing the correct entry point, as shown in the sample folder.
My import statement looked like this:
import { Document, Page } from 'react-pdf';When because i'm using webpack, it needed this instead:
import { Document, Page } from 'react-pdf/dist/entry.webpack';