Sha256: 3dfd32df322dffab577620c8484e490c2a21fa6b73800ebf79e1039c103a07c8

Contents?: true

Size: 782 Bytes

Versions: 1

Compression:

Stored size: 782 Bytes

Contents

require 'java'
require File.dirname(__FILE__)  + '/../../../vendor/iText-4.2.0'

module PDFRavager
  module FieldTypes
    module AcroForm

      module SOM
        def self.short_name(str)
          com.lowagie.text.pdf.XfaForm::Xml2Som.getShortName(self.escape(str))
        end

        def self.escape(str)
          com.lowagie.text.pdf.XfaForm::Xml2Som.escapeSom(str) # just does: str.gsub(/\./) { '\\.' }
        end
      end

      def acro_form_name
        @name
      end

      def acro_form_value
        @value.to_s
      end

      def set_acro_form_value(acro_fields)
        begin
          acro_fields.setField(SOM.short_name(acro_form_name), acro_form_value)
        rescue java.lang.NullPointerException
          false
        end
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pdf_ravager-0.1.0 lib/pdf_ravager/field_types/acro_form.rb