Sha256: d2dd168785686b2fa3cabe5b221dbbbf62ddf094380aec946b8ae21d52499655

Contents?: true

Size: 569 Bytes

Versions: 1

Compression:

Stored size: 569 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.close
      pdf
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
medivo-0.1.7 lib/pdf/medivo/pdf_generator.rb