Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing to use default pdf viewer in Django web app #12610

Closed
alpha027 opened this issue Nov 12, 2020 · 1 comment
Closed

Failing to use default pdf viewer in Django web app #12610

alpha027 opened this issue Nov 12, 2020 · 1 comment

Comments

@alpha027
Copy link

Attach (recommended) or Link to PDF file here:

Configuration:

  • Web browser and its version: Chrome
  • Operating system and its version: Ubuntu 18.04
  • PDF.js version: v2.5.207
  • Is a browser extension: No

I am trying to display PDFs inside a Django web application using pdf-js. For this, I use the iframe tag to use the PDF js default viewer. Django displays an Error 404 saying that web/viewer did not match any of the url patters used in the Django web application. I have also tried to add a view that renders the web/viewer.html file but still the pdf could not be displayed. Can you please help me fix this issue, or clarify how to integrate pdf js default viewer in a django web application.

django error

When I add the following view in my views.py file.

def pdf_View(request): return render(request,'app/web/viewer.html')

I get no error, but, the PDF is not displayed, only the buttons of pdf navigation bar (next, previous pages, zoom in,out ...).

Screenshot from 2020-11-12 10-54-21

It could be very helpful if someone can adress this issue, or make a small tutorial on how to integrate pdf-js with a Django web application.

@Snuffleupagus
Copy link
Collaborator

I am trying to display PDFs inside a Django web application using pdf-js.

Unfortunately we know nothing about "Django", or other frameworks, here and as such it's very difficult to help.

Furthermore, please see https://github.com/mozilla/pdf.js/blob/master/.github/CONTRIBUTING.md (emphasis mine):

If you are developing a custom solution, first check the examples at https://github.com/mozilla/pdf.js#learning and search existing issues. If this does not help, please prepare a short well-documented example that demonstrates the problem and make it accessible online on your website, JS Bin, GitHub, etc. before opening a new issue or contacting us in the Matrix room -- keep in mind that just code snippets won't help us troubleshoot the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants