Author: tilman
Date: Wed Feb 12 14:58:06 2025
New Revision: 1923760
URL: http://svn.apache.org/viewvc?rev=1923760&view=rev
Log:
PDFBOX-5660: split large method
Modified:
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
Modified:
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
URL:
http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java?rev=1923760&r1=1923759&r2=1923760&view=diff
==============================================================================
---
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
(original)
+++
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
Wed Feb 12 14:58:06 2025
@@ -1625,32 +1625,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)
{
@@ -1685,6 +1666,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)