prawnto

Prawn + Prawnto Issue

做~自己de王妃 提交于 2019-12-25 03:23:06
问题 I know prawn is working because I have a show action that if I add .pdf on to the end of it loads show.pdf.prawn. However, I have a form: <%= form_tag(:controller => "/holders", :action=> "generate", format: "pdf") do %> <%= label_tag(:count, "How Many Students?") %> <%= text_field_tag(:count) %> <%= hidden_field_tag :holder_id, value: @holder%> <%= submit_tag("Generate Course Lesson") %> <% end %> That submits count to the the generate action. Inside my generate action I have the following:

Prawn: float text automatically to a new page

强颜欢笑 提交于 2019-12-24 06:47:46
问题 I have following simple code to generate a pdf. def employe_details y = cursor bounding_box([0, y], :width => 16.cm) do @employe.each do |pr| txt = pr.week.to_s + ' ' txt += "work hours" text_box txt, size: 11, :at => [0.5.cm, cursor] move_down 0.4.cm end .#more similar texts . . end Problem is, this doesn't create a new page automatically. When the text exceeds first page, rest of the text doesn't show at all or those texts does not show up in a new page. How to float the texts automatically

Prawn & Prawnto Rails PDF generation - UTF-8?

不想你离开。 提交于 2019-12-21 04:21:43
问题 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 of characters. Prawn brags on its homepage about UTF-8 support so I don't see why this is a problem. I'm using ruby 1.8.6 (engineyard). 回答1: For Unicode to work you need to load a TTF font that has the characters you require. The default Helvetica

Prawn & Prawnto Rails PDF generation - UTF-8?

允我心安 提交于 2019-12-21 04:21:14
问题 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 of characters. Prawn brags on its homepage about UTF-8 support so I don't see why this is a problem. I'm using ruby 1.8.6 (engineyard). 回答1: For Unicode to work you need to load a TTF font that has the characters you require. The default Helvetica

header and footer in Prawn PDF

你离开我真会死。 提交于 2019-12-17 21:49:03
问题 I have read through all relevant posts on Prawn but found no mentioning (even in Prawn's own documentation) of headers and footers. However, I did see a demo on Prawnto's own website about headers and footers. I copied the entire source of that demo just to see if it works but an error of undefined method "header" is complained about. Am I to understand that Prawn took out header and footer recently in the gem or is there something else I need to do first to use header and footer? The demo

Prawn html formatting

本小妞迷上赌 提交于 2019-12-12 09:41:46
问题 I have some simple lists and bold/italic text to format with prawn. How do I get prawn to pay attention to the html tags instead of just displaying them explicitly. If prawn can't do this, what are my other options? 回答1: Inline formatting has been completely re-instated in the development version of Prawn. You can use the code off of the stable branch (0.9.x) for stability, or track master, where we just merged inline styling support for tables. See notes at: http://wiki.github.com/sandal

RAILS_ROOT not longer valid when loading images with the prawnto_2 gem

廉价感情. 提交于 2019-12-12 09:36:09
问题 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 can't get images to load as before. The code in my PDF view is pdf.image open("#{RAILS_ROOT}/public/images/logo.png") but I get the following error uninitialized constant ActionView::CompiledTemplates::RAILS_ROOT I realise that the location of the

ruby prawn how to wrap text around an aligned right image?

こ雲淡風輕ζ 提交于 2019-12-11 02:12:30
问题 s it posible to align an image to the right and wrap text around the image like it is in html and css using the float:right property ? If so how do you do this ? I can align an image but dont't know how to wrap the text around it. The text is dynamic text therefore varies alot in length. Thanks alot Rick 回答1: One suggestion is to try nested bounding boxes. The main bounding box would have the text inside it. with at some point another bounding box for the image. Something along the lines of

prawnto displaying tables that don't break when new page

感情迁移 提交于 2019-12-09 06:29:14
问题 I have a variable number of tables with variable number of rows and I want to have them displaying one after the other but if a table doesn't fit on the current page put it on the next then continue on. I have put the table in a transaction so I can roll back then print it if the height will fit on curent page but how do I get the table height? I have this code at the moment pdf.transaction do pdf.table @data, :font_size => 12, :border_style => :grid, :horizontal_padding => 10, :vertical

Save a Prawn PDF as a Paperclip attachment?

无人久伴 提交于 2019-12-03 08:32:20
问题 I'm using Prawn and Prawnto to display a PDF-based reports to the user, but in some circumstances, I'd also like to save the PDF as an attachment to one of my models. I'm using Paperclip for all of my attachments. Does anyone have any suggestions on how to do this? Thanks! 回答1: When using prawnto you will need to eval the variables in the .pdf.prawn template. Second step is to mimic a real file for paperclip. Generating the PDF: #find the prawwnto template you want template = File.read("#