djangopython-3.xpdf

How to render a pdf file as pdf in browser using django


I am using Django web frame work. I am taking pdf files from users (notes/book/etc). Then I want to display those pdf in website, but I could not find a way. Methods that failed 1)iframe 2)simple rendering using django 3)pdf.js library. Also browser blocks rendering initially. Care to suggest a method and steps to implement it.


Solution

  • Well the answer has to be very very clear here. You can not display pdf using. There is no such library for that. Like pdf.js for javascript based frameworks. I have done the research. So if you want a really good pdf viewer for your django powered website you have to use pdf.js for sure. I have asked people working with django professionally.

    output in firefox output in firefox

    ouput in chromium browser output in chromium browser

    Now 2nd output is what we want here is the code django code