I want to display a pdf on my browser bu using send_data(File.read(FILE_PATH + FILE_NAME), :type => ''application/pdf'',:disposition => ''inline'', :filename => FILE_NAME) But nothing happens. Do you know why ? -- 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 For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 28 Jun 2010, at 17:56, Mamadou Touré wrote:> I want to display a pdf on my browser bu using > send_data(File.read(FILE_PATH + FILE_NAME), :type => > ''application/pdf'',:disposition => ''inline'', :filename => FILE_NAME) > > But nothing happens. Do you know why ?Serving it via AJAX or a normal request? Files always need to be served as a normal request. Otherwise you should make sure that the PDF as well as the path is valid. If it isn''t one of these two, you''ll have to dig in deeper yourself and provide the list with more information. Best regards Peter De Berdt -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Peter De Berdt wrote:> On 28 Jun 2010, at 17:56, Mamadou Touré wrote: > >> I want to display a pdf on my browser bu using >> send_data(File.read(FILE_PATH + FILE_NAME), :type => >> ''application/pdf'',:disposition => ''inline'', :filename => FILE_NAME) >> >> But nothing happens. Do you know why ? > > Serving it via AJAX or a normal request? Files always need to be > served as a normal request. Otherwise you should make sure that the > PDF as well as the path is valid. > > If it isn''t one of these two, you''ll have to dig in deeper yourself > and provide the list with more information. > > > Best regards > > Peter De BerdtThe path is valid. If I look to my console log I see that it doesn''t fail. I got this : Streaming file C:\Users\gen00696\Desktop\Formulaires Intelligents pour Mamadou\testFIetData.xdp But noyhing is displayed -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 28 Jun 2010, at 19:28, Mamadou Touré wrote:> Peter De Berdt wrote: >> On 28 Jun 2010, at 17:56, Mamadou Touré wrote: >> >>> I want to display a pdf on my browser bu using >>> send_data(File.read(FILE_PATH + FILE_NAME), :type => >>> ''application/pdf'',:disposition => ''inline'', :filename => FILE_NAME) >>> >>> But nothing happens. Do you know why ? >> >> Serving it via AJAX or a normal request? Files always need to be >> served as a normal request. Otherwise you should make sure that the >> PDF as well as the path is valid. >> >> If it isn''t one of these two, you''ll have to dig in deeper yourself >> and provide the list with more information. >> >> >> Best regards >> >> Peter De Berdt > > The path is valid. If I look to my console log I see that it doesn''t > fail. I got this : > Streaming file C:\Users\gen00696\Desktop\Formulaires Intelligents pour > Mamadou\testFIetData.xdp > > But noyhing is displayedIt seems to be a common problem with xdp files, which are not PDF files btw and should not be served as application/pdf, but as application/vnd.adobe.xdp+xml But even then, the browser plugins can''t seem to handle it anyway, as you can see at Adobe forums: http://forums.adobe.com/thread/332614 Best regards Peter De Berdt -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
what the hell are u doing, if u have file, u can simplify get link to user, for it it will be more faster than use rails, and more native for user Best Regards, dieinzige On 28 Jun, 2010,at 03:56 PM, Mamadou Touré <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: I want to display a pdf on my browser bu using send_data(File.read(FILE_PATH + FILE_NAME), :type => ''application/pdf'',:disposition => ''inline'', :filename => FILE_NAME) But nothing happens. Do you know why ? -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 28 June 2010 21:45, dieinzige <dieinzige-BUHhN+a2lJ4@public.gmane.org> wrote:> what the hell are u doing, if u have file, u can simplify get link to user,What if the OP needs users to be logged in to view files? Or complete some other approval process. Not much sense having them accessible from the public directory in that instance, which would allow people to just bypass the security. -- 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 this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Michael Pavling wrote:> On 28 June 2010 21:45, dieinzige <dieinzige-BUHhN+a2lJ4@public.gmane.org> wrote: >> what the hell are u doing, if u have file, u can simplify get link to user, > > What if the OP needs users to be logged in to view files? Or complete > some other approval process. Not much sense having them accessible > from the public directory in that instance, which would allow people > to just bypass the security.I''m having the file displayed now, but the other issue that I''m facing now is : I have several files to open, I put them in an array that I loop through, but only the last file is opened: What''s wrong ? arr.each do |form| file_name = form + "-" + vue.inte_no.to_s + "-" + vue.poas_id.to_s + "-" + vue.prch_id.to_s + ".xdp" send_file(path_pdf_cpy + file_name,:type => ''application/pdf'' , :disposition => ''attachment'', :filename => file_name) end -- 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 For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Mamadou Touré wrote: [...]> > I''m having the file displayed now, but the other issue that I''m facing > now is : I have several files to open, I put them in an array that I > loop through, but only the last file is opened: > > What''s wrong ? > > arr.each do |form| > file_name = form + "-" + vue.inte_no.to_s + "-" + vue.poas_id.to_s > + "-" + vue.prch_id.to_s + ".xdp" > send_file(path_pdf_cpy + file_name,:type => ''application/pdf'' , > :disposition => ''attachment'', :filename => file_name) > endYou can''t send multiple files in response to one request. Do you want to join the pages of the PDF files into one long file? Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Marnen Laibow-Koser wrote:> Mamadou Touré wrote: > [...] >> >> I''m having the file displayed now, but the other issue that I''m facing >> now is : I have several files to open, I put them in an array that I >> loop through, but only the last file is opened: >> >> What''s wrong ? >> >> arr.each do |form| >> file_name = form + "-" + vue.inte_no.to_s + "-" + vue.poas_id.to_s >> + "-" + vue.prch_id.to_s + ".xdp" >> send_file(path_pdf_cpy + file_name,:type => ''application/pdf'' , >> :disposition => ''attachment'', :filename => file_name) >> end > > You can''t send multiple files in response to one request. Do you want > to join the pages of the PDF files into one long file? > > > > > Best, > --Thanks Marnen, Unfortunately I have to hav each file on its own, I must not merge them in on single file. Is there a way to simulate several requests in order to loop through the array ?> Marnen Laibow-Koser > http://www.marnen.org > marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org-- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Mamadou Touré wrote: [...]>> >> >> >> > Thanks Marnen, > > Unfortunately I have to hav each file on its own, I must not merge them > in on single file. Is there a way to simulate several requests in order > to loop through the array ?Even if there were, the browser would not be able to understand it. You could use several Ajax requests, but if I were your user, I''d be annoyed that your website was randomly downloading files without my consent. Why can''t you just provide several download links for the files? Or create a zip or tar archive?>> Marnen Laibow-Koser >> http://www.marnen.org >> marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.orgJeremy wrote:> Hi everyone, > I have to say that I am very pleased that I have received such great > responses! I kept expecting that I would get the cold shoulder but > instead I got real answers. I feel I have a solid direction and don''t > feel like I''m blindly trying to figure this stuff out. So please > accept my sincerest thank you to all of you for helping me out! > > Bob, > I decided to go ahead and buy the book regardless if it''s > outdated :-) I kinda figured the way deployment is done couldn''t have > changed too much. >It probably has. I don''t think Passenger was in wide use at the time, and it''s now probably the most common choice for deployment.> Peter, > Thank you, I appreciate your contribution as well. Although, it was a > little over my head when you started talking "mercurial repositories" > but I''m sure I''ll understand what that means sometime in the near > future.Mercurial is a version control system -- though it''s not in all that wide use in the Rails community. I think most Rails developers use Git. Which version control system are you using? (Hint: if the answer is "none", fix that *today* by installing Git. There is no excuse whatsoever for neglecting version control.) Also, check out Heroku for very easy Rails deployment. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Mamadou Touré wrote: [...]>> >> >> >> > Thanks Marnen, > > Unfortunately I have to hav each file on its own, I must not merge them > in on single file. Is there a way to simulate several requests in order > to loop through the array ?Even if there were, the browser would not be able to understand it. You could use several Ajax requests, but if I were your user, I''d be annoyed that your website was randomly downloading files without my consent. Why can''t you just provide several download links for the files? Or create a zip or tar archive? -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Marnen Laibow-Koser wrote:> Mamadou Touré wrote: > [...] >>> >>> >>> >>> >> Thanks Marnen, >> >> Unfortunately I have to hav each file on its own, I must not merge them >> in on single file. Is there a way to simulate several requests in order >> to loop through the array ? > > Even if there were, the browser would not be able to understand it. You > could use several Ajax requests, but if I were your user, I''d be annoyed > that your website was randomly downloading files without my consent. > Why can''t you just provide several download links for the files? Or > create a zip or tar archive?So is there another way to merge my xdp file to my pdf without opening it in a browser (ie without using the send_file instruction) ? if so, this would solve my problem -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 30 Jun 2010, at 18:13, Mamadou Touré wrote:>>> Unfortunately I have to hav each file on its own, I must not merge >>> them >>> in on single file. Is there a way to simulate several requests in >>> order >>> to loop through the array ? >> >> Even if there were, the browser would not be able to understand >> it. You >> could use several Ajax requests, but if I were your user, I''d be >> annoyed >> that your website was randomly downloading files without my consent. >> Why can''t you just provide several download links for the files? Or >> create a zip or tar archive? > > So is there another way to merge my xdp file to my pdf without opening > it in a browser (ie without using the send_file instruction) ? if so, > this would solve my problemFind a command line utility for your server OS that will do that for you: http://www.google.be/search?q=command+line+pdf+xdp Then just run the necessary command line instruction from your Rails app. Best regards Peter De Berdt -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Peter De Berdt wrote:> On 30 Jun 2010, at 18:13, Mamadou Touré wrote: > >>> that your website was randomly downloading files without my consent. >>> Why can''t you just provide several download links for the files? Or >>> create a zip or tar archive? >> >> So is there another way to merge my xdp file to my pdf without opening >> it in a browser (ie without using the send_file instruction) ? if so, >> this would solve my problem > > Find a command line utility for your server OS that will do that for > you: http://www.google.be/search?q=command+line+pdf+xdp > > Then just run the necessary command line instruction from your Rails > app. > > > Best regards > > Peter De BerdtI don''t even find a command line utility that merge and xdp with a pdf :( -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.