Comments (17)
Hello @Angelk90! Thanks for reaching out.
Where is your build folder set to?
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.
Hi @andreysaf ,
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.
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.
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.
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.
I got to build by running npm run build
:
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.
@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.
@andreysaf : Let me know if you need any more information.
from webviewer-react-sample.
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.
@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.
Correct. Matt should comment on Monday.
from webviewer-react-sample.
@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.
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.
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.
@mparizeau-pdftron , @andreysaf :
from webviewer-react-sample.
You can remove this line altogether: https://github.com/Angelk90/webviewer-react-sample/blob/master/public/index.html#L23.
from webviewer-react-sample.
Closing due to inactivity
from webviewer-react-sample.
Related Issues (20)
- why do we have two refs to the webviewer ? HOT 5
- how do we assign a variable value to initialDoc? WebViwer HOT 1
- Redaction annotations created in PDFTron are black-boxed in other viewers HOT 1
- Cant download the pdf in React app after making freeText Annontation HOT 1
- GitHub Pages
- Running a local file HOT 4
- About multiple language support for editing pdf text. HOT 1
- network failure when run it on localhost HOT 2
- Sample does not work when npm run build && serve -s build HOT 1
- how to implement Generate DOCX/Word templates with JSON in React JavaScript without a WebViewer HOT 1
- Getting window is not defined HOT 1
- Not able to open large file HOT 4
- Is it possible to disable text selection and text copy from file in WebViewer? HOT 2
- Component re-renders weird when params are added to url HOT 8
- Webviewer is not loading when distribution X-Frame-Options set to DENY HOT 4
- Feature Request: WebViewer - Instance Creator - Iframe on Sharepoint HOT 5
- Typo: The initial doc's value is not capitalized to match the actual file name. HOT 2
- Why do we need to explicitly copy the lib files in the public folder? HOT 2
- Cannot find how to save cropped area in reactjs PDFTron HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webviewer-react-sample.