Package com.itextpdf.forms.fields
Class PdfFormAnnotationUtil
- java.lang.Object
-
- com.itextpdf.forms.fields.PdfFormAnnotationUtil
-
public final class PdfFormAnnotationUtil extends java.lang.Object
Utility class to work with widget annotationsPdfFormAnnotation
and its dictionaries.
-
-
Constructor Summary
Constructors Modifier Constructor Description private
PdfFormAnnotationUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static void
addNewWidgetToPage(PdfPage currentPage, PdfDictionary field, int annotIndex)
static void
addWidgetAnnotationToPage(PdfPage page, PdfAnnotation annotation)
Add widget annotation to the specified page.static void
addWidgetAnnotationToPage(PdfPage page, PdfAnnotation annotation, int index)
Add widget annotation to the specified page.static boolean
isPureWidget(PdfDictionary fieldDict)
Check that <PdfDictionary> object is pure widget annotation.static boolean
isPureWidgetOrMergedField(PdfDictionary fieldDict)
Check that <PdfDictionary> object is widget annotation or merged field.static void
mergeWidgetWithParentField(PdfFormField field)
Merge single widget annotation with its parent field.private static void
replaceAnnotationOnPage(PdfDictionary oldAnnotDict, PdfDictionary newAnnotDict)
static void
separateWidgetAndField(PdfFormField field)
Separate merged field to form field and pure widget annotation.
-
-
-
Method Detail
-
isPureWidgetOrMergedField
public static boolean isPureWidgetOrMergedField(PdfDictionary fieldDict)
Check that <PdfDictionary> object is widget annotation or merged field.- Parameters:
fieldDict
- field dictionary to check.- Returns:
- true if passed dictionary is a widget or merged field, false otherwise.
-
isPureWidget
public static boolean isPureWidget(PdfDictionary fieldDict)
Check that <PdfDictionary> object is pure widget annotation.- Parameters:
fieldDict
- field dictionary to check.- Returns:
- true if passed dictionary is a widget, false otherwise.
-
addWidgetAnnotationToPage
public static void addWidgetAnnotationToPage(PdfPage page, PdfAnnotation annotation)
Add widget annotation to the specified page.- Parameters:
page
- to which annotation should be added.annotation
- widget annotation to add.
-
addWidgetAnnotationToPage
public static void addWidgetAnnotationToPage(PdfPage page, PdfAnnotation annotation, int index)
Add widget annotation to the specified page.- Parameters:
page
- to which annotation should be added.annotation
- widget annotation to add.index
- the index at which specified annotation will be added. If-1
then annotation will be added to the end of an array.
-
mergeWidgetWithParentField
public static void mergeWidgetWithParentField(PdfFormField field)
Merge single widget annotation with its parent field.- Parameters:
field
- parent field.
-
separateWidgetAndField
public static void separateWidgetAndField(PdfFormField field)
Separate merged field to form field and pure widget annotation. Do nothing if the incoming field is not merged field.- Parameters:
field
- to separate.
-
replaceAnnotationOnPage
private static void replaceAnnotationOnPage(PdfDictionary oldAnnotDict, PdfDictionary newAnnotDict)
-
addNewWidgetToPage
private static void addNewWidgetToPage(PdfPage currentPage, PdfDictionary field, int annotIndex)
-
-