public class

AnnotStyle

extends Object
java.lang.Object
   ↳ com.pdftron.pdf.model.AnnotStyle

Class Overview

This class contains annotation style information

Summary

Nested Classes
interface AnnotStyle.AnnotStyleHolder This interface is for holding annotation style  
interface AnnotStyle.OnAnnotStyleChangeListener This interface is used for changing annotation appearance  
Constants
int CUSTOM_ANNOT_TYPE_AREA_MEASURE The constant represents arrow annotation type
int CUSTOM_ANNOT_TYPE_ARROW The constant represents arrow annotation type
int CUSTOM_ANNOT_TYPE_CALLOUT The constant represents callout annotation type
int CUSTOM_ANNOT_TYPE_CLOUD The constant represents cloud annotation type
int CUSTOM_ANNOT_TYPE_ERASER The constant represents eraser annotation type
int CUSTOM_ANNOT_TYPE_FREE_HIGHLIGHTER The constant represents free highlighter annotation type
int CUSTOM_ANNOT_TYPE_PERIMETER_MEASURE The constant represents arrow annotation type
int CUSTOM_ANNOT_TYPE_RULER The constant represents arrow annotation type
int CUSTOM_ANNOT_TYPE_SIGNATURE The constant represents signature annotation type
Fields
public static String KEY_PDFTRON_RULER
public static String KEY_RULER_BASE
public static String KEY_RULER_BASE_UNIT
public static String KEY_RULER_TRANSLATE
public static String KEY_RULER_TRANSLATE_UNIT
Public Constructors
AnnotStyle()
Class constructor
AnnotStyle(AnnotStyle other)
Class constructor
Public Methods
void bindPreview(AnnotationPropertyPreviewView previewView)
Bind a preview view to this annotation style, whenever the annotation style updates, the preview updates
void disableUpdateListener(boolean disable)
Disable update annotation change listener
boolean equals(Object obj)
int getAnnotType()
The overload implementation of getToolMode().
AnnotationPropertyPreviewView getBindedPreview()
Gets binded preview
double getBorderEffectIntensity()
Gets the border effect intensity
int getColor()
Gets color of annotation style, for annotation style has border, it means stroke color
int getFillColor()
Gets fill color of annotation style
FontResource getFont()
Gets font for free text annotation
String getFontPath()
Gets font path of font.
String getIcon()
Gets Icon for StickyNote Text annotation
static Drawable getIconDrawable(Context context, String icon, int color, float opacity)
Gets icon drawable based on icon name, opacity
Drawable getIconDrawable(Context context)
Gets icon drawable
static Drawable getIconDrawable(Context context, String iconOutline, String iconFill, int color, float opacity)
Gets icon drawable based on icon name, opacity
float getOpacity()
Gets opacity of annotation style
String getOverlayText()
Gets overlay text.
String getPDFTronFontName()
Gets PDFTron font name for free text annotation.
int getPrecision()
String getRulerBaseUnit()
Gets the ruler base unit
float getRulerBaseValue()
Gets the ruler base value
RulerItem getRulerItem()
Gets the ruler item
String getRulerTranslateUnit()
Gets the ruler translate unit
float getRulerTranslateValue()
Gets the ruler translate value
boolean getSnap()
Gets whether snap to points
int getTextColor()
Gets text color of free text annotation style
String getTextContent()
Gets text content of free text annotation
String getTextHTMLContent()
float getTextSize()
Gets text size of free text annotation style
float getThickness()
Gets stroke thickness of annotation style
boolean hasColor()
Whether annotation style has color
boolean hasFillColor()
Whether annotation style has fill color
boolean hasFont()
Whether annotation style should have font.
boolean hasIcon()
Whether annotation style has icon
boolean hasOpacity()
Whether annotation style has opacity
boolean hasTextStyle()
Whether annotation style should have text style (i.e.
boolean hasThickness()
Whether annotation style has border thickness
int hashCode()
boolean isCallout()
boolean isFreeText()
Whether annotation style is freetext annotation
boolean isLine()
Whether annotation style is line annotation
boolean isMeasurement()
Whether annotation style is measurement annotation
boolean isRCFreeText()
boolean isRedaction()
Whether annotation style is redaction
boolean isRuler()
Whether annotation style is ruler
boolean isSound()
Whether annotation style is sound
boolean isStickyNote()
Whether annotation style is sticky note
boolean isWatermark()
Whether annotation style is watermark
boolean isWidget()
Whether annotation style is Widget annotation
static AnnotStyle loadJSONString(Context context, String jsonStr, int annotType)
Convert JSON String to annotation style
static AnnotStyle loadJSONString(String jsonStr)
Convert JSON String to annotation style
void setAnnotAppearanceChangeListener(AnnotStyle.OnAnnotStyleChangeListener listener)
Sets annotation style change listener
void setAnnotType(int annotType)
Sets annotation type, can be obtained from getType()
void setBorderEffectIntensity(double intensity)
Sets the border effect intensity
void setFillColor(int fillColor)
Sets fill color.
void setFont(FontResource font)
Sets font for FreeText annotation.
void setIcon(String icon)
Sets icon for Text annotation.
void setOpacity(float opacity)
Sets opacity for Markup annotation.
void setOpacity(float opacity, boolean done)
Sets opacity for Markup annotation.
void setOverlayText(String text)
Sets overlay text.
void setRulerBaseUnit(String unit)
Sets ruler base unit
void setRulerBaseValue(float value)
Sets ruler base value
void setRulerItem(RulerItem ruler)
Sets ruler properties
void setRulerPrecision(int precision)
void setRulerTranslateUnit(String unit)
Sets ruler translate unit
void setRulerTranslateValue(float value)
Sets ruler translate value
void setSnap(boolean snap)
Sets snap.
void setStrokeColor(int strokeColor)
Sets stroke color.
void setStyle(AnnotStyle other)
Copy other annotation style
void setStyle(int strokeColor, int fillColor, float thickness, float opacity)
Sets annotation style
void setTextColor(int textColor)
Sets text color for FreeText and Widget annotations.
void setTextContent(String content)
Sets content of FreeText annotation.
void setTextHTMLContent(String html)
void setTextSize(float textSize, boolean done)
Sets text size for FreeText annotation.
void setTextSize(float textSize)
Sets text size for FreeText annotation.
void setThickness(float thickness)
Sets stroke thickness.
void setThickness(float thickness, boolean done)
Sets stroke thickness.
String toJSONString()
Convert annotation style to string in json format
String toString()
void updateAllListeners()
void updateTextSizeListener(float textSize, boolean update, boolean done)
Update text size to listener
void updateThicknessListener(float thickness, boolean update, boolean done)
Update thickness to listener
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int CUSTOM_ANNOT_TYPE_AREA_MEASURE

The constant represents arrow annotation type

Constant Value: 1009 (0x000003f1)

public static final int CUSTOM_ANNOT_TYPE_ARROW

The constant represents arrow annotation type

Constant Value: 1001 (0x000003e9)

public static final int CUSTOM_ANNOT_TYPE_CALLOUT

The constant represents callout annotation type

Constant Value: 1007 (0x000003ef)

public static final int CUSTOM_ANNOT_TYPE_CLOUD

The constant represents cloud annotation type

Constant Value: 1005 (0x000003ed)

public static final int CUSTOM_ANNOT_TYPE_ERASER

The constant represents eraser annotation type

Constant Value: 1003 (0x000003eb)

public static final int CUSTOM_ANNOT_TYPE_FREE_HIGHLIGHTER

The constant represents free highlighter annotation type

Constant Value: 1004 (0x000003ec)

public static final int CUSTOM_ANNOT_TYPE_PERIMETER_MEASURE

The constant represents arrow annotation type

Constant Value: 1008 (0x000003f0)

public static final int CUSTOM_ANNOT_TYPE_RULER

The constant represents arrow annotation type

Constant Value: 1006 (0x000003ee)

public static final int CUSTOM_ANNOT_TYPE_SIGNATURE

The constant represents signature annotation type

Constant Value: 1002 (0x000003ea)

Fields

public static String KEY_PDFTRON_RULER

public static String KEY_RULER_BASE

public static String KEY_RULER_BASE_UNIT

public static String KEY_RULER_TRANSLATE

public static String KEY_RULER_TRANSLATE_UNIT

Public Constructors

public AnnotStyle ()

Class constructor

public AnnotStyle (AnnotStyle other)

Class constructor

Parameters
other other annotation style to copy from

Public Methods

public void bindPreview (AnnotationPropertyPreviewView previewView)

Bind a preview view to this annotation style, whenever the annotation style updates, the preview updates

Parameters
previewView preview view

public void disableUpdateListener (boolean disable)

Disable update annotation change listener

Parameters
disable true then disable, false otherwise

public boolean equals (Object obj)

public int getAnnotType ()

The overload implementation of getToolMode().

public AnnotationPropertyPreviewView getBindedPreview ()

Gets binded preview

Returns
  • binded preview

public double getBorderEffectIntensity ()

Gets the border effect intensity

Returns
  • border effect intensity

public int getColor ()

Gets color of annotation style, for annotation style has border, it means stroke color

Returns
  • color

public int getFillColor ()

Gets fill color of annotation style

Returns
  • fill color

public FontResource getFont ()

Gets font for free text annotation

Returns
  • font resource

public String getFontPath ()

Gets font path of font. This is equivalent to calling annotStyle.getFont().getFontPath();

Returns
  • font path

public String getIcon ()

Gets Icon for StickyNote Text annotation

Returns
  • icon name

public static Drawable getIconDrawable (Context context, String icon, int color, float opacity)

Gets icon drawable based on icon name, opacity

Parameters
context The context to get resources
icon icon name
opacity opacity of icon. from [0, 1]
Returns
  • drawable

public Drawable getIconDrawable (Context context)

Gets icon drawable

Parameters
context The context to get resource
Returns
  • drawable

public static Drawable getIconDrawable (Context context, String iconOutline, String iconFill, int color, float opacity)

Gets icon drawable based on icon name, opacity

Parameters
context The context to get resources
iconOutline name of icon outline
iconFill name of icon fill
opacity opacity of icon. from [0, 1]
Returns
  • drawable

public float getOpacity ()

Gets opacity of annotation style

Returns
  • opacity

public String getOverlayText ()

Gets overlay text. Used for Redaction annotation and Watermark

Returns
  • overlay text

public String getPDFTronFontName ()

Gets PDFTron font name for free text annotation. This is equivalent to calling annotStyle.getFont().getPDFTronName();

Returns
  • font pdftron font name

public int getPrecision ()

public String getRulerBaseUnit ()

Gets the ruler base unit

Returns
  • the unit

public float getRulerBaseValue ()

Gets the ruler base value

Returns
  • the value

public RulerItem getRulerItem ()

Gets the ruler item

Returns
  • the ruler item

public String getRulerTranslateUnit ()

Gets the ruler translate unit

Returns
  • the unit

public float getRulerTranslateValue ()

Gets the ruler translate value

Returns
  • the value

public boolean getSnap ()

Gets whether snap to points

Returns
  • true if snap to points, false otherwise

public int getTextColor ()

Gets text color of free text annotation style

Returns
  • text color

public String getTextContent ()

Gets text content of free text annotation

Returns
  • content

public String getTextHTMLContent ()

public float getTextSize ()

Gets text size of free text annotation style

Returns
  • text size

public float getThickness ()

Gets stroke thickness of annotation style

Returns
  • thickness

public boolean hasColor ()

Whether annotation style has color

Returns
  • true then annotation has color, false otherwise

public boolean hasFillColor ()

Whether annotation style has fill color

Returns
  • true then annotation has fill color, false otherwise

public boolean hasFont ()

Whether annotation style should have font.

Returns
  • true if annotation style should have font information, false otherwise

public boolean hasIcon ()

Whether annotation style has icon

Returns
  • true then annotation has icon, false otherwise

public boolean hasOpacity ()

Whether annotation style has opacity

Returns
  • true then annotation has opacity, false otherwise

public boolean hasTextStyle ()

Whether annotation style should have text style (i.e. text color and text size).

Returns
  • true if annotation style should have text style, false otherwise

public boolean hasThickness ()

Whether annotation style has border thickness

Returns
  • true then annotation has border thickness, false otherwise

public int hashCode ()

public boolean isCallout ()

public boolean isFreeText ()

Whether annotation style is freetext annotation

Returns
  • true then annotation is freetext annotation, false otherwise

public boolean isLine ()

Whether annotation style is line annotation

Returns
  • true then annotation is line annotation, false otherwise

public boolean isMeasurement ()

Whether annotation style is measurement annotation

Returns
  • true if annotation is any of distance/perimeter/area, false otherwise

public boolean isRCFreeText ()

public boolean isRedaction ()

Whether annotation style is redaction

Returns
  • true then annotation is redaction annotation, false otherwise

public boolean isRuler ()

Whether annotation style is ruler

Returns
  • true then annotation is line annotation, false otherwise

public boolean isSound ()

Whether annotation style is sound

Returns
  • true then annotation is sound, false otherwise

public boolean isStickyNote ()

Whether annotation style is sticky note

Returns
  • true then annotation is sticky note, false otherwise

public boolean isWatermark ()

Whether annotation style is watermark

Returns
  • true if annotation is watermark, false otherwise

public boolean isWidget ()

Whether annotation style is Widget annotation

Returns
  • true then annotation is Widget annotation, false otherwise

public static AnnotStyle loadJSONString (Context context, String jsonStr, int annotType)

Convert JSON String to annotation style

Parameters
context the context
jsonStr json string
annotType annotation type
Returns
  • annotation style

public static AnnotStyle loadJSONString (String jsonStr)

Convert JSON String to annotation style

Parameters
jsonStr json string
Returns
  • annotation style

public void setAnnotAppearanceChangeListener (AnnotStyle.OnAnnotStyleChangeListener listener)

Sets annotation style change listener

Parameters
listener annotation style change listener

public void setAnnotType (int annotType)

Sets annotation type, can be obtained from getType()

Parameters
annotType annotation type

public void setBorderEffectIntensity (double intensity)

Sets the border effect intensity

Parameters
intensity border effect intensity

public void setFillColor (int fillColor)

Sets fill color. For Markup annotation, fill color can be obtained from getInteriorColor(); For FreeText annotation, fill color can be obtained from getColorAsRGB()

Parameters
fillColor fill color

public void setFont (FontResource font)

Sets font for FreeText annotation. Font can be obtained from calling

 Obj freeTextObj = freeText.getSDFObj();
     Obj drDict = freeTextObj.findObj("DR");

     if (drDict != null && drDict.isDict()) {
       Obj fontDict = drDict.findObj("Font");

       if (fontDict != null && fontDict.isDict()) {
         DictIterator fItr = fontDict.getDictIterator();

         if (fItr.hasNext()) {
           Font f = new Font(fItr.value());
           String fontName = f.getName();
           FontResource font = new FontResource(fontName);
         
       }
     }
 }
 

Parameters
font font

public void setIcon (String icon)

Sets icon for Text annotation. Icon can be obtained from getIconName()

Parameters
icon icon

public void setOpacity (float opacity)

Sets opacity for Markup annotation. Opacity can be obtained from getOpacity()

Parameters
opacity opacity

public void setOpacity (float opacity, boolean done)

Sets opacity for Markup annotation. Opacity can be obtained from getOpacity()

Parameters
opacity opacity
done done sliding

public void setOverlayText (String text)

Sets overlay text. Used for Redaction annotation and Watermark

Parameters
text overlay text

public void setRulerBaseUnit (String unit)

Sets ruler base unit

Parameters
unit the unit

public void setRulerBaseValue (float value)

Sets ruler base value

Parameters
value the value

public void setRulerItem (RulerItem ruler)

Sets ruler properties

Parameters
ruler the ruler

public void setRulerPrecision (int precision)

public void setRulerTranslateUnit (String unit)

Sets ruler translate unit

Parameters
unit the unit

public void setRulerTranslateValue (float value)

Sets ruler translate value

Parameters
value the value

public void setSnap (boolean snap)

Sets snap.

Parameters
snap whether to snap to points

public void setStrokeColor (int strokeColor)

Sets stroke color. For normal annotation, stroke color can be obtained from getColorAsRGB(); For FreeText annotation, stroke color can be obtained from getLineColor()

Parameters
strokeColor stroke color

public void setStyle (AnnotStyle other)

Copy other annotation style

Parameters
other other annotation style

public void setStyle (int strokeColor, int fillColor, float thickness, float opacity)

Sets annotation style

Parameters
strokeColor stroke color
fillColor fill color
thickness stroke thickness
opacity opacity

public void setTextColor (int textColor)

Sets text color for FreeText and Widget annotations. text color can be obtained from getTextColor() or getTextColor()

Parameters
textColor text color

public void setTextContent (String content)

Sets content of FreeText annotation.

Parameters
content content

public void setTextHTMLContent (String html)

public void setTextSize (float textSize, boolean done)

Sets text size for FreeText annotation. text size can be obtained from getFontSize()

Parameters
textSize text size
done done sliding

public void setTextSize (float textSize)

Sets text size for FreeText annotation. text size can be obtained from getFontSize()

Parameters
textSize text size

public void setThickness (float thickness)

Sets stroke thickness. Annotation stroke thickness can be obtained from getWidth()

Parameters
thickness border style thickness

public void setThickness (float thickness, boolean done)

Sets stroke thickness. Annotation stroke thickness can be obtained from getWidth()

Parameters
thickness border style thickness
done done sliding

public String toJSONString ()

Convert annotation style to string in json format

Returns
  • json format string

public String toString ()

public void updateAllListeners ()

public void updateTextSizeListener (float textSize, boolean update, boolean done)

Update text size to listener

Parameters
textSize textSize
update whether to invoke listener method

public void updateThicknessListener (float thickness, boolean update, boolean done)

Update thickness to listener

Parameters
thickness thickness
update whether to invoke listener method