pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1821424 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotationInk.java
Date Wed, 17 Jan 2018 21:57:33 GMT
Author: tilman
Date: Wed Jan 17 21:57:33 2018
New Revision: 1821424

URL: http://svn.apache.org/viewvc?rev=1821424&view=rev
Log:
PDFBOX-4072: add method to get inkList

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

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotationInk.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotationInk.java?rev=1821424&r1=1821423&r2=1821424&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotationInk.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotationInk.java
Wed Jan 17 21:57:33 2018
@@ -16,6 +16,8 @@
 
 package org.apache.pdfbox.pdmodel.interactive.annotation;
 
+import org.apache.pdfbox.cos.COSArray;
+import org.apache.pdfbox.cos.COSBase;
 import org.apache.pdfbox.cos.COSDictionary;
 import org.apache.pdfbox.cos.COSName;
 import org.apache.pdfbox.pdmodel.interactive.annotation.handlers.PDAppearanceHandler;
@@ -52,9 +54,28 @@ public class PDAnnotationInk extends PDA
         super(dict);
     }
 
-    //TODO get InkList
-    
-    
+
+    //TODO setInkList, javadoc
+ 
+    public float[][] getInkList()
+    {
+        COSBase base = getCOSObject().getDictionaryObject(COSName.INKLIST);
+        if (base instanceof COSArray)
+        {
+            COSArray array = (COSArray) base;
+            float[][] inkList = new float[array.size()][];
+            for (int i = 0; i < array.size(); ++i)
+            {
+                //TODO check for class
+                COSArray innerArray = (COSArray) array.getObject(i);
+                inkList[i] = innerArray.toFloatArray();
+            }
+            return inkList;
+        }
+        // Should never happen as this is a required item
+        return null; 
+    }
+
     /**
      * Set a custom appearance handler for generating the annotations appearance streams.
      * 



Mime
View raw message