On this page
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()
}
Classes Related to Default Properties
Type | Class |
---|---|
CPDFAnnotation.Type.TEXT | CPDFTextAttr |
CPDFAnnotation.Type.HIGHLIGHT | CPDFHighlightAttr |
CPDFAnnotation.Type.UNDERLINE | CPDFUnderlineAttr |
CPDFAnnotation.Type.SQUIGGLY | CPDFSquigglyAttr |
CPDFAnnotation.Type.STRIKEOUT | CPDFStrikeoutAttr |
CPDFAnnotation.Type.INK | CPDFInkAttr |
CPDFAnnotation.Type.CIRCLE | CPDFCircleAttr |
CPDFAnnotation.Type.SQUARE | CPDFSquareAttr |
CPDFAnnotation.Type.LINE | CPDFLineAttr |
CPDFAnnotation.Type.FREETEXT | CPDFFreetextAttr |
CPDFAnnotation.Type.SIGNATURE | CPDFStampAttr |
CPDFAnnotation.Type.STAMP | CPDFStampAttr |
CPDFWidget.WidgetType.Widget_TextField | CPDFTextfieldAttr |
CPDFWidget.WidgetType.Widget_PushButton | CPDFPushButtonAttr |
CPDFWidget.WidgetType.Widget_CheckBox | CPDFCheckboxAttr |
CPDFWidget.WidgetType.Widget_RadioButton | CPDFRadiobuttonAttr |
CPDFWidget.WidgetType.Widget_ComboBox | CPDFComboboxAttr |
CPDFWidget.WidgetType.Widget_ListBox | CPDFListboxAttr |
CPDFWidget.WidgetType.Widget_SignatureFields | CPDFSignatureWidgetAttr |