javascript - How do I take a converted file (pdf to html), and open it locally in a new tab in google chrome? -


basically have django app communicates chrome extension. have bunch of functionality interfaces normal html pages that's done extension. want allow users have same functionalities pdf files. have python script translates pdf file html page.

the problem run when pdfs open locally within chrome.

like following file:///home/wcr5048/downloads/sample_pdf.pdf

this current solution, gets html , replaces current html, embedded pdf, , replaces converted pdf(html). run issue because "url" isn't url, , therefore can't append html doesn't exist.

function convert_to_html(request) {     console.log('converting html...');     document.getelementsbytagname('html')[0].innerhtml = request.data;     chrome.runtime.sendmessage({         detail: 'refresh'     }); } 

what don't want happen download file pdf 1 that's been converted html. rather have happen automatically.

i see 2 possible options:

  1. i create unique link converted pdf file every user, , send raw html string populate corresponding view.

  2. i somehow tell extension use popup cover entire width of screen, , populate data.

are there suggested solutions better fit, , if not, better solution.

thanks viewing


Comments