Can't make pdf in Rails App

37 views
Skip to first unread message

Federico

unread,
Aug 26, 2008, 12:11:42 PM8/26/08
to Prawn
Hi, I have followed the instructions on the prawnto website to install
and configure the plugin, but i haven't been able to create any .pdf
file.

The problem I have is that when I call the action to create the pdf i
just get the "Template is missing" error. The action is looking for
the html.erb file instead of looking for the .pdf.prawn file. My code
is the following.

reservation.pdf.prawn

pdf.text "Hello World"


application_forms_controller.rb

def reservation
@prawn_document_options = {:page_size => 'A4'}
end

environment.rb

Rails::Initializer.run do |config|

config.gem "prawn"

......


thanks.

Gregory Brown

unread,
Aug 26, 2008, 12:17:24 PM8/26/08
to prawn...@googlegroups.com
On Tue, Aug 26, 2008 at 12:11 PM, Federico <fed...@gmail.com> wrote:
>
> Hi, I have followed the instructions on the prawnto website to install
> and configure the plugin, but i haven't been able to create any .pdf
> file.
>
> The problem I have is that when I call the action to create the pdf i
> just get the "Template is missing" error. The action is looking for
> the html.erb file instead of looking for the .pdf.prawn file. My code
> is the following.

Did you go to /controller/action/id.pdf ?

You'll need to do this, or configure an appropriate route.

-greg

PS: thorny_sun, Please document this! We've answered this question on
#prawn one too many times.


--
Technical Blaag at: http://blog.majesticseacreature.com | Non-tech
stuff at: http://metametta.blogspot.com

Federico

unread,
Aug 26, 2008, 12:53:21 PM8/26/08
to Prawn
Sorry about that,

I searched the group and the web, but found nothing saying that you
needed to include the .pdf extension on the link.

thank you very much for the quick response.

On Aug 26, 11:17 am, "Gregory Brown" <gregory.t.br...@gmail.com>
wrote:

Gregory Brown

unread,
Aug 26, 2008, 12:56:41 PM8/26/08
to prawn...@googlegroups.com
On Tue, Aug 26, 2008 at 12:53 PM, Federico <fed...@gmail.com> wrote:
>
> Sorry about that,
>
> I searched the group and the web, but found nothing saying that you
> needed to include the .pdf extension on the link.

It's fine, despite the fact this is a general Rails thing, and not a
Prawn specific thing, it has been tripping people up. Once thorny_sun
gets a doc up about it, things will be better. Keep in mind that
Prawnto and Prawn aren't the same project. Prawn is a general Ruby
library.

We do share the same mailing list though, so keep those questions coming.

-greg

Michael Prior

unread,
Aug 26, 2008, 1:02:30 PM8/26/08
to prawn...@googlegroups.com
on it.
Reply all
Reply to author
Forward
0 new messages