Coder Social home page Coder Social logo

Comments (5)

yty-agnitio avatar yty-agnitio commented on July 23, 2024 1

ok, so I managed to set up the PDFTron backend server.
But still not really clear why not to have everything in the WebViewer.js

from webviewer-react-sample.

justinjung04 avatar justinjung04 commented on July 23, 2024

ref in WebViewer.js is referring to the actual DOM element, whereas in App.js it's the instance of WebViewer class that we created.

In this sample, App.js is trying to access some variables that are defined in WebViewer.js, so it's calling the getter functions like getInstance and getElement on the class instance.

from webviewer-react-sample.

yty-agnitio avatar yty-agnitio commented on July 23, 2024

Can’t we just have the following events inside the Webviewer.js

this.webviewer.current.getElement().addEventListener('ready', this.wvReadyHandler);
this.webviewer.current.getElement().addEventListener('documentLoaded', this.wvDocumentLoadedHandler);
So we have everything in one component.

But actually what I am trying to do, is to connect the PDFTron’s backend server by adding
pdftronServer: 'http://localhost:8090/' to the options. But as a result, I am getting something wrong with rendering - the page renders itself recursively and looks really weird.

Do you know what can be wrong?

from webviewer-react-sample.

justinjung04 avatar justinjung04 commented on July 23, 2024

You can have everything in WebViewer.js. The sample was demonstrating how other components (one or more) could listen to events from WebViewer, but it's totally up to you :)

from webviewer-react-sample.

yty-agnitio avatar yty-agnitio commented on July 23, 2024

from webviewer-react-sample.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.