In my project I'm using Carrierwave to upload files like doc, and pdf. In case I want to download a pdf my controller do
send_file @document, :disposition => 'inline', :type => 'application/pdf'
And this works fine, displays the pdf file in browser and the url I get is /documents/file_name and it's fine too. But I want to set the "headers title" or "url title" so in the browser's tab shows the file_name instead myapp.com/documents/file_name
Is there a simple way to do that?
Unfortunately it is not possible as you describe.
The tab title is taken from the PDF documents metadata, specifically the Title attribute.
If you usually generate your document with Prawn you can do:
Prawn::Document.generate(my_filename, info: {Title: my_title})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With