Answer the question
In order to leave comments, you need to log in
How to display a PDF from a variable on a website?
Hello.
Here I am downloading a PDF file from the source in Django, and in the variable I have the content of the PDF file (it is working, if you write this content to a file, it will open).
And now I need to somehow display the PDF, not in a separate page, but something like an iframe (but not necessarily it).
I read that it is impossible to do this through Django, but who knows.
JS can also be used, the main thing is that it should not be displayed on a separate page.
Answer the question
In order to leave comments, you need to log in
variable I have the content of the PDF file (it is working, if you write this content to a file, it will open).Blob or what?
var file = new Blob([data], {type: 'application/pdf'});
var fileURL = URL.createObjectURL(file);
window.open(fileURL);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question