pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From msahy...@apache.org
Subject svn commit: r1827403 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/state/PDExtendedGraphicsState.java
Date Wed, 21 Mar 2018 11:20:11 GMT
Author: msahyoun
Date: Wed Mar 21 11:20:11 2018
New Revision: 1827403

URL: http://svn.apache.org/viewvc?rev=1827403&view=rev
Log:
PDFBOX-4162: correct parsing of Line Dash pattern

Modified:
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/state/PDExtendedGraphicsState.java

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/state/PDExtendedGraphicsState.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/state/PDExtendedGraphicsState.java?rev=1827403&r1=1827402&r2=1827403&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/state/PDExtendedGraphicsState.java
(original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/state/PDExtendedGraphicsState.java
Wed Mar 21 11:20:11 2018
@@ -274,14 +274,14 @@ public class PDExtendedGraphicsState imp
     {
         PDLineDashPattern retval = null;
         COSArray dp = (COSArray) dict.getDictionaryObject( COSName.D );
-        if( dp != null )
+        if( dp != null  && dp.size() == 2)
         {
-            COSArray array = new COSArray();
-            array.addAll(dp);
-            array.remove(dp.size() - 1);
-            int phase = dp.getInt(dp.size() - 1);
-
-            retval = new PDLineDashPattern( array, phase );
+            COSBase dashArray = dp.get(0);
+            COSBase phase = dp.get(1);
+            if (dashArray instanceof COSArray && phase instanceof COSNumber)
+            {
+                retval = new PDLineDashPattern((COSArray) dashArray, ((COSNumber) phase).intValue());
+            }
         }
         return retval;
     }



Mime
View raw message