Wednesday, November 7, 2012

Re: [Rails] Re: How to open PDF file in browser ?

On Wed, Nov 7, 2012 at 10:21 PM, Rajesh reddy <rajeshnecg@gmail.com> wrote:
> give :disposition => 'inline' in your controllers

There are several quirks with sending inline to most browsers (for
example if I remember right Firefox is still plagued by not using the
name you set for inline) and IE has several bugs that used to exist
but I don't know if that's the case. I would suggest you send it as
an attachment and let the client decide what they want to do, actually
IMO you should always send it as an attachment no matter what because
it should be up to the client what they want to do, that's why the
"open with" exists.

Adobe can catch them even if they are attached on Windows, on Linux
you won't want to view it inline anyways (at least I never do I prefer
to view it in my client rather than the browser -- or to send it
straight to Google Docs for viewing later.)

send_data(file, type: "application/pdf", disposition: "attachment;
filename=file.pdf")

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate