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
14
votes
2 answers

prawn - import image from URL

I can't seem to figure out how to import an image from an url To import the images from my localhost I use: image"./assets/images/img.png" When I replace the path with an URL it says `image' : URL not found Is there a solution for this, or should…
Wijnand
  • 1,192
  • 4
  • 16
  • 28
13
votes
2 answers

Unable to render PDF to browser using Prawn PDF for Ruby on Rails

I am creating a pdf file in the latest version of the Prawn library (v1.0.1rc) in Rails (3.1.1) and when I run my code it generates the PDF into the root of the application. I don't want this. I want it to render the output into user's browser…
Betjamin
  • 785
  • 1
  • 7
  • 6
13
votes
4 answers

How do I change font in Prawn

What I'm trying to do is generate a PDF using Prawn, while having some language specific characters. And as a result I'm getting the following error: raise Prawn::Errors::IncompatibleStringEncoding, "Your document includes text that's not…
Catalin
  • 811
  • 2
  • 8
  • 18
13
votes
4 answers

How to handle a file_as_string (generated by Prawn) so that it is accepted by Carrierwave?

I'm using Prawn to generate a PDF from the controller of a Rails app, ... respond_to do |format| format.pdf do pdf = GenerateReportPdf.new(@object, view_context) send_data pdf.render, filename: "Report", type: "application/pdf",…
Andy Harvey
  • 12,333
  • 17
  • 93
  • 185
13
votes
5 answers

Controlling content flow with Prawn

Let's say we want to display a title on the first page that takes up the top half of the page. The bottom half of the page should then fill up with our article text, and the text should continue to flow over into the subsequent pages until it runs…
Yarin
  • 173,523
  • 149
  • 402
  • 512
13
votes
7 answers

Using lists in prawn

Im using prawn to create pdfs that contain much data in table format and some lists. The problem with the lists is that Im just using text as lists because there is no semantic equivalent to ul > li lists like I use them in the webfrointend. So the…
davidb
  • 8,884
  • 4
  • 36
  • 72
12
votes
1 answer

Add image in pdf using Prawn

I've a problem for adding images into a PDF using Prawn as pdf generator. I'm trying to add image using the following code: def header text "something" image "#{Prawn::DATADIR}/images/logo_small.png" end But app replies to me with the following…
Marco
  • 10,283
  • 4
  • 23
  • 22
12
votes
2 answers

How many fonts are available in Prawn?

I've been randomly trying fonts in Prawn, for Ruby. For Example: Times New Roman - Yes Palatino Linotype - No Is there a list of which fonts are available and which aren't?
Ray301
  • 296
  • 3
  • 15
12
votes
5 answers

Generate pdf from Rails 3 - what tool to choose?

I need to be able to render some views as PDFs from a Rails 3 project. I've never before used PDF generation techniques with ruby/rails, so I researched a few popular approaches such as Prawn and PDF::Writer, but all the examples and articles I…
svilenv
  • 1,484
  • 1
  • 11
  • 13
12
votes
1 answer

In Rails with the Prawn gem how to set the table width to 100%?

Im using the Prawn gem to generate a pdf table. I need to set the width of the table to 100%. How can I do this? Here's my slmun_pdf.rb class SlmunPdf < Prawn::Document def initialize(slmunDbs, view, allcount) if slmunDbs.table_name ==…
THpubs
  • 7,804
  • 16
  • 68
  • 143
12
votes
1 answer

Prawn doesn't draw a horizontal rule

I want to draw a simple horizontal rule. What I'm doing is: move_down 30 horizontal_rule and Gemfile gem 'prawn', :git => "https://github.com/prawnpdf/prawn.git", branch: 'master' It doesn't draw anything.
Alan Coromano
  • 24,958
  • 53
  • 135
  • 205
11
votes
2 answers

How can I do inline formatting (bold and underline) for PDF generated by Prawnto in Rails?

I generate a PDF file using Prawn and the Prawnto plugin in my rails application. I create a standard form with a standard textarea, and submit that as the body of the PDF file. However, I need to be able to format words and sentences…
Satchel
  • 16,414
  • 23
  • 106
  • 192
11
votes
1 answer

Inserting external PDF into Prawn generated document

How can I insert an existing PDF into a Prawn generated document? I am generating a pdf for a bill (as a view), and that bill can have many attachments (png, jpg, or pdf). How can I insert/embed/include those external pdf attachments in my generated…
Lee
  • 686
  • 1
  • 10
  • 23
11
votes
2 answers

Prawn & Prawnto Rails PDF generation - UTF-8?

I'm using ruby, prawn, and prawnto to dynamically generate pdf's containing text in other languages. I can't seem to get any text in languages with non-english characters to show up. It doesn't throw any errors...just shows a bunch of dashes instead…
tybro0103
  • 48,327
  • 33
  • 144
  • 170
11
votes
1 answer

Current Cursor Position when Using the Prawn Ruby Library

I'm using the Prawn Ruby library (http://prawn.majesticseacreature.com/) to generate some pdf documents. I draw a table without any problem. Next, I want to insert some lines after the table for various people's signatures. Before I draw the…
David
  • 1,188
  • 12
  • 15
1
2
3
46 47