pdf.js with react和django
我试图使用react.js作为前端的django框架来开发PDF查看器
。工作。
我认为问题在于路径,谨此提出一种方法和步骤正确执行此操作
I'am trying to develope a pdf viewer with Django framework using React.js as Frontend
The problem is that the pdfviewer works perfectly on react project, but when I build it (npm run build) and copy it to the django project it doesn't work.
I think that the problems is with paths, care to suggest a method and steps to do that correctly
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,问题出在路径上。
以下是我为使其发挥作用而遵循的步骤。
1- 将文件夹“pdfjs.2.0”复制到“static/js”
2- 将文件夹“pdfjs.2.0/build”的所有文件复制到“pdfjs2.0/web”
3- 打开文件“pdfjs2.0/” web/viewer.html”并修改第36行
这是修改后的行
4-打开文件“pdfjs2.0/web/viewer.js”并修改第229行
这是修改后的行值
:“./pdf.worker.js”
Yes, the problem was in the paths.
Here are the steps that I have followed to make it work.
1- copy the folder "pdfjs.2.0" into "static/js"
2- copy all the files of the folder "pdfjs.2.0/build" into "pdfjs2.0/web"
3- open the file "pdfjs2.0/web/viewer.html" and modify the line 36
Here is the line after modification
4-open the file "pdfjs2.0/web/viewer.js" and modify the line 229
Here is the line after the modification
Value : "./pdf.worker.js"
设置.py
settings.py