class PDAnnotationCaret extends PDAnnotationMarkup
{
    /**
     * The type of annotation.
     */
    public static final String SUB_TYPE = "Caret";

    private PDAppearanceHandler customAppearanceHandler;

    public PDAnnotationCaret()
    {
        getCOSObject().setName(COSName.SUBTYPE, SUB_TYPE);
    }

    /**
     * Creates a Caret annotation from a COSDictionary, expected to be a correct object definition.
     *
     * @param field the PDF object to represent as a field.
     */
    public PDAnnotationCaret(COSDictionary field)
    {
        super(field);
    }
    
    /**
     * This will set the difference between the annotations "outer" rectangle defined by
     * /Rect and boundaries of the underlying.
     * 
     * <p>This will set an equal difference for all sides</p>
     * 
     * @param difference from the annotations /Rect entry
     */
    public void setRectDifferences(float difference) {
        setRectDifferences(difference, difference, difference, difference);
    }
    
    /**
     * This will set the difference between the annotations "outer" rectangle defined by
     * /Rect and the border.
     * 
     * @param differenceLeft left difference from the annotations /Rect entry
     * @param differenceTop top difference from the annotations /Rect entry
     * @param differenceRight right difference from  the annotations /Rect entry
     * @param differenceBottom bottom difference from the annotations /Rect entry
     * 
     */
    public void setRectDifferences(float differenceLeft, float differenceTop, float differenceRight, float differenceBottom)
    {<FILL_FUNCTION_BODY>}
    
    /**
     * This will get the margin between the annotations "outer" rectangle defined by
     * /Rect and the boundaries of the underlying caret.
     * 
     * @return the differences. If the entry hasn't been set am empty array is returned.
     */
    public float[] getRectDifferences()
    {
        COSArray margin = getCOSObject().getCOSArray(COSName.RD);
        return margin != null ? margin.toFloatArray() : new float[] {};
    }
    
    /**
     * Set a custom appearance handler for generating the annotations appearance streams.
     * 
     * @param appearanceHandler custom appearance handler
     */
    public void setCustomAppearanceHandler(PDAppearanceHandler appearanceHandler)
    {
        customAppearanceHandler = appearanceHandler;
    }

    @Override
    public void constructAppearances()
    {
        this.constructAppearances(null);
    }

    @Override
    public void constructAppearances(PDDocument document)
    {
        if (customAppearanceHandler == null)
        {
            PDCaretAppearanceHandler appearanceHandler = new PDCaretAppearanceHandler(this, document);
            appearanceHandler.generateAppearanceStreams();
        }
        else
        {
            customAppearanceHandler.generateAppearanceStreams();
        }
    }
}

        COSArray margins = new COSArray();
        margins.add(new COSFloat(differenceLeft));
        margins.add(new COSFloat(differenceTop));
        margins.add(new COSFloat(differenceRight));
        margins.add(new COSFloat(differenceBottom));
        getCOSObject().setItem(COSName.RD, margins);    
    
<methods>public void <init>() ,public void <init>(org.apache.pdfbox.cos.COSDictionary) ,public org.apache.pdfbox.pdmodel.interactive.annotation.PDBorderStyleDictionary getBorderStyle() ,public float getConstantOpacity() ,public java.util.Calendar getCreationDate() ,public org.apache.pdfbox.pdmodel.interactive.annotation.PDExternalDataDictionary getExternalData() ,public org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation getInReplyTo() throws java.io.IOException,public java.lang.String getIntent() ,public org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationPopup getPopup() ,public java.lang.String getReplyType() ,public java.lang.String getRichContents() ,public java.lang.String getSubject() ,public java.lang.String getTitlePopup() ,public void setBorderStyle(org.apache.pdfbox.pdmodel.interactive.annotation.PDBorderStyleDictionary) ,public void setConstantOpacity(float) ,public void setCreationDate(java.util.Calendar) ,public void setExternalData(org.apache.pdfbox.pdmodel.interactive.annotation.PDExternalDataDictionary) ,public void setInReplyTo(org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation) ,public void setIntent(java.lang.String) ,public void setPopup(org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationPopup) ,public void setReplyType(java.lang.String) ,public void setRichContents(java.lang.String) ,public void setSubject(java.lang.String) ,public void setTitlePopup(java.lang.String) <variables>public static final java.lang.String RT_GROUP,public static final java.lang.String RT_REPLY