S
S
Stepan Sidorov2020-06-18 14:55:47
JavaScript
Stepan Sidorov, 2020-06-18 14:55:47

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

2 answer(s)
V
Victor L, 2020-06-18
@Fzero0

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);

V
Valentine, 2014-08-29
@vvpoloskin

Do you want Google to index rtsp streams in addition to http(s) traffic? not only does rtsp work on a different port altogether, but also the data transmitted through it ... hmm, is not entirely amenable to search text indexing.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question