Sha256: 9423681af6081557db30afef78942acd17703b7906e9fb1c7c9dc660d4a4f9b5

Contents?: true

Size: 592 Bytes

Versions: 1

Compression:

Stored size: 592 Bytes

Contents

module PDFRavager
  module Strategies
    class Smart
      def initialize(stamper)
        @acro_form = Strategies::AcroForm.new(stamper)
        @xfa       = Strategies::XFA.new(stamper)
      end

      def set_field_values(template)
        parsed_fields = @acro_form.set_field_values(template)
        unparsed_fields = template.fields - parsed_fields
        if unparsed_fields.any?
          @xfa.set_field_values(Template.new{|t| t.fields = unparsed_fields })
        end
      end

      def set_read_only
        [@acro_form, @xfa].each(&:set_read_only)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pdf_ravager-0.2.0 lib/pdf_ravager/strategies/smart.rb