In my application i need to show multiple images that are loaded from the server on a client side.
This is the server response generating code(ASP.NET Core):
//Create list of thumbnails
List<Object> thumbnails = new List<Object>();
foreach (ClosingDocument DItem in PackageConent.Documents)
{
DItem.GetPDFDocument();
Bitmap thumbnail = DItem.GetThumbnailPage(1);
thumbnails.Add(thumbnail);
}
JArray JO = JArray.FromObject(thumbnails);
response.Add(new JProperty("PdfDocuments", JO));
Then on a client side i do console.log(data.Package.PdfDocuments1);
But how do i convert it into something that i can put into the <img src="???">
if i do the following:
var dataUrl = window.URL.createObjectURL(data.Package.PdfDocuments[1]);
TypeError: Failed to execute 'createObjectURL' on 'URL': No function was found that matched the signature provided.
I edited the server code to return Base64 encoded image.
now when i do
var blob = atob(data.Package.PdfDocuments[1]);
console.log(blob);
i get:
But when i try to convert in to URL like this:
var data = window.URL.createObjectURL(blob);
i still get:
TypeError: Failed to execute 'createObjectURL' on 'URL': No function was found that matched the signature provided.
Thanks!