Pdf.js: window.url.createobjecturl(blob) not working in Edge

Created on 22 Oct 2018  路  3Comments  路  Source: mozilla/pdf.js

Firstly, I tried all the questions & answers related to this topic. Additionally and I tried related questions and try to solve it but no the success. So please read my question thoroughly.

Search Questions:

  1. Displaying Blob PDF in Edge/IE11
  2. Windows Edge and opening a blob URL
  3. Blob download is not working in IE

I've searched related questions and tried to write the code but not had any success. I work with the PDFJS Project. I have open blob file in new tap. The below code works in all browsers (Chrome, Firefox, IE) but it's not working in Edge. I also use viewer.js in my project. I want to load my PDF file in Edge browser *Microsoft Edge 42.17134.1.0.

code

 var xhr = new XMLHttpRequest();
    xhr.open('POST', '/pdfblob.aspx', true);
    xhr.responseType = 'blob';
    xhr.onload = function (e) {
      var url = window.URL.createObjectURL(this.response);
      window.open('/web/viewer.html?file=' + url);
    };
    xhr.send();

This is the error I get:
https://i.stack.imgur.com/EXUQ4.png

1-other 4-edge-specific

All 3 comments

I think the problem is that the file parameter only accepts a direct path to the PDF file; refer to https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#file. Otherwise, I think you need to call PDFViewerApplication.open(blob_data).

I tried thisPDFViewerApplication.open(blob_data) it is not working in Microsoft Edge 42.17134.1.0 . it was working in the previous version of Edge. the same function is also working in all other browsers (Chrome, Firefox, IE).

[...] it is not working in Microsoft Edge 42.17134.1.0 . it was working in the previous version of Edge.

This rather clearly points to a bug/regression in the Edge browser, rather than in the PDF.js library/viewer, which should thus be reported to the Edge developers instead.

the same function is also working in all other browsers (Chrome, Firefox, IE).

This furthermore confirms that this isn't a general bug in PDF.js, and this issue should probably be closed as INVALID since there's nothing we can do here.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kleins05 picture kleins05  路  3Comments

dmisdm picture dmisdm  路  3Comments

timvandermeij picture timvandermeij  路  4Comments

azetutu picture azetutu  路  4Comments

AlexP3 picture AlexP3  路  3Comments