Solved

using pdf and prawn

Posted on 2011-03-10
3
379 Views
Last Modified: 2012-05-11
Hello
First time trying to use PDF (playtime) - see below and should be self explanatory.

require 'prawn'

ma=[1,2,3,4]
maa=[]
ma.each{|z| maa<<z}

mt=[]
File.open("c:/t.txt").each do
      |z| mt<<z
end

Prawn::Document.generate("c:/simple_table.pdf") do

text "the array values are #{ma}"
text "\n"
text "#{mt}"
text "\n"

start_new_page  
text "bai"  
start_new_page  
text "-- Hai again"  
number_pages "<page> in a total of <total>", [bounds.right - 50, 0]  
end
#####################
Output to PDF is as ....
the array values are [1, 2, 3, 4]

["the rain in Spain\n", "falls mainly on the plain\n", "when will\n", "you ever learn"]

What I want is ....

the array values are [1, 2, 3, 4]

the rain in Spain
falls mainly on the plain
when will
you ever learn
0
Comment
Question by:philsivyer
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
lusfernandos earned 500 total points
ID: 35097962
Hi,

  Some time back I started using prawn. I got it working, however  I decided to changed and use wicked pdf. I believe it was the best thing I did.
  While you are still evaluating, please take a look at:
http://mileszs.com/blog/2009/06/17/wicked-pdf-plugin.html
0
 

Author Closing Comment

by:philsivyer
ID: 35139462
Thanks
0
 
LVL 2

Expert Comment

by:lusfernandos
ID: 35140572
thank you for the points. Hope it helped you.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: narshlob
If you've ever programmed in Ruby and have come across either a proc or a lambda, you might have been wondering what the difference is between the two and when you would use one over the other. This article will try to explain the difference between…
In Ruby, Call or invoke a API DLL library is easily via Win32API class, win32-api gem or other gems. For general DLL API call, there are quite a few references, some good tips list below: http://www.rubytips.org/2008/05/13/accessing-windows-api-fro…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question