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
[email protected]
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 [email protected] wrote:
pdf.text "Hello, Ruby.", :font_size => 72, :justification =>
[email protected]
–
Mike W.
Web D.
UW-Eau Claire
On 5 Sep 2006, at 21:52, jazzlover2002 wrote:
:center
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 B. - Director
Airsource Ltd
Tel: 01223 708370 / 07786 916043
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 B. [email protected] wrote:
to play with the concepts. Here is the code:
(Note: schedprog is an alias to my rails application directory (which
I don’t see what the public directory has to do with it - if /
/pdf this is where you want the PDFs to go
–
–
Mike W.
Web D.
UW-Eau Claire
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 W. wrote:
On 5 Sep 2006, at 21:52, jazzlover2002 wrote:
pdf.select_font "Times-Roman"
schedprog/pdf/hello.pdf is what the error message says, that’s what
Ben B. - Director
Airsource Ltd
Tel: 01223 708370 / 07786 916043
Dave Pancost
[email protected]