convert.rb

Path: convert.rb
Last Update: Fri May 09 16:47:16 -0300 2008

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

[Validate]