3

I have implemented CSV export, and now I am trying to export data to PDF.

How can one export the CSV data from the CSV generated file to PDF.

Thanks.

Christian Fazzini
  • 19,613
  • 21
  • 110
  • 215
lamrin
  • 1,431
  • 4
  • 22
  • 34

2 Answers2

4

You can use prawn https://github.com/sandal/prawn to generate pdfs in ruby with some code like:

require 'prawn'
pdf = Prawn::Document.new
pdf.text(my_csv_data)
pdf.render_file('csv.pdf')

There is also a tutorial here: http://railstips.org/blog/archives/2008/10/13/how-to-generate-pdfs-in-rails-with-prawn/

Andrew Nesbitt
  • 5,976
  • 1
  • 32
  • 36
0

You can use PDFKit Try these link s:

http://rubygems.org/gems/pdfkit

https://github.com/grosser/PDFKit/

Ashish
  • 5,723
  • 2
  • 24
  • 25