pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1839592 - in /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel: ./ interactive/annotation/handlers/
Date Wed, 29 Aug 2018 17:01:39 GMT
Author: tilman
Date: Wed Aug 29 17:01:39 2018
New Revision: 1839592

URL: http://svn.apache.org/viewvc?rev=1839592&view=rev
Log:
PDFBOX-3353: include border array into setBorderLine

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDAppearanceContentStream.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDCircleAppearanceHandler.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDLinkAppearanceHandler.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDPolygonAppearanceHandler.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDSquareAppearanceHandler.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDAppearanceContentStream.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDAppearanceContentStream.java?rev=1839592&r1=1839591&r2=1839592&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDAppearanceContentStream.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDAppearanceContentStream.java
Wed Aug 29 17:01:39 2018
@@ -19,6 +19,7 @@ package org.apache.pdfbox.pdmodel;
 import java.io.Closeable;
 import java.io.IOException;
 import java.io.OutputStream;
+import org.apache.pdfbox.cos.COSArray;
 
 import org.apache.pdfbox.cos.COSName;
 import org.apache.pdfbox.pdmodel.graphics.color.PDColor;
@@ -188,7 +189,18 @@ public final class PDAppearanceContentSt
         //Or call the appropriate setNonStrokingColor() method from the base class?
     }
 
-    public void setBorderLine(float lineWidth, PDBorderStyleDictionary bs) throws IOException
+    /**
+     * Convenience method for annotations: sets the line with and dash style.
+     *
+     * @param lineWidth The line width.
+     * @param bs The border style, may be null.
+     * @param border The border array, must have at least three entries. This is
+     * only used if the border style is null.
+     *
+     * @throws IOException If there is an error writing to the content stream.
+     */
+    public void setBorderLine(float lineWidth, PDBorderStyleDictionary bs,
+                                               COSArray border) throws IOException
     {
         // Can't use PDBorderStyleDictionary.getDashStyle() as
         // this will return a default dash style if non is existing
@@ -197,6 +209,10 @@ public final class PDAppearanceContentSt
         {
             setLineDashPattern(bs.getDashStyle().getDashArray(), 0);
         }
+        else if (bs == null && border.size() > 3 && border.getObject(3)
instanceof COSArray)
+        {
+            setLineDashPattern(((COSArray) border.getObject(3)).toFloatArray(), 0);
+        }
         setLineWidthOnDemand(lineWidth);
     }
 

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDCircleAppearanceHandler.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDCircleAppearanceHandler.java?rev=1839592&r1=1839591&r2=1839592&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDCircleAppearanceHandler.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDCircleAppearanceHandler.java
Wed Aug 29 17:01:39 2018
@@ -65,7 +65,7 @@ public class PDCircleAppearanceHandler e
 
             setOpacity(contentStream, annotation.getConstantOpacity());
 
-            contentStream.setBorderLine(lineWidth, annotation.getBorderStyle());
+            contentStream.setBorderLine(lineWidth, annotation.getBorderStyle(), annotation.getBorder());
             PDBorderEffectDictionary borderEffect = annotation.getBorderEffect();
 
             // Acrobat applies a padding to each side of the bbox so the line is completely
within

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDLinkAppearanceHandler.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDLinkAppearanceHandler.java?rev=1839592&r1=1839591&r2=1839592&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDLinkAppearanceHandler.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDLinkAppearanceHandler.java
Wed Aug 29 17:01:39 2018
@@ -75,17 +75,7 @@ public class PDLinkAppearanceHandler ext
             }
             boolean hasStroke = contentStream.setStrokingColorOnDemand(color);
 
-            contentStream.setBorderLine(lineWidth, annotation.getBorderStyle());
-            //TODO find better way to do this. Either pass border array to
-            // setBorderLine(), or use AnnotationBorder class
-            if (annotation.getBorderStyle() == null)
-            {
-                COSArray border = annotation.getBorder();
-                if (border.size() > 3 && border.getObject(3) instanceof COSArray)
-                {
-                    contentStream.setLineDashPattern(((COSArray) border.getObject(3)).toFloatArray(),
0);
-                }
-            }
+            contentStream.setBorderLine(lineWidth, annotation.getBorderStyle(), annotation.getBorder());
 
             // the differences rectangle
             // TODO: this only works for border effect solid. Cloudy needs a different approach.

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDPolygonAppearanceHandler.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDPolygonAppearanceHandler.java?rev=1839592&r1=1839591&r2=1839592&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDPolygonAppearanceHandler.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDPolygonAppearanceHandler.java
Wed Aug 29 17:01:39 2018
@@ -100,17 +100,7 @@ public class PDPolygonAppearanceHandler
 
             setOpacity(contentStream, annotation.getConstantOpacity());
 
-            contentStream.setBorderLine(lineWidth, annotation.getBorderStyle());
-            //TODO find better way to do this. Either pass border array to
-            // setBorderLine(), or use AnnotationBorder class
-            if (annotation.getBorderStyle() == null)
-            {
-                COSArray border = annotation.getBorder();
-                if (border.size() > 3 && border.getObject(3) instanceof COSArray)
-                {
-                    contentStream.setLineDashPattern(((COSArray) border.getObject(3)).toFloatArray(),
0);
-                }
-            }
+            contentStream.setBorderLine(lineWidth, annotation.getBorderStyle(), annotation.getBorder());
 
             PDBorderEffectDictionary borderEffect = annotation.getBorderEffect();
             if (borderEffect != null && borderEffect.getStyle().equals(PDBorderEffectDictionary.STYLE_CLOUDY))

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDSquareAppearanceHandler.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDSquareAppearanceHandler.java?rev=1839592&r1=1839591&r2=1839592&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDSquareAppearanceHandler.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDSquareAppearanceHandler.java
Wed Aug 29 17:01:39 2018
@@ -67,7 +67,7 @@ public class PDSquareAppearanceHandler e
 
             setOpacity(contentStream, annotation.getConstantOpacity());
 
-            contentStream.setBorderLine(lineWidth, annotation.getBorderStyle());        
       
+            contentStream.setBorderLine(lineWidth, annotation.getBorderStyle(), annotation.getBorder());
               
             PDBorderEffectDictionary borderEffect = annotation.getBorderEffect();
 
             if (borderEffect != null && borderEffect.getStyle().equals(PDBorderEffectDictionary.STYLE_CLOUDY))



Mime
View raw message