public
Description: RGhost is a document creation and conversion API. It uses the Ghostscript framework for the format conversion, utilizes EPS templates and is optimized to work with larger documents. Support(PDF,PS,GIF,TIF,PNG,JPG,etc)
Home | Edit | New

Printing text from file

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
Last edited by shairontoledo, Mon Dec 22 05:40:57 -0800 2008
Home | Edit | New
Versions: