Content-Disposition filename ignored somehow
See original GitHub issueHello, currently I render my Browser documents with PDFJS however I have patched the viewer.js to support my Authorization header i just added httpHeaders to paramters before PDFJS.getdocument so nothing special, however PDFJS ignore’s my Content-Disposition Header which has a filename= it always gives me document.pdf
I tested against a CORS version and non cors currently this is my content-disposition:
Content-Disposition:inline; filename="Angebot_412356.pdf"
Is there a setting that it should use this filename or do I miss something?
Currently it isn’t related to https://github.com/mozilla/pdf.js/issues/2407 since that will work on save + s. However on my side either Firefox/Chrome nobody gets the correct content-disposition i tried:
Content-Disposition: inline; filename=name.pdf
Content-Disposition: attachment; filename=name.pdf
Content-Disposition: inline; filename="name.pdf"
Content-Disposition: attachment; filename="name.pdf"
Also that’s the Code I added in viewer.js starting after Line 6373 and the PDFJS line is already there:
var token = window.localStorage.getItem('token');
var typ = window.localStorage.getItem('type');
parameters.httpHeaders = {'Authorization': typ + ' ' + token};
PDFJS.getDocument(parameters, pdfDataRangeTransport, passwordNeeded,
btw. I could also set the filename by myself, I think of the possibility that I know the filename already.
Issue Analytics
- State:
- Created 8 years ago
- Comments:17 (7 by maintainers)
Top GitHub Comments
This is still an issue, for me at least. Any updates? It’s been over a year.
@ddemoss222 For future reference: Note that it’s always recommended to open a new issue, rather than commenting on one that was closed many years ago, since it’s often very easy for comments on old issues to be overlooked/ignored.
Without a runnable test-case it’s difficult (or rather impossible) to know for sure, but this is likely fixed by the PR referenced above.