I\'m trying to follow this tutorial.
When I\'m adding .pdf to my url it does nothing. My controller has:
respond_to :html, :pdf.
Thanks to another stack overflow answer I got part of solution.
This works:
html = 'Toto de combats'
@pdf = PDFKit.new(html)
send_data @pdf.to_pdf, :filename => "whatever.pdf",
:type => "application/pdf",
:disposition => "attachement"
You can replace attachement by inline, so the pdf is displayed in your browser.
In the stack overflow answer I spoke about (I don't remember the link), the .to_pdf was missing, but is mandatory. Otherwise PDF reader doesn't recognize it.
I'm trying to get this work with a .pdf url.
Edit 3:
My problem with .pdf urls is solved. known issue with rails 3.1, but google was unable to find them.
explanation : explanation
Workaround (hadn't tryied yet). workaround