Class: PDFRavager::Strategies::AcroForm

Inherits:
Object
  • Object
show all
Defined in:
lib/pdf_ravager/strategies/acro_form.rb

Instance Method Summary collapse

Constructor Details

#initialize(stamper) ⇒ AcroForm

Returns a new instance of AcroForm.



4
5
6
7
# File 'lib/pdf_ravager/strategies/acro_form.rb', line 4

def initialize(stamper)
  @stamper = stamper
  @afields = stamper.getAcroFields
end

Instance Method Details

#set_field_values(template) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/pdf_ravager/strategies/acro_form.rb', line 9

def set_field_values(template)
  template.fields.select{|f| f.respond_to?(:acro_form_value)}.select do |f|
    begin
      @afields.setField(FieldTypes::AcroForm::SOM.short_name(f.acro_form_name), f.acro_form_value)
    rescue java.lang.NullPointerException
      false
    end
  end
end

#set_read_onlyObject



19
20
21
# File 'lib/pdf_ravager/strategies/acro_form.rb', line 19

def set_read_only
  @stamper.setFormFlattening(true)
end