pdf.js: Content-Disposition filename ignored somehow

Hello, 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.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 17 (7 by maintainers)

Most upvoted comments

This is still an issue, for me at least. Any updates? It’s been over a year.