Skip to content

Predefined Annotations

The ComPDFKit PDF SDK provides default values for annotation properties (e.g., color and line width for Ink annotations). All of these are handled in CPDFAnnotAttribute. The current set of default values is configured during the first run and saved in CPDFAnnotAttribute.

java
```java
CPDFAnnotAttribute attribute = readerView.getReaderAttribute().getAnnotAttribute();
// Highlight annotation properties
CPDFHighlightAttr highlightAttr = attribute.getHighlightAttr();
highlightAttr.setColor(Color.BLUE);
highlightAttr.setAlpha(128);
// Save the configured properties
highlightAttr.onstore();

// Square annotation properties
CPDFSquareAttr squareAttr = attribute.getSquareAttr();
squareAttr.setFillColor(Color.RED);
squareAttr.setFillAlpha(255);
squareAttr.setBorderColor(Color.BLUE);
squareAttr.setBorderAlpha(255);
squareAttr.setBorderWidth(5);
squareAttr.onstore();
kotlin
val attribute = cpdfReaderView.readerAttribute.annotAttribute
attribute.highlightAttr.apply { 
    color = Color.BLUE
    alpha = 128
    // Save the configured properties
    onstore()
}

// Square annotation properties
attribute.squareAttr.apply {
    fillColor = Color.RED
    fillAlpha = 255
    borderColor = Color.BLUE
    borderAlpha = 255
    borderWidth = 5f
    onstore()
}
TypeClass
CPDFAnnotation.Type.TEXTCPDFTextAttr
CPDFAnnotation.Type.HIGHLIGHTCPDFHighlightAttr
CPDFAnnotation.Type.UNDERLINECPDFUnderlineAttr
CPDFAnnotation.Type.SQUIGGLYCPDFSquigglyAttr
CPDFAnnotation.Type.STRIKEOUTCPDFStrikeoutAttr
CPDFAnnotation.Type.INKCPDFInkAttr
CPDFAnnotation.Type.CIRCLECPDFCircleAttr
CPDFAnnotation.Type.SQUARECPDFSquareAttr
CPDFAnnotation.Type.LINECPDFLineAttr
CPDFAnnotation.Type.FREETEXTCPDFFreetextAttr
CPDFAnnotation.Type.SIGNATURECPDFStampAttr
CPDFAnnotation.Type.STAMPCPDFStampAttr
CPDFWidget.WidgetType.Widget_TextFieldCPDFTextfieldAttr
CPDFWidget.WidgetType.Widget_PushButtonCPDFPushButtonAttr
CPDFWidget.WidgetType.Widget_CheckBoxCPDFCheckboxAttr
CPDFWidget.WidgetType.Widget_RadioButtonCPDFRadiobuttonAttr
CPDFWidget.WidgetType.Widget_ComboBoxCPDFComboboxAttr
CPDFWidget.WidgetType.Widget_ListBoxCPDFListboxAttr
CPDFWidget.WidgetType.Widget_SignatureFieldsCPDFSignatureWidgetAttr