Question

Hi i'm getting error in this line of code:

pdf.font.size = 13

The name of the file is "show.pdf.prawn"

I'm trying to generate a page into pdf using the prawn gem.

But changing the font size isn't working.

Any alternatives or workaround? Thanks.

BTW: I'm following a simple tutorial from railstips.org : http://railstips.org/blog/archives/2008/10/13/how-to-generate-pdfs-in-rails-with-prawn/

Was it helpful?

Solution

Your tutorial seems to be a little bit old. You should have a look at this manual : http://prawn.majesticseacreature.com/manual.pdf and/or check the railscasts episode : http://railscasts.com/episodes/153-pdfs-with-prawn-revised.

You can use the font_size property to define the size of your text like this :

font_size(25) { text "Even bigger!" }

You can also do it like this :

text "Single line on 20 using the :size option.", :size => 20

Or you can use a block to apply different font properties to your text :

    font("Courier", :size => 10) do
      text "Yeah, using Courier 10 courtesy of the font method."
    end
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top