title: Convert pdf URL to Base64
body: <p>In my angular application, I used the below code for convert any <strong>file</strong> to <strong>Base64</strong> string.</p>
  <pre><code>handleUpload(event) {
      const file = event.target.files[0];
      const reader = new FileReader();
      reader.readAsDataURL(file);
      reader.onload = () =&gt; {
          console.log(reader.result);
      };
  }
  </code></pre>
  <p>Here, I want to convert the <strong>pdf URL</strong> to <strong>base64</strong> on the fly. Here's my sample URL which I want to convert base64.</p>
  <p><a href="https://vadimdez.github.io/ng2-pdf-viewer/assets/pdf-test.pdf" rel="nofollow noreferrer">https://vadimdez.github.io/ng2-pdf-viewer/assets/pdf-test.pdf</a></p>