Class CPDFWidget

java.lang.Object
com.compdfkit.core.annotation.CPDFAnnotation
com.compdfkit.core.annotation.form.CPDFWidget
Direct Known Subclasses:
CPDFCheckboxWidget, CPDFPushbuttonWidget, CPDFRadiobuttonWidget, CPDFSignatureWidget, CPDFTextWidget, CPDFWidgetItems

public abstract class CPDFWidget extends CPDFAnnotation
A visible form control. Every form element has a single parent CPDFWidget. Each form element is associated with a single CPDFAnnotation that is a visual representation of the form element in the document.
  • Method Details

    • getWidgetType

      public CPDFWidget.WidgetType getWidgetType()
      Gets form types, refer to: CPDFWidget.WidgetType
      Returns:
      Returns form types.
    • setFieldName

      public boolean setFieldName(String fieldName)
      Sets internal name for the field.
      Parameters:
      fieldName - Internal name for the field.
      Returns:
      Whether to successfully set internal name for the field.
    • getFieldName

      public String getFieldName()
      Gets internal name for the field.
      Returns:
      Returns internal name for the field.
    • setFieldFlag

      public boolean setFieldFlag(int flag)
      Sets form flag.
      Parameters:
      flag - Form flag.
      Returns:
      Whether to successfully set form flag.
    • getFieldFlag

      public int getFieldFlag()
      Gets form flag.
      Returns:
      Returns form flag.
    • isReadOnly

      public boolean isReadOnly()
    • setReadOnly

      public boolean setReadOnly(boolean isReadOnly)
    • setFieldType

      public boolean setFieldType(String fieldType)
      Not in use currently
      Parameters:
      fieldType - Form type
      Returns:
      Whether to successfully set form type.
    • getFieldType

      public String getFieldType()
      Not in use currently
      Returns:
      Form type
    • setFillColor

      public boolean setFillColor(int color)
      Sets the background color of the form.
      Parameters:
      color - Background color.
      Returns:
      Returns whether to successfully set background color for the form.
    • getFillColor

      public int getFillColor()
      Gets the background color of the form.
      Returns:
      Returns the background color of the form.
    • clearFillColor

      public boolean clearFillColor()
      Clear the background color of the form.
      Returns:
      Returns a value of boolean:whether to successfully clear the background.
    • setBorderColor

      public boolean setBorderColor(int color)
      Sets the border color of the form.
      Parameters:
      color - Border color.
      Returns:
      Whether to successfully set border color value of the form.
    • getBorderColor

      public int getBorderColor()
      Gets the border color of the form.
      Returns:
      Returns the background color of the form.
    • clearBorderColor

      public boolean clearBorderColor()
      Clear the border color of the form.
      Returns:
      Returns value of boolean:whether to successfully clear the border color of the form.
    • setBorderStyles

      public boolean setBorderStyles(CPDFWidget.BorderStyle borderStyle)
      Sets border style of the form.
      Parameters:
      borderStyle - Border style of the form.
      Returns:
      Returns whether to successfully set border style of the form.
    • getBorderStyles

      public CPDFWidget.BorderStyle getBorderStyles()
      Gets the border style of the form.
      Returns:
      Returns the border style of the form.
    • setCheckStyle

      public boolean setCheckStyle(CPDFWidget.CheckStyle checkStyle)
      Sets the check style of CheckBox or Radiobutton.
      Parameters:
      checkStyle - Check style of CheckBox or Radiobutton.
      Returns:
      Returns whether to successfully set the check style of CheckBox or Radiobutton.
    • getCheckStyle

      public CPDFWidget.CheckStyle getCheckStyle()
      Gets the check style of CheckBox or Radiobutton.
      Returns:
      Returns the check style of CheckBox or Radiobutton
    • getBorderWidth

      public float getBorderWidth()
      Gets the border width of the form.
      Returns:
      Returns the border width of the form.
    • setBorderWidth

      public boolean setBorderWidth(float width)
      Sets the border width of the form.
      Parameters:
      width - Border width of the form.
      Returns:
      Returns whether to successfully set the border width of the form.
    • setFillAlpha

      public boolean setFillAlpha(float filledTransparency)
      Sets the background opacity of the form.
      Parameters:
      filledTransparency - Opacity value. Value range 0-1.
      Returns:
      Returns whether to successfully set the background opacity of the form.
    • getFillAlpha

      public float getFillAlpha()
      Gets the background opacity of the form.
      Returns:
      Returns the background opacity value of the form, Value range 0-1.
    • updateAp

      public boolean updateAp()
      The updated form appearance does not support transparency.
      Returns:
      Returns whether to successfully update form appearance.
    • updateAp

      public boolean updateAp(boolean supportTransparency)
      Updates custom form appearance.
      Parameters:
      supportTransparency - Whether to support opacity.
      Returns:
      Returns whether to successfully update form appearance.
    • resetForm

      public boolean resetForm()
      Resets forms.
      Returns:
      Returns whether to reset forms.
    • setRect

      public boolean setRect(RectF rect)
      Sets annotation rectangle. The page coordinate system has its origin at the left-bottom corner of the page, with the X-axis on the bottom going to the right, and the Y-axis on the left side going up. The device coordinate system is device dependent. For screen device, its origin is at the left-top corner of the window.
      Overrides:
      setRect in class CPDFAnnotation
      Parameters:
      rect - Rectangle on the page.
      Returns:
      Returns whether to successfully set annotation rectangle.
    • getRect

      public RectF getRect()
      Gets annotation rectangle. The page coordinate system has its origin at the left-bottom corner of the page, with the X-axis on the bottom going to the right, and the Y-axis on the left side going up. The device coordinate system is device dependent. For screen device, its origin is at the left-top corner of the window.
      Overrides:
      getRect in class CPDFAnnotation
      Returns:
      Returns rectangle on the page.