Hi all, I''m attempting to learn about PDF::Writer. I''ve written a brief test program to play with the concepts. Here is the code: pdf = PDF::Writer.new pdf.select_font "Times-Roman" pdf.text "Hello, Ruby.", :font_size => 72, :justification => :center pdf.save_as("#{@request.relative_url_root}/pdf/hello.pdf") I keep getting the following error: (Note: schedprog is an alias to my rails application directory (which is /pds) Errno::ENOENT (No such file or directory - /schedprog/pdf/hello.pdf): I''ve tried a number of options, but no matter what I do I get the above error message. I''ve checked the application''s public directory and know the pdf directory exists and I even set permissions to 777 just to make sure my program could do anything. What am I missing? Any help would be appreciated. Dave dave-iivBh4qK1eeabGxWCkuYjA@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
You have two different urls you have to keep in mind. Your site url, which is handled by your request, and you url on your server, or more accurately your path. When you ask you''re request what the url is, it''s looking at what path the browser would be looking at. You need to be worried about the server side. It should be just as easy as setting your path to ./public/pdf/hello.pdf, assuming that you''re trying to get into your local project''s public file. On 9/5/06, jazzlover2002 <dave-iivBh4qK1eeabGxWCkuYjA@public.gmane.org> wrote:> > > Hi all, > > I''m attempting to learn about PDF::Writer. I''ve written a brief test > program > to play with the concepts. Here is the code: > > pdf = PDF::Writer.new > pdf.select_font "Times-Roman" > pdf.text "Hello, Ruby.", :font_size => 72, :justification => > :center > > pdf.save_as("#{@request.relative_url_root}/pdf/hello.pdf") > > I keep getting the following error: > > (Note: schedprog is an alias to my rails application directory (which > is /pds) > > Errno::ENOENT (No such file or directory - /schedprog/pdf/hello.pdf): > > I''ve tried a number of options, but no matter what I do I get the above > > error message. I''ve checked the application''s public directory and > know > the pdf directory exists and I even set permissions to 777 just to > make sure my program could do anything. > > What am I missing? Any help would be appreciated. > > Dave > dave-iivBh4qK1eeabGxWCkuYjA@public.gmane.org > > > > >-- Mike Weber Web Developer UW-Eau Claire --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
On 5 Sep 2006, at 21:52, jazzlover2002 wrote:> > Hi all, > > I''m attempting to learn about PDF::Writer. I''ve written a brief test > program > to play with the concepts. Here is the code: > > pdf = PDF::Writer.new > pdf.select_font "Times-Roman" > pdf.text "Hello, Ruby.", :font_size => 72, :justification => > :center > > pdf.save_as("#{@request.relative_url_root}/pdf/hello.pdf") > > I keep getting the following error: > > (Note: schedprog is an alias to my rails application directory (which > is /pds) > > Errno::ENOENT (No such file or directory - /schedprog/pdf/hello.pdf): > > I''ve tried a number of options, but no matter what I do I get the > above > > error message. I''ve checked the application''s public directory and > knowI don''t see what the public directory has to do with it - if / schedprog/pdf/hello.pdf is what the error message says, that''s what it''s looking for - the error message doesn''t mention ''public'', so it isn''t looking there. / - root directory /pdfs - your rails application root directory (seems a bit odd to have this under /, but never mind) /app - your model classes etc /pdf - this is where PDF:;Writer is trying to put the PDF /public - the rail public dir /pdf this is where you want the PDFs to go Ben> the pdf directory exists and I even set permissions to 777 just to > make sure my program could do anything. > > What am I missing? Any help would be appreciated.-- Ben Blaukopf - Director Airsource Ltd Tel: 01223 708370 / 07786 916043 --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
the only files that are publicly accessible by the server are files in your public folder. That''s why your stylesheets, javascripts, and images folders are all in this folder. So if you go to http://www.mysite.com/images/image1.jpg, it is looking on the server at location rails_app/images/image1.jpg. So if you want to be able to get to a pdf by going to htttp://www.mysite.com/pdfs/pdf1.pdf, you would have to save pdf1.pdf in rails_app/pdfs/pdf1.pdf On 9/8/06, Ben Blaukopf <ben-AWY3dlV3Juu8qtKVGud/9w@public.gmane.org> wrote:> > > > On 5 Sep 2006, at 21:52, jazzlover2002 wrote: > > > > > Hi all, > > > > I''m attempting to learn about PDF::Writer. I''ve written a brief test > > program > > to play with the concepts. Here is the code: > > > > pdf = PDF::Writer.new > > pdf.select_font "Times-Roman" > > pdf.text "Hello, Ruby.", :font_size => 72, :justification => > > :center > > > > pdf.save_as("#{@request.relative_url_root}/pdf/hello.pdf") > > > > I keep getting the following error: > > > > (Note: schedprog is an alias to my rails application directory (which > > is /pds) > > > > Errno::ENOENT (No such file or directory - /schedprog/pdf/hello.pdf): > > > > I''ve tried a number of options, but no matter what I do I get the > > above > > > > error message. I''ve checked the application''s public directory and > > know > > I don''t see what the public directory has to do with it - if / > schedprog/pdf/hello.pdf is what the error message says, that''s what > it''s looking for - the error message doesn''t mention ''public'', so it > isn''t looking there. > > / - root directory > /pdfs - your rails application root directory (seems a bit odd to > have this under /, but never mind) > /app - your model classes etc > /pdf - this is where PDF:;Writer is trying to put the PDF > /public - the rail public dir > /pdf this is where you want the PDFs to go > > > Ben > > > the pdf directory exists and I even set permissions to 777 just to > > make sure my program could do anything. > > > > What am I missing? Any help would be appreciated. > > > -- > Ben Blaukopf - Director > Airsource Ltd > Tel: 01223 708370 / 07786 916043 > > > > > > > > >-- Mike Weber Web Developer UW-Eau Claire --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Thanks, Mike. I finally got there. My problem was with a redirect I was doing after I created the pdf file. I discovered I was pointing to the wrong place. So for a while I was looking in the wrong place for a solution. Wasn''t quite awake as I thought I was on this one. :-) Dave On Sep 11, 2006, at 5:45 AM, Mike Weber wrote:> the only files that are publicly accessible by the server are files > in your public folder. That''s why your stylesheets, javascripts, > and images folders are all in this folder. So if you go to http:// > www.mysite.com/images/image1.jpg, it is looking on the server at > location rails_app/images/image1.jpg. So if you want to be able to > get to a pdf by going to htttp://www.mysite.com/pdfs/pdf1.pdf, you > would have to save pdf1.pdf in rails_app/pdfs/pdf1.pdf > > On 9/8/06, Ben Blaukopf <ben-AWY3dlV3Juu8qtKVGud/9w@public.gmane.org> wrote: > > On 5 Sep 2006, at 21:52, jazzlover2002 wrote: > > > > > Hi all, > > > > I''m attempting to learn about PDF::Writer. I''ve written a brief > test > > program > > to play with the concepts. Here is the code: > > > > pdf = PDF::Writer.new > > pdf.select_font "Times-Roman" > > pdf.text "Hello, Ruby.", :font_size => 72, :justification => > > :center > > > > pdf.save_as ("#{@request.relative_url_root}/pdf/hello.pdf") > > > > I keep getting the following error: > > > > (Note: schedprog is an alias to my rails application directory > (which > > is /pds) > > > > Errno::ENOENT (No such file or directory - /schedprog/pdf/ > hello.pdf): > > > > I''ve tried a number of options, but no matter what I do I get the > > above > > > > error message. I''ve checked the application''s public directory and > > know > > I don''t see what the public directory has to do with it - if / > schedprog/pdf/hello.pdf is what the error message says, that''s what > it''s looking for - the error message doesn''t mention ''public'', so it > isn''t looking there. > > / - root directory > /pdfs - your rails application root directory (seems a bit odd to > have this under /, but never mind) > /app - your model classes etc > /pdf - this is where PDF:;Writer is trying to put the PDF > /public - the rail public dir > /pdf this is where you want the PDFs to go > > > Ben > > > the pdf directory exists and I even set permissions to 777 just to > > make sure my program could do anything. > > > > What am I missing? Any help would be appreciated. > > > -- > Ben Blaukopf - Director > Airsource Ltd > Tel: 01223 708370 / 07786 916043 > > > > > > > > >Dave Pancost dave-iivBh4qK1eeabGxWCkuYjA@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---