pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1821666 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDLinkAppearanceHandler.java
Date Fri, 19 Jan 2018 15:30:25 GMT
Author: tilman
Date: Fri Jan 19 15:30:25 2018
New Revision: 1821666

URL: http://svn.apache.org/viewvc?rev=1821666&view=rev
Log:
PDFBOX-3353: color is for border, not background; remove opacity TODO because link annotation
isn't a markup annotation

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

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=1821666&r1=1821665&r2=1821666&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
Fri Jan 19 15:30:25 2018
@@ -52,6 +52,14 @@ public class PDLinkAppearanceHandler ext
     @Override
     public void generateNormalAppearance()
     {
+        PDAnnotationLink annotation = (PDAnnotationLink) getAnnotation();
+        if (annotation.getRectangle() == null)
+        {
+            // 660402-p1-AnnotationEmptyRect.pdf has /Rect entry with 0 elements
+            //TODO check for qzadpoints before quitting
+            return;
+        }
+
         // Adobe doesn't generate an appearance for a link annotation
         float lineWidth = getLineWidth();
         try
@@ -59,11 +67,8 @@ public class PDLinkAppearanceHandler ext
             try (PDAppearanceContentStream contentStream = getNormalAppearanceAsContentStream())
             {
                 contentStream.setStrokingColorOnDemand(getColor());
-                boolean hasBackground = contentStream.setNonStrokingColorOnDemand(getAnnotation().getColor());
-                
-                // TODO: handle opacity settings
-                
-                contentStream.setBorderLine(lineWidth, ((PDAnnotationLink) getAnnotation()).getBorderStyle());
+
+                contentStream.setBorderLine(lineWidth, annotation.getBorderStyle());
                 
                 // the differences rectangle
                 // TODO: this only works for border effect solid. Cloudy needs a different
approach.
@@ -75,7 +80,7 @@ public class PDLinkAppearanceHandler ext
                 contentStream.addRect(borderEdge.getLowerLeftX() , borderEdge.getLowerLeftY(),
                         borderEdge.getWidth(), borderEdge.getHeight());
                 
-                contentStream.drawShape(lineWidth, hasBackground);
+                contentStream.drawShape(lineWidth, false);
             }
         }
         catch (IOException e)



Mime
View raw message