Serving a PDF document


#1

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


#2

Simon M. 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?


#3

On Thu, 09 Oct 2008 17:03:02 +0800, Mohit S. removed_email_address@domain.invalid
wrote:

Simon M. 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