Questions tagged [prawn]

Prawn is a fast, nimble Ruby library for creating PDF files.

Prawn is a fast, nimble Ruby library for creating PDF files.

More information on the library can be found here. There is a wiki and the source is available on GitHub.

For support requests, you can use the Prawn mailing list or #prawn on Freenode.

699 questions
11
votes
2 answers

Prawn pdf attachments in the email

In my Rails application, I'm trying to attach the invoice to the email: def invoice(invoice) attachment :content_disposition => "attachment", :body => InvoicePdf.new(invoice), :content_type => "application/pdf", …
alexs333
  • 12,143
  • 11
  • 51
  • 89
10
votes
2 answers

Using Prawn on Heroku

We are currently working on a Rails application hosted on Heroku. We are trying to generate a PDF and push it to the user to download. We are using Prawn to handle the PDF generation. Our code for generating the PDF is…
Matt K
  • 147
  • 12
10
votes
1 answer

Prawn PDF table mixed formats

I am trying to generate a simple table in ruby with prawn pdf. I need some text in a cell to be bold, and some to be not bold. For example: Now following some examples, I have the basic table rendering with this code: pdf.table([ ["1. Row example…
Chris
  • 6,076
  • 11
  • 48
  • 62
9
votes
3 answers

Rails/Prawn: how do I use rails helpers inside a Prawn class?

I'm trying to use rails 3.2 helpers inside a prawn class, but rails throws: undefined method `number_with_precision' for # Prawn Class class QuotePdf < Prawn::Document def initialize(quote) super() text "sum:…
Laura
  • 4,199
  • 6
  • 23
  • 24
9
votes
1 answer

RAILS_ROOT not longer valid when loading images with the prawnto_2 gem

I'm in the process of upgrading my app from Rails 3.0 to Rails 3.1. I've binned my old plugins in favour of gems where possible and that includes replacing the old prawnto plugin with this nice shiny new prawnto_2 gem. Most things seem fine, but I…
Simmo
  • 1,717
  • 19
  • 37
9
votes
2 answers

rails gem prawn, image and anchor

Can you tell me how to insert image which will be a link to for example page 20? I know how to make with normal text: text "Go to page 20", :inline_format=>true and then on page 20 I have add_dest('page20',…
user958949
  • 151
  • 4
9
votes
1 answer

Prawn: Is there a way for vertical alignment of all content in a box?

I'm trying to position some content vertically centered in a bounding_box. With a single text this is no problem: bounding_box([0, bounds.top], :width => pdf.bounds.right, :height => pdf.bounds.top) do text "vertically aligned in the surrounding…
Chris Crown
  • 304
  • 2
  • 13
9
votes
3 answers

How to make a bold header in a Prawn table

I'm using Prawn and need to make the Header row bold but I can't find any solution in the API. Here you can see my current table with normal text Headers pdf.table (Data, :header => true) do table.header=(["Header1", "Header2", "Header3",…
Hunter001
  • 231
  • 2
  • 7
9
votes
3 answers

How to set table headers in Prawn?

I'm following this tutorial to create a pdf file using prawn gem, and I found this reference documentation to generate a table. How do I set the header row and the header titles to each column? invoiceData = [["foo","bar"]] pdf.table(invoiceData) do…
Mr_Nizzle
  • 6,644
  • 12
  • 55
  • 85
9
votes
1 answer

How to convert Base64 string to pdf file using prawn gem

I want to generate pdf file from DB record. Encode it to Base64 string and store it to DB. Which works fine. Now I want reverse action, How can I decode Base64 string and generate pdf file again? here is what I tried so far. def data_pdf_base64 …
Gagan Gami
  • 10,121
  • 1
  • 29
  • 55
9
votes
1 answer

How can I change the orientation of existing pdf using prawn?

I have a pdf file. I want to rotate all of its pages 90 degrees to the right. How can I achieve this using Prawn gem? When I try to use an existing pdf as a template and try rotate on it, it does not work. I tried the following in vain. require…
dknight
  • 1,243
  • 10
  • 23
9
votes
3 answers

Generating a PDF With Images from Base64 with Prawn

I am trying to save multiple pngs in one pdf. I'm receiving the PNGs from an API Call to the Endicia Label Server, which is giving me a Base64 Encoded Image as response. Based on this Question: How to convert base64 string to PNG using Prawn without…
Martin Lang
  • 831
  • 11
  • 20
8
votes
1 answer

Prawn does not render a PDF on Heroku, but does it local

As the title says: My PDFs are perfectly rendered when I run on my server locally, but on Heroku I get a NoMethodError. It seems that Heroku cannot find my prawn gem. I am using the prawn-rails gem. Any ideas? I have uploaded the complete…
d135-1r43
  • 2,485
  • 1
  • 25
  • 33
8
votes
3 answers

Prawn with some emojis for ttf-font not rendering text correctly

I have a ruby script to generate a pdf document with some text. The text contains emojis in it. The problem with the first line of text is that it prints the three emojis separated by something that looks like a cross when they should be a single…
8
votes
3 answers

How to replace a word in an existing PDF using Ruby Prawn?

-Hello Sandeep here. I am an apprentice to the Jedi Master Yoda. My master believes the force is strong in the Ruby community and has chosen me for a simple task to complete using the Ruby langauge: I need to use the Prawn PDF gem to accomplish the…
Sandeep
  • 223
  • 3
  • 5
1 2
3
46 47