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?
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,
$.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
});