How to check if the PDF is blank in Angular JS?


Here is the code that loads the pdf file and download it:

$http.get('/retrievePDFFile', {responseType: 'arraybuffer'})
   .success(function (data) {
       var file = new Blob([data], {type: 'application/pdf'});
       var fileURL = URL.createObjectURL(file);;

For some reason, I want to check if the pdf is not blank before it gets downloaded. I don’t want to download an empty pdf.

Or someone can tell me, how to convert PDF Stream to json or text, would be great.