module HexaPDF:: Task:: MergeAcroForm
Task
for merging an AcroForm from one PDF into another.
It takes care of
-
adding the fields to the main
Type::AcroForm::Form
dictionary, -
adjusting the field names so that they are unique,
-
and merging the properties of the main AcroForm dictionary itself and adjusting field information appropriately.
Note that the pages with the fields need to be imported already.
The steps for using this task are:
-
Import the pages into the target document and add all imported pages to an array
-
Call this task using the created array of pages.
Example:
pages = doc.pages.map {|page| target.pages.add(target.import(page)) }
target.task(:merge_acro_form, source: doc, pages: pages)
Public Class Methods
Performs the necessary steps to merge the AcroForm fields from the source
into the target document doc
.
source
-
Specifies the source PDF document the information from which should be merged into the target document.
pages
-
An array of pages that were imported from
source
and contain the widgets of the fields that should be merged.
Fixes the calculate actions listed in the /CO entry of the main AcroForm dictionary to use the new names of the fields.
Merges the AcroForm source_form
into the target_form
and returns a mapping of old font names to new ones.