pdf.js with react和django

发布于 2025-01-19 02:30:48 字数 90 浏览 2 评论 0原文

我试图使用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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

影子是时光的心 2025-01-26 02:30:48

是的,问题出在路径上。

以下是我为使其发挥作用而遵循的步骤。

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"

嘿嘿嘿 2025-01-26 02:30:48

设置.py

<块引用>

X_FRAME_OPTIONS = '允许'

settings.py

X_FRAME_OPTIONS = 'ALLOW'

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文