vendredi 29 juillet 2016

Embed a Blob using PDFObject

I´m using: https://pdfobject.com/

To display an embedded pdf file on my web app. However I cannot render a pdf created from a blob. This is what I´ve tried:

      var arrayBufferView = new Uint8Array(response.Body.data);
      var file = new Blob( [arrayBufferView], {type: response.ContentType});
      var url = window.URL.createObjectURL(file)
      PDFObject.embed(url, "#my-container");

Gets me this result on html:

<div id="my-container" class="ng-scope pdfobject-container">

    <embed class="pdfobject" src="blob:http%3A//localhost%3A4000/869a8d9a-7eaa-48dd-99aa-49bf299114aa" type="application/pdf" style="overflow: auto; width: 100%; height: 100%;" internalinstanceid="88">

</div>

However the embed container displays nothing in my browser. I´m using Chrome 51.0.2704.103 m

Aucun commentaire:

Enregistrer un commentaire