• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to set the default file name shown when trying to save PDF opened in inline view from browser ?

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I have a website with links to PDF files. When a user clicks on the link, it should open the PDF in the browser.
But when the user clicks on the save button, I want a different name to be populated by default in the "Save As" dialog box.

Currently, it gives the entire URL (with some characters like : and / replaced by _) as the default file name.

Below is the code snippet I am using:



However, if I set the content-disposition to attachment, it pops up a dialog box with the name that I want to save. Here, if I click on Open it opens the PDF and then on trying to save the name that I want is shown by default.

Is there any other header that I need to set so that it works in the inline mode ?
 
No holds barred. And no bars holed. Except this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic