dimanche 28 mars 2021

How to dynamically embed a pdf(locally stored in browser) in HTML?

I tried to use embed and iframe tags which work for the first page.

<iframe src="~/Documents/Upload/myPDF.pdf" id="pdfDisplay"> 

But when I try to change the src in javascript, I get the same page displayed over again.

document.getElementById('pdfDisplay').setAttribute("src", "~/Documents/TextDetection/Upload/" + files[currentIndex]);

Where files[current] is the dynamically generated filename that exists in the local storage.

I don't know what I am doing wrong because its not working.




Aucun commentaire:

Enregistrer un commentaire