Please help me , How to open .pdf extension file in browser ? -- Posted via http://www.ruby-forum.com/.
2009/6/17 Dharmdip Rathod <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>:> > Please help me , > > How to open .pdf extension file in browser ?Just put the pdf in your railsapp/public folder and provide a link to it. So if file is railsapp/public/myfile.pdf provide a link to /myfile.pdf Colin> -- > Posted via http://www.ruby-forum.com/. > > > >
Thanks , for your reply same thing is happen here but when i click on link to open pdf file browser automatically gives download window.So , i can not understand how to open file in browser ! -- Posted via http://www.ruby-forum.com/.
2009/6/18 Dharmdip Rathod <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>:> > Thanks , for your reply same thing is happen here but when i click on > link to open pdf file browser automatically gives download window.So , i > can not understand how to open file in browser !I think that is a function of how the browser is setup, nothing to do with your application. Colin
Thanks , Colin Basically i am passing file name in URL , that''s way i am trying to open file in browser and i can not find more help regarding this topic and i have seen this functionality in http://www.meetup.com/SV-SBRG/files/ .It''s working fine i do not think for this they have used any extra functionality. Thanks Dharmdip. -- Posted via http://www.ruby-forum.com/.
2009/6/18 Dharmdip Rathod <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>:> > Thanks , Colin > > Basically i am passing file name in URL , that''s way i am > trying to open file in browser and i can not find more help regarding > this topic and i have seen this functionality in > http://www.meetup.com/SV-SBRG/files/ .It''s working fine i do > not think for this they have used any extra functionality.When I click on the Table-top Sign pdf link in that page firefox it asks whether I want to save or open it. Post the html for the pdf link in your page (use page view source in your browser to see it) Colin
Thanks Colin , But when i choose this option pdf file opens in pdf viewer application , but it does not open in browser it opens like desktop application and when i try to open it with firefox , it gives following error ! C:\DOCUME~1\hb56\LOCALS~1\Temp\1_product-2.pdf could not be opened, because an unknown error occurred. Try saving to disk first and then opening the file. any suggestion? Thanks , Dharmdip -- Posted via http://www.ruby-forum.com/.
2009/6/18 Dharmdip Rathod <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>:> > Thanks Colin , > > But when i choose this option pdf file opens in pdf viewer application , > but it does not open in browser it opens like desktop application and > when i try to open it with firefox , it gives following error ! > > C:\DOCUME~1\hb56\LOCALS~1\Temp\1_product-2.pdf could not be opened, > because an unknown error occurred. > Try saving to disk first and then opening the file.Firstly you have not posted the html for the link. However I think the above message means that it has downloaded and saved the file to the temp folder shown and then tried to open it, and failed. Possibly it is corrupted. I would suggest going and having a look at that file (in temp folder) and see if it is ok. Alternatively (or also) in your web page right click the link and select Save Link As (or similar), download it and see if you can open it. I presume you have checked that the pdf file in your public folder will open ok if you access it directly rather than through the web server. Is the file on your pc or on a remote server? Colin
Thanks Colin , When i put one file in public folder and after accessing thought URL it opens in browser now i know what happens . I have used attachment_fu for file uploading, and files is stored here (/groups_file/000/0045/test.pdf) so i need to make URL pertaining to this path that''s way i can open file in browser i think so. Thanks and Regards, Dharmdip -- Posted via http://www.ruby-forum.com/.
Easiest way to ask the browser to simply "display" a file instead of downloading it is to do the following in your controller''s action: send_file(path, :type => ''application/pdf'', :disposition => ''inline'') The :disposition is the important part; typically you''ll be setting this to either ''inline'' to "force" the browser to view the file inline or ''attachment'' to "force" it to download (I use quotes because nothing is really guaranteed in the browser world). On Jun 18, 1:25 pm, Dharmdip Rathod <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Thanks Colin , > > When i put one file in public folder and after accessing thought URL > it opens in browser now i know what happens . I have used attachment_fu > for file uploading, and files is stored here > (/groups_file/000/0045/test.pdf) so i need to make URL pertaining to > this path that''s way i can open file in browser i think so. > > Thanks and Regards, > Dharmdip > -- > Posted viahttp://www.ruby-forum.com/.
Just use this command : send_file(pdf_file_path, :type => ''application/pdf'', :disposition => ''inline'') On Thursday, June 18, 2009 9:41:17 PM UTC+5:30, Dharmdip Rathod wrote:> > Thanks , for your reply same thing is happen here but when i click on > link to open pdf file browser automatically gives download window.So , i > can not understand how to open file in browser ! > -- > Posted via http://www.ruby-forum.com/. >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/Uf2imMrX3_4J. For more options, visit https://groups.google.com/groups/opt_out.
This post was from 3 years ago. Please do not raise the dead. On 5 November 2012 07:15, Sateesh <sateesh.chaduvula-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Just use this command : send_file(pdf_file_path, :type => > ''application/pdf'', :disposition => ''inline'') > > On Thursday, June 18, 2009 9:41:17 PM UTC+5:30, Dharmdip Rathod wrote: >> >> Thanks , for your reply same thing is happen here but when i click on >> link to open pdf file browser automatically gives download window.So , i >> can not understand how to open file in browser ! >> -- >> Posted via http://www.ruby-forum.com/. >> > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-talk/-/Uf2imMrX3_4J. > For more options, visit https://groups.google.com/groups/opt_out. > > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
give :disposition => ''inline'' in your controllers On Thursday, June 18, 2009 4:17:02 AM UTC+5:30, Dharmdip Rathod wrote:> > Please help me , > > How to open .pdf extension file in browser ? > -- > Posted via http://www.ruby-forum.com/. >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/5tm2zq_fsnYJ. For more options, visit https://groups.google.com/groups/opt_out.
On Wed, Nov 7, 2012 at 10:21 PM, Rajesh reddy <rajeshnecg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> give :disposition => ''inline'' in your controllersThere 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.