Sha256: 5fc3adbe7b8b8dd969990f0f35bb27ca2db94db6fc6b4fb53c73300a555d3a47

Contents?: true

Size: 614 Bytes

Versions: 3

Compression:

Stored size: 614 Bytes

Contents

require 'ftools'


class Pdf
  # pass to localy installed pdftk
  @@exe = File.dirname(__FILE__)+'/pdftk/pdftk.exe'
  
  #join array of pdfs filenames to one output file
  def self.cat pdfs, output
    system("#{@@exe} #{pdfs*' '} cat output #{output} compress dont_ask ")
  end
  
  #cut file to single pages
  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
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
documenter-0.0.5 lib/documenter/pdf.rb
documenter-0.0.4 lib/documenter/pdf.rb
documenter-0.0.3 lib/documenter/pdf.rb