pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1657251 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
Date Wed, 04 Feb 2015 14:28:58 GMT
Author: tilman
Date: Wed Feb  4 14:28:57 2015
New Revision: 1657251

URL: http://svn.apache.org/r1657251
Log:
PDFBOX-2281: improve respecting (some) annotation flags, drop support of invisible flag

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java?rev=1657251&r1=1657250&r2=1657251&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java Wed Feb
 4 14:28:57 2015
@@ -20,6 +20,7 @@ import java.awt.BasicStroke;
 import java.awt.Color;
 import java.awt.Graphics;
 import java.awt.Graphics2D;
+import java.awt.GraphicsDevice;
 import java.awt.Paint;
 import java.awt.RenderingHints;
 import java.awt.Shape;
@@ -776,11 +777,21 @@ public final class PageDrawer extends PD
     public void showAnnotation(PDAnnotation annotation) throws IOException
     {
         lastClip = null;
-        //TODO support more flags; make a difference between viewing and printing
-        if (!annotation.isHidden() && !annotation.isInvisible() && !annotation.isNoView())
+        //TODO support more annotation flags (Invisible, NoZoom, NoRotate)
+        int deviceType = graphics.getDeviceConfiguration().getDevice().getType();
+        if (deviceType == GraphicsDevice.TYPE_PRINTER && !annotation.isPrinted())
         {
-            super.showAnnotation(annotation);
+            return;
         }
+        if (deviceType == GraphicsDevice.TYPE_RASTER_SCREEN && annotation.isNoView())
+        {
+            return;
+        }
+        if (annotation.isHidden())
+        {
+            return;
+        }
+        super.showAnnotation(annotation);
     }
 
     @Override



Mime
View raw message