title: Getting local PDF's URL using a Content Script
body: <p>When accessing pdfs for Google Chrome, the browser uses its own extension to read and show PDFs. I would like to get the URL from a local source file "file:///C:/Users/Test/Desktop/test%20extension/test.pdf" using a content script.</p>
  
  <p>My goal is to eventually get the text of this PDF so that I can read through it, and the pdf.js library I am using requires the URL of the pdf. </p>
  
  <p>On the chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/index.html file, the below element holds this data. </p>
  
  <pre><code>&lt;embed id="plugin" type="application/x-google-chrome-pdf" src="file:///C:/Users/Test/Desktop/test%20extension/test.pdf" stream-url="blob:chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/e268f61a-7f6c-44ab-9218-7193dc73a783" headers="" background-color="0xFF525659" top-toolbar-height="56" javascript="allow" full-frame=""&gt;
  </code></pre>
  
  <p>I have embedded my content script as shown below in manifest.json:</p>
  
  <pre><code>    "content_scripts": [
      {
          "matches": ["*://*/*.pdf"],
          "js": ["contentScript.js"]
      }
      ],
  </code></pre>
  
  <p>My content script has the following code which I believe should pull this URL:</p>
  
  <pre><code>var fileUrl = document.getElementById('plugin').src;
  console.log('The file URL is : ' + fileUrl);
  </code></pre>
  
  <p>My goal is to get the console.log() above to return the fileUrl ("file:///C:/Users/Test/Desktop/test%20extension/test.pdf"). Does anyone have suggestions on how to do this? Is it possible that I am not calling my content script correctly?</p>