Class: CorpPdf::Actions::RemoveField
- Inherits:
-
Object
- Object
- CorpPdf::Actions::RemoveField
- Includes:
- Base
- Defined in:
- lib/corp_pdf/actions/remove_field.rb
Overview
Action to remove a field from a PDF document
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(document, field) ⇒ RemoveField
constructor
A new instance of RemoveField.
Methods included from Base
#acroform_ref, #apply_patch, #find_page_by_number, #get_object_body_with_patch, #next_fresh_object_number, #patches, #resolver
Constructor Details
#initialize(document, field) ⇒ RemoveField
Returns a new instance of RemoveField.
9 10 11 12 |
# File 'lib/corp_pdf/actions/remove_field.rb', line 9 def initialize(document, field) @document = document @field = field end |
Instance Method Details
#call ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/corp_pdf/actions/remove_field.rb', line 14 def call af_ref = acroform_ref return false unless af_ref # Step 1: Remove widget annotations from pages' /Annots arrays # Step 2: Remove from /Fields array remove_from_fields_array(af_ref) # Step 3: Mark the field object as deleted by setting /T to empty mark_field_deleted true end |