How to Display blob (.pdf) in an AngularJS app

First of all you need to set the responseType to arraybuffer. This is required if you want to create a blob of your data. See Sending_and_Receiving_Binary_Data. So your code will look like this: $http.post(‘/postUrlHere’,{myParams}, {responseType:’arraybuffer’}) .success(function (response) { var file = new Blob([response], {type: ‘application/pdf’}); var fileURL = URL.createObjectURL(file); }); The next part is, you … Read more

how to store Image as blob in Sqlite & how to retrieve it?

Here the code i used for my app This code will take a image from url and convert is to a byte array byte[] logoImage = getLogoImage(IMAGEURL); private byte[] getLogoImage(String url){ try { URL imageUrl = new URL(url); URLConnection ucon = imageUrl.openConnection(); InputStream is = ucon.getInputStream(); BufferedInputStream bis = new BufferedInputStream(is); ByteArrayBuffer baf = new … Read more