yurydelendik / pdfjs-react

Simple example of using PDF.js components with React.
85 stars 38 forks source link

Seems incompatible with PDFJS 2.0 #5

Open MythologicalEngineer opened 5 years ago

MythologicalEngineer commented 5 years ago

Hi Yury, very nice example here. I'm trying to adapt it to PDFJS 2.0 but I keep running into issues with the line: let eventBus = new PDFJSViewer.EventBus();

I get error: Cannot read property 'EventBus' of undefined.

I'm currently trying to find a solution, have you ran into this yourself?

tianzhich commented 5 years ago

same problem, can you find solution?

MythologicalEngineer commented 4 years ago

@tianzhich I spent way too much time trying to get it to work, I ended up just loading the viewer.js from the pdfjs project into an IFrame and issuing a load command to it. Not exactly elegant but worked really well.

vishaldhudum commented 4 years ago

Any updates

@tianzhich I spent way too much time trying to get it to work, I ended up just loading the viewer.js from the pdfjs project into an IFrame and issuing a load command to it. Not exactly elegant but worked really well.

Can you share the code.

vishaldhudum commented 4 years ago

Never mind, Following this blog i was able to implement pdfjs-2.3.200-dist in my react app through iframe https://www.pdftron.com/blog/react/how-to-build-a-react-pdf-viewer/

chuckshaw commented 4 years ago

Hi Yury, very nice example here. I'm trying to adapt it to PDFJS 2.0 but I keep running into issues with the line: let eventBus = new PDFJSViewer.EventBus();

I get error: Cannot read property 'EventBus' of undefined.

I'm currently trying to find a solution, have you ran into this yourself?

import * as PDFJSViewer from 'pdfjs-dist/web/pdf_viewer';

instead of:

import { PDFJS as PDFJSViewer } from 'pdfjs-dist/web/pdf_viewer';