Coder Social home page Coder Social logo

GitHub Pages about webviewer-react-sample HOT 17 CLOSED

Angelk90 avatar Angelk90 commented on July 23, 2024
GitHub Pages

from webviewer-react-sample.

Comments (17)

andreysaf avatar andreysaf commented on July 23, 2024

Hello @Angelk90! Thanks for reaching out.

Where is your build folder set to?
image

If it is public, looks like it is missing WebViewer lib or path folder. https://github.com/Angelk90/webviewer-react-sample/blob/master/src/App.js#L12

from webviewer-react-sample.

Angelk90 avatar Angelk90 commented on July 23, 2024

Hi @andreysaf ,

Schermata 2021-06-19 alle 21 11 15

as you can see the reference folder is docs,
so inside the docs folder I have to put the /webviewer/lib folder, right?

from webviewer-react-sample.

andreysaf avatar andreysaf commented on July 23, 2024

Yes, it should either go into static or root of docs https://github.com/Angelk90/webviewer-react-sample/tree/master/docs/static. Try both and let me know!

from webviewer-react-sample.

Angelk90 avatar Angelk90 commented on July 23, 2024

@andreysaf :

I am not able to understand what the problem is.
I tried putting the webviewer/lib folder both inside /docs and both inside /docs/static now even worse it doesn't load the site completely.

from webviewer-react-sample.

andreysaf avatar andreysaf commented on July 23, 2024

WebViewer relies on /webviewer/lib to be served statically, with a certain folder structure. I will try building react sample from master and see what happens.

from webviewer-react-sample.

andreysaf avatar andreysaf commented on July 23, 2024

I got to build by running npm run build:
image

Here is the folder structure:
image

I would recommend cloning master again, running npm run build and then copying over everything in /build into /docs and then seeing if it works.

from webviewer-react-sample.

Angelk90 avatar Angelk90 commented on July 23, 2024

@andreysaf : These are the same steps I did, for example look here: https://github.com/PDFTron/webviewer-react-sample/blob/master/public/index.html#L23

Following the structure it seems that it will never be called or am I wrong?

Can't you try to see if it works here, on the webviewer-react-sample project by creating a github page?

from webviewer-react-sample.

Angelk90 avatar Angelk90 commented on July 23, 2024

@andreysaf : Let me know if you need any more information.

from webviewer-react-sample.

andreysaf avatar andreysaf commented on July 23, 2024

image
Got it to reproduce and see the issue. It is trying to request the necessary file from the root of the URL, meanwhile, it is on a subpage.

As you can see in my URL tab, is the correct URL, meanwhile, it is trying to preload it from the incorrect one. @mparizeau-pdftron is there a way to prepend the /webviewer-react-sample/ to the fetch URL?

from webviewer-react-sample.

Angelk90 avatar Angelk90 commented on July 23, 2024

@andreysaf :
Having packaged this: "homepage": "https://pdftron.github.io/webviewer-react-sample"
If you run the command: serve -s build doesn't work for you anymore, right?

There would be uiPath but I'm not sure it's the right property.

from webviewer-react-sample.

andreysaf avatar andreysaf commented on July 23, 2024

Correct. Matt should comment on Monday.

from webviewer-react-sample.

Angelk90 avatar Angelk90 commented on July 23, 2024

@andreysaf :
This file: https://github.com/PDFTron/webviewer-react-sample/blob/master/public/index.html#L23
In lib does not exist: https://github.com/PDFTron/webviewer-react-sample/tree/gh-pages/webviewer/lib

from webviewer-react-sample.

mparizeau-pdftron avatar mparizeau-pdftron commented on July 23, 2024

The uiPath property can be used to set an explicit location of the UI's index.html file, however usually you just need to set the path option which should point to the lib folder and then WebViewer already knows where the UI html file is relative to lib.

from webviewer-react-sample.

andreysaf avatar andreysaf commented on July 23, 2024

It works now! https://pdftron.github.io/webviewer-react-sample/

useEffect(() => {
    WebViewer(
      {
        path: '/webviewer-react-sample/webviewer/lib',
        initialDoc: '/webviewer-react-sample/files/PDFTRON_about.pdf',
      },
      viewer.current,
    ).then((instance) => {

from webviewer-react-sample.

Angelk90 avatar Angelk90 commented on July 23, 2024

@mparizeau-pdftron , @andreysaf :
Schermata 2021-06-22 alle 00 09 09

from webviewer-react-sample.

andreysaf avatar andreysaf commented on July 23, 2024

You can remove this line altogether: https://github.com/Angelk90/webviewer-react-sample/blob/master/public/index.html#L23.

from webviewer-react-sample.

mparizeau-pdftron avatar mparizeau-pdftron commented on July 23, 2024

Closing due to inactivity

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.