Use download manager from PDF.js to download the file #83
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #62
The default implementation of
PDFViewerApplication.downloadcreates a blob which is then downloaded using the download manager from PDF.js. This causes a CSP error in Firefox, so in 7bcdc4f the default implementation was replaced with awindow.opencall with the URL of the file.Besides through a blob, the download manager from PDF.js also supports downloading a file through its URL. Thus, in order to keep closer to the default PDF.js viewer, now the custom implementation of
PDFViewerApplication.downloadwas changed to download the file using the download manager from PDF.js.Note that
window.opendoes not work in Internet Explorer 11 (in this specific case, probably due to the use of iframes or something like that; it is Internet Explorer... so to be honest I did not bother digging into it :-P ), so this change also fixes the download in Internet Explorer 11, it is not just an academic change.When testing this pull request please be aware of #82