on-internet
← Community

How can Chrome’s built-in PDF viewer download button use a custom filename for an authenticated PDF?

Stack Overflow ·

I show a PDF from my backend in an <iframe> using Chrome's built-in PDF viewer. The endpoint requires a bearer token, so Angular fetches the PDF as a Blob and gives the iframe a blob: URL. The PDF displays correctly, but the viewer's own download icon (and "Save as...") saves it with the blob's UUID, for example cda675a6-10af-42f3-aa68-8795aa8c377d.pdf, instead of the custom name my backend sends. How can the download button of the native PDF viewer produce the custom file name? A custom download button (<a download>) is not an acceptable fix, because the viewer's own button stays visible and

Comments

Sign in or sign up to comment and upvote.

No comments yet.