Skip to content

Printing text from file

shairontoledo edited this page Sep 13, 2010 · 1 revision

Prints the text file using the predefined tag :pre

Example

doc=RGhost::Document.new :paper => :A4, :landscape => true
doc.print_file "/etc/passwd"
doc.render :pdf, :filename => "/tmp/passwd.pdf

or

doc=Document.new :paper => :A4, :landscape => true
File.readlines("/etc/passwd").each {|line| doc.show_next_row(line) }
doc.render :pdf, :filename => "/tmp/passwd.pdf

Another way

doc=Document.new :paper => :A4, :landscape => true
doc.text File.readlines.join('<br/>')
doc.render :pdf, :filename => "/tmp/passwd.pdf