Table of Contents

Class PdfFormFieldMergeUtil

Namespace
iText.Forms.Fields
Assembly
itext.forms.dll

Utility class to merge form fields PdfFormField with the same names.

public sealed class PdfFormFieldMergeUtil
Inheritance
PdfFormFieldMergeUtil
Inherited Members

Methods

GetPartialName(AbstractPdfFormField)

Gets partial name for the field dictionary.

public static string GetPartialName(AbstractPdfFormField field)

Parameters

field AbstractPdfFormField

field to get name from.

Returns

string

field partial name. Also, null if passed dictionary is a pure widget, empty string in case it is a field with no /T entry.

MergeFormFields(PdfFormField, PdfFormField, bool)

This method combines two form fields.

public static void MergeFormFields(PdfFormField firstField, PdfFormField secondField, bool throwExceptionOnError)

Parameters

firstField PdfFormField

first form field to be merged

secondField PdfFormField

second form field to be merged

throwExceptionOnError bool

define whether exception (true) or log (false) is expected in case kid with the same name exists and merge of two kids failed.

MergeKidsWithSameNames(PdfFormField, bool)

This method merges all kids with the same names for the given parent field dictionary (recursively).

public static void MergeKidsWithSameNames(PdfFormField parentField, bool throwExceptionOnError)

Parameters

parentField PdfFormField

a field whose kids should be checked and merged in case of same partial names.

throwExceptionOnError bool

true if the exception is expected after the merge failed, false if log is expected.

MergeTwoFieldsWithTheSameNames(PdfFormField, PdfFormField, bool)

This method merges different values from two field dictionaries into the first one and combines kids.

public static bool MergeTwoFieldsWithTheSameNames(PdfFormField firstField, PdfFormField secondField, bool throwExceptionOnError)

Parameters

firstField PdfFormField

a field into which dictionary all values will be merged.

secondField PdfFormField

a field whose values should be merged into the first dictionary.

throwExceptionOnError bool

true if the exception is expected after the merge failed, false if log is expected.

Returns

bool

true if fields is successfully merged, false otherwise.

ProcessDirtyAnnotations(PdfFormField, bool)

Sometimes widgets contain field related keys, and they are the same as these field keys at parent.

public static void ProcessDirtyAnnotations(PdfFormField parentField, bool throwExceptionOnError)

Parameters

parentField PdfFormField

a field whose form field kids should be checked and merged with parent in case all their dictionary values (except Parent and Kids) are the same or parent is a radio button.

throwExceptionOnError bool

true if the exception is expected after the merge failed, false if log is expected.

Remarks

Sometimes widgets contain field related keys, and they are the same as these field keys at parent. During merge process we get something like: ParentField (/DA <DA1> /Ft <Tx> /T <test> /Kids <Field>) -> Field (/DA <DA1> /Kids <Annotation>) -> Annotation (without any form fields)

This method combines ParentField with Field.