Author: tilman
Date: Wed Feb 12 14:58:01 2025
New Revision: 1923759

URL: http://svn.apache.org/viewvc?rev=1923759&view=rev
Log:
PDFBOX-5660: split large method

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

Modified: 
pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java?rev=1923759&r1=1923758&r2=1923759&view=diff
==============================================================================
--- 
pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
 (original)
+++ 
pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
 Wed Feb 12 14:58:01 2025
@@ -1548,32 +1548,13 @@ public class PageDrawer extends PDFGraph
     public void showAnnotation(PDAnnotation annotation) throws IOException
     {
         lastClips = null;
-        if (destination == RenderDestination.PRINT && !annotation.isPrinted())
-        {
-            return;
-        }
-        if ((destination == RenderDestination.VIEW || destination == 
RenderDestination.EXPORT) &&
-                annotation.isNoView())
-        {
-            return;
-        }
-        if (annotation.isHidden())
-        {
-            return;
-        }
-        if (annotation.isInvisible() && annotation instanceof 
PDAnnotationUnknown)
-        {
-            // "If set, do not display the annotation if it does not belong to 
one
-            // of the standard annotation types and no annotation handler is 
available."
-            return;
-        }
-        //TODO support NoZoom, example can be found in p5 of PDFBOX-2348
 
-        if (isHiddenOCG(annotation.getOptionalContent()))
+        if (shouldSkipAnnotation(annotation))
         {
             return;
         }
 
+        //TODO support NoZoom, example can be found in p5 of PDFBOX-2348
         PDAppearanceDictionary appearance = annotation.getAppearance();
         if (appearance == null || appearance.getNormalAppearance() == null)
         {
@@ -1607,6 +1588,34 @@ public class PageDrawer extends PDFGraph
         }
     }
 
+    private boolean shouldSkipAnnotation(PDAnnotation annotation)
+    {
+        if (destination == RenderDestination.PRINT && !annotation.isPrinted())
+        {
+            return true;
+        }
+        if ((destination == RenderDestination.VIEW || destination == 
RenderDestination.EXPORT) &&
+                annotation.isNoView())
+        {
+            return true;
+        }
+        if (annotation.isHidden())
+        {
+            return true;
+        }
+        if (annotation.isInvisible() && annotation instanceof 
PDAnnotationUnknown)
+        {
+            // "If set, do not display the annotation if it does not belong to 
one
+            // of the standard annotation types and no annotation handler is 
available."
+            return true;
+        }
+        if (isHiddenOCG(annotation.getOptionalContent()))
+        {
+            return true;
+        }
+        return false;
+    }
+
     private boolean hasTransparency(PDFormXObject form) throws IOException
     {
         if (form == null)


Reply via email to