Reference Guide
Reference Guides / JavaScript API / Annotations / AddTextAnnotInteractive
In This Topic
    AddTextAnnotInteractive
    In This Topic

    Here is a code example showing how the draw a green text annotation by showing the creation dialog with custom preloaded properties values.

    function addTimeStamp() {
        timeStampAppearance = {
            fill: false,
            stroke: false,
            fontStyle: 0,
            foreColor: "#1CA30D",
            opacity: 1,
            text: "Paid by cash",
            alignment: 0,
            lineAlignment: 0
        };
        DocuViewareAPI.AddTextAnnotInteractive("DocuVieware1", timeStampAppearance, true, ["fontName","fontStyle","foreColor","fontSize","text","opacity"]);
    }

    Each annotation having its own properties, please refer to the corresponding function documentation below to have a comprehensive list of it.

     AddTextAnnotInteractive

    This function allows you to add a text annotation (annotation type 8) onto a document into the DocuVieware™ viewer.

    AddTextAnnotInteractive: function (docuViewareID[, annotationAppearance, showDialog, enabledProperties])

    Parameters

    docuViewareID
    The identifier for the DocuVieware™ instance you want to add the annotation on.
    annotationAppearance
    An optional JavaScript object that contains the appearance you want the annotation to have. Annotation properties are listed below.
    showDialog
    An optional boolean that let you decide if the annotation dialog should be shown or not (this requires the annotationAppearance to be sent).
    enabledProperties
    An optional string array that let you decide what properties are going to be shown in the annotation creation dialog.

    Return Value

    1 if error, 0 if success.

    Text Annotation Properties

    Name Type Default
    alignment int 0
    autoSize bool false
    borderWidth float 0.01
    dashCap int 0
    dashStyle int 0
    fill bool true
    fillColor string "#FFFFFF"
    fontName string "Arial"
    fontSize int 12
    fontStyle int 0
    foreColor string "#000000"
    lineAlignment int 0
    opacity float 1
    radiusFactor float 0
    rotation int 0
    stroke bool false
    strokeColor string "#000000"
    text string "Text"