Class: Pdf
- Inherits:
-
Object
- Object
- Defined in:
- lib/documenter/pdf.rb
Constant Summary collapse
- @@exe =
pass to localy installed pdftk
File.dirname(__FILE__)+'/pdftk/pdftk.exe'
Class Method Summary collapse
-
.burst(file, pattern) ⇒ Object
cut file to single pages.
-
.cat(pdfs, output) ⇒ Object
join array of pdfs filenames to one output file.
Class Method Details
.burst(file, pattern) ⇒ Object
cut file to single pages
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/documenter/pdf.rb', line 14 def self.burst file, pattern system("#{@@exe} #{file} burst") Dir.new(".").each do |file| if (file =~ /pg_[0-9]*\.pdf/) number = file.match(/[0-9]{4}/)[0].to_i new_file = pattern % number File.move file, new_file end end end |
.cat(pdfs, output) ⇒ Object
join array of pdfs filenames to one output file
9 10 11 |
# File 'lib/documenter/pdf.rb', line 9 def self.cat pdfs, output system("#{@@exe} #{pdfs*' '} cat output #{output} compress dont_ask ") end |