You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2018/05/25 18:48:17 UTC

svn commit: r1832266 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotationFreeText.java

Author: tilman
Date: Fri May 25 18:48:17 2018
New Revision: 1832266

URL: http://svn.apache.org/viewvc?rev=1832266&view=rev
Log:
PDFBOX-3353: add methods for callout and line ending style

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotationFreeText.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotationFreeText.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotationFreeText.java?rev=1832266&r1=1832265&r2=1832266&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotationFreeText.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotationFreeText.java Fri May 25 18:48:17 2018
@@ -169,7 +169,61 @@ public class PDAnnotationFreeText extend
         }
         return new float[]{};
     }
-    
+
+    /**
+     * This will set the coordinates of the callout line.
+     *
+     * @param callout An array of four or six numbers specifying a callout line attached to the free
+     * text annotation. Six numbers [ x1 y1 x2 y2 x3 y3 ] represent the starting, knee point, and
+     * ending coordinates of the line in default user space, four numbers [ x1 y1 x2 y2 ] represent
+     * the starting and ending coordinates of the line.
+     */
+    public final void setCallout(float[] callout)
+    {
+        COSArray newCallout = new COSArray();
+        newCallout.setFloatArray(callout);
+        getCOSObject().setItem(COSName.CL, newCallout);
+    }
+
+    /**
+     * This will get the coordinates of the callout line.
+     *
+     * @return An array of four or six numbers specifying a callout line attached to the free text
+     * annotation. Six numbers [ x1 y1 x2 y2 x3 y3 ] represent the starting, knee point, and ending
+     * coordinates of the line in default user space, four numbers [ x1 y1 x2 y2 ] represent the
+     * starting and ending coordinates of the line.
+     */
+    public float[] getCallout()
+    {
+        COSBase base = getCOSObject().getDictionaryObject(COSName.CL);
+        if (base instanceof COSArray)
+        {
+            return ((COSArray) base).toFloatArray();
+        }
+        return null;
+    }
+
+    /**
+     * This will set the line ending style.
+     *
+     * @param style The new style.
+     */
+    public final void setLineEndingStyle(String style)
+    {
+        getCOSObject().setName(COSName.LE, style);
+    }
+
+    /**
+     * This will retrieve the line ending style.
+     *
+     * @return The line ending style, possible values shown in the LE_ constants section, LE_NONE if
+     * missing, never null.
+     */
+    public String getLineEndingStyle()
+    {
+        return getCOSObject().getNameAsString(COSName.LE, PDAnnotationLine.LE_NONE);
+    }    
+
     /**
      * Set a custom appearance handler for generating the annotations appearance streams.
      *