Class: PDFRavager::Strategies::AcroForm
- Inherits:
-
Object
- Object
- PDFRavager::Strategies::AcroForm
- Defined in:
- lib/pdf_ravager/strategies/acro_form.rb
Instance Method Summary collapse
-
#initialize(stamper) ⇒ AcroForm
constructor
A new instance of AcroForm.
- #set_field_values(template) ⇒ Object
- #set_read_only ⇒ Object
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_only ⇒ Object
19 20 21 |
# File 'lib/pdf_ravager/strategies/acro_form.rb', line 19 def set_read_only @stamper.setFormFlattening(true) end |