Class: RGhost::Convert
- Inherits:
-
Object
- Object
- RGhost::Convert
- Defined in:
- lib/rghost/convert.rb
Overview
Convert PDF file to another format using commom render parameters of the Engine A additional parameter for this method is :range. Below someone examples:
====Only cover page Convert.new("/dir/myfile.pdf").to :jpeg, :filename => "/tmp/test.jpg"
====One page per file It's generate file with pattern test_0001.png, test_0002.png, etc Convert.new("/dir/myfile.pdf").to :png, :multipage => true, :filename => "/tmp/test.png"
====One page per file with page range Convert.new("/dir/myfile.pdf").to :eps, :multipage => true, :filename => "/tmp/test.eps", :range => 1..5
====Getting files after convertion files=Convert.new("/dir/myfile.pdf").to :eps, :multipage => true, :filename => "/tmp/test.eps", :range => 1..5 files.class # => Array because parameter multipage is true
file=Convert.new("/dir/myfile.pdf").to :eps, :filename => "/tmp/test.eps" file.class # => File
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
-
#initialize(filename) ⇒ Convert
constructor
A new instance of Convert.
- #to(device, options = {}) ⇒ Object
Constructor Details
#initialize(filename) ⇒ Convert
Returns a new instance of Convert.
25 26 27 28 29 |
# File 'lib/rghost/convert.rb', line 25 def initialize(filename) @filename=filename end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
22 23 24 |
# File 'lib/rghost/convert.rb', line 22 def error @error end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
22 23 24 |
# File 'lib/rghost/convert.rb', line 22 def errors @errors end |
Instance Method Details
#to(device, options = {}) ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/rghost/convert.rb', line 32 def to(device, ={}) rge=RGhost::Engine.new(@filename,{:convert=>true}.merge()) out=rge.render(device) @error=rge.error @errors=rge.errors out end |