Forum: Ruby on Rails Serving a PDF document

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
41cc2c53544016a86472343ab3fdc0ff?d=identicon&s=25 Simon Macneall (Guest)
on 2008-10-09 08:59
(Received via mailing list)
Hi all,

Been banging my head against this for a little while so figured I see if
anyone here could light the way.

Our site receives input from fillable pdfs as XML (XFDF to be precise)
and
processes the information. We also need to be able to re-export the
filled
PDF. To do this you send the xfdf file with an href to the original pdf
document.

If I point the href to a static PDF (so, put it in the public folder)
adobe opens and fills the pdf correctly. However, if I point to the pdf
using a dynamic URL to rails then Adobe just doesn't fill the pdf.

So my question, what is the difference between
http://localhost:3000/pdfs/TACServiceReport0908.pdf - where pdfs is a
folder in the public folder of the app
and
http://localhost:3000/forms/show/4.pdf - this renders the exact same
file
using one of the following (I have tried them all)

send_file(@form.pdf_filename, :type => 'application/pdf', :dispoisition
=>
'attachment')
send_file(@form.pdf_filename, :type => 'application/pdf', :dispoisition
=>
'inline')
send_data(content, :filename => filename, :type => "application/pdf",
:disposition => "inline")
send_data(content, :filename => filename, :type => "application/pdf",
:disposition => "attachment")

and how can I make the second method behave like the first.


Thanks
Simon
34a7615f38496a5dafbb3e6b721c435e?d=identicon&s=25 Mohit Sindhwani (Guest)
on 2008-10-09 11:04
(Received via mailing list)
Simon Macneall wrote:
> If I point the href to a static PDF (so, put it in the public folder)
> send_file(@form.pdf_filename, :type => 'application/pdf', :dispoisition =>
> 'attachment')
> send_file(@form.pdf_filename, :type => 'application/pdf', :dispoisition =>
> 'inline')
>

I'm sorry I can't help you directly but is the above spelling error for
disposition actually there in your code?
41cc2c53544016a86472343ab3fdc0ff?d=identicon&s=25 Simon Macneall (Guest)
on 2008-10-09 13:46
(Received via mailing list)
On Thu, 09 Oct 2008 17:03:02 +0800, Mohit Sindhwani <mo_mail@onghu.com>
wrote:

>
> Simon Macneall wrote:
>> Hi all,
>>
>>
>
> I'm sorry I can't help you directly but is the above spelling error for
> disposition actually there in your code?
>
Yes it was, that wasn't the problem though, once I set the :type to
'application/pdf' it worked. Was sure that I had tried that at one
stage,
but apparently not.

Thanks
Simon
This topic is locked and can not be replied to.