Sha256: 96036a9e6955791ca18dcd6797f09f30ea570b4d7900051dc741e89d9a493018

Contents?: true

Size: 553 Bytes

Versions: 3

Compression:

Stored size: 553 Bytes

Contents

module Medivo
  class PdfGenerator

    ##
    # file_path  string  path to pdf file with variable fields
    # variables  hash    the hash of variables to fill in
    #
    # return  pdf      file handler
    def self.variable_fields(file_path, variables)
      raise "variables #{variables} should be a hash" unless variables.is_a? Hash
      pdf = Tempfile.new('pdf', :encoding => 'ascii-8bit')
      fdf = FdfGenerator.file(variables)
      system 'pdftk', file_path, 'fill_form', fdf.path, 'output', pdf.path, 'flatten'
      pdf
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
medivo-0.1.6 lib/pdf/medivo/pdf_generator.rb
medivo-0.1.5 lib/pdf/medivo/pdf_generator.rb
medivo-0.1.4 lib/pdf/medivo/pdf_generator.rb