PDFViewer for Django

53 Views Asked by At

I'm struggling to find a solution to embed a PDF Viewer into my Django website. Currently, I'm using an iframe to display a PDF, but now I want to enable annotations on the PDF directly on the website. The only option I've come across is using PDF.js, but it requires having Node.js alongside Django, and that introduces a host of other challenges.

Does anyone know of an alternative approach to achieve this? Thanks!

1

There are 1 best solutions below

0
farbod hma On

its not that dificuld to use in node.js in django and if you want using that and need help send an email to me but if you mant use another thinks you can use object tag

<!DOCTYPE html>
<html>
  <head>
    <title>PDF Example by Object Tag</title>
  </head>
  <body>
    <h1>PDF Example by Object Tag</h1>
    <object data="namefile.pdf" type="application/pdf" width="100%" height="500px">
      <p>Unable to display PDF file. <a href="namefile.pdf">Download</a> instead.</p>
    </object>
  </body>
</html>

you have another tag -> embed

<embed src="http://example.com/the.pdf" width="500" height="375" />

but better and other option in pdf.js by mozilla https://github.com/mozilla/pdf.js

and use this git repo for node.js in django

https://gist.github.com/brizandrew/685a588fbefbd64cd95ed9ec4db84848