title: Ajax call to return PDF file as base64 string
body: <p>Im using ajax in an angular js environment to called a local file (a pdf file). The called is successful, however the data return by the ajax call is in garbled code (not sure if i used the right term here, but is just like opening a pdf file using a text editor). Is there anyway that i could get the return result as base64 string?</p>
  
  <p>The reason behind this is to merge up with some of the existing pdf , but before that, i would need the base64 string of the pdf. Below are my ajax call code,</p>
  
  <pre><code>$.ajax({           
      url : 'path/to/pdfFile.pdf',
      success : function(data) {
         console.log(data); //expecting base64 string here
      },
      error: function(xhr, textStatus, errorThrown){
        console.log('request failed');
      },
      async : false
  });
  </code></pre>