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
8
votes
1 answer

Image not rendered in prawn pdf using AngularJs

I have a ReportPdf inherited from Prawn::Document. When I test it from Rails console, The embedded png image in pdf rendered correctly. ReportPdf.new(param1,param2).render_file('/Users/ZZ/Desktop/test.pdf') However, when it is requested from…
Zzz
  • 1,703
  • 1
  • 14
  • 21
8
votes
1 answer

I'm trying to create PDF's with Prawn, but I get: Prawn::Errors::UnrecognizedTableContent

I'm following this railscasts #153, and I'm trying to add table data to prawn. I keep getting this error: Prawn::Errors::UnrecognizedTableContent
Aaron
  • 667
  • 4
  • 19
8
votes
2 answers

Adding metadata to PDF

I need to add metadata to a PDF which I am creating using prawn. That meta-data will be extracted later by, probably, pdf-reader. This metadata will contain internal document numbers and other information needed by downstream tools. It would be…
Wayne Conrad
  • 103,207
  • 26
  • 155
  • 191
8
votes
4 answers

Prawn: Table of content with page numbers

I need to create a table of contents with Prawn. I have add_dest function calls in my code and the right links in the table of content: add_dest('Komplett', dest_fit(page_count - 1)) and text "* Vollstaendiges…
Dirk Beerbohm
  • 93
  • 2
  • 8
8
votes
1 answer

How to Wrap By Words in Prawn Table

I would like to create a prawn table where cell text is wrapped by words and not letters. I am already using shrink_to_fit, but it seems that prawn is wrapping based on letters. I would ideally want it to wrap on words alone (single_line is not an…
Spyros
  • 46,820
  • 25
  • 86
  • 129
7
votes
3 answers

Rails 3 Render Prawn pdf in ActionMailer

How to render prawn pdf as attachment in ActionMailer? I use delayed_job and don't understand, how could I render pdf-file in action mailer (not in controller). What format should I use?
maxs
  • 427
  • 1
  • 6
  • 15
7
votes
1 answer

Prawn PDF line fit to bounding box

Is there a way to adjust xy coordinates to fit within a bounding box in Prawn PDF if they are larger then the height of the box? I'm using the gem 'signature-pad-rails' to capture signatures which then stores the…
DollarChills
  • 1,076
  • 1
  • 15
  • 33
7
votes
3 answers

Ruby - How to use different fonts in Prawn?

I have a small Ruby program where I'm printing some text out to a PDF using Prawn, but a small portion of the text is non-English characters. (Some of that text is Chinese, some is Greek, etc.). When I run my program, I of course get an error saying…
Reign
  • 101
  • 1
  • 2
  • 5
7
votes
4 answers

What is the best way to generate PDF/HTML/DOCX in Ruby/Rails

I need to create an app which makes auto-generated CVs from fields. I need to convert them in PDF/HTML/DOC, but there are many gems available. Which gem do you think is the most appropriate in order to make CV in PDF, HTML and DOC formats? I found…
Théo Capdet
  • 1,042
  • 3
  • 18
  • 34
7
votes
1 answer

Debugging Prawn reached end of graphics state stack

class Report attr_reader :pdf def to_pdf Prawn::Document.new(page_layout: page_layout) do |pdf| @pdf = pdf pdf.repeat(:all) do frame_page end pdf.repeat(:all) do write_header end …
quantumpotato
  • 9,637
  • 14
  • 70
  • 146
7
votes
2 answers

How to install Prawn for Rails 4

Hi I'm trying to implement downloading a PDF receipt. I'm not sure how to integrate Prawn with Rails 4 app and I couldn't find any tutorials on how to do this. Please see below for things that I have done. Could someone please suggest some articles…
Pan Wangperawong
  • 1,250
  • 2
  • 13
  • 29
7
votes
1 answer

Why does Prawn resize my image automatically?

When I try to insert an image (PNG at 72dpi) using Prawn, like this: image "#{Rails.root}/public/images/pdf/logo.png" Prawn inserts the image but scales it up by about 30% which makes it blurry (and bigger.) I dont have anything else in the file…
Alain
  • 1,251
  • 1
  • 14
  • 32
7
votes
1 answer

Is it possible to render blob images in a prawn document?

I´m willing to use Gruff to render some graphics inside prawn documents. I want to avoid the delay of writing images to the disk only for them to be read by Prawn. Gruff offers the to_blob method that renders the graph image as a blob in memory, but…
Ricardo Acras
  • 35,784
  • 16
  • 71
  • 112
6
votes
3 answers

Ruby on Rails & Prawn PDF - Create Customer List

I'm trying to produce a PDF report with Prawn, I can get it to do a report on a show action easily enough by passing the single ID but I want to produce one with every record in it. Like a standard rails scaffold index page. Using rails it would…
nicktabs
  • 105
  • 2
  • 6
6
votes
3 answers

How to center table in prawn?

I have created a table in prawn and wanted to pass the :position option by whih is also documented in the manual but it throws off an Method_missing error. It seems like this parameter doesnt exist anymore. How can I center a table in prawn?
davidb
  • 8,884
  • 4
  • 36
  • 72