Skip to content

Commit

Permalink
PDFBOX-5660: split large method
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1923761 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
THausherr committed Feb 12, 2025
1 parent 91408d9 commit 6eafc4e
Showing 1 changed file with 30 additions and 21 deletions.
51 changes: 30 additions & 21 deletions pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
Original file line number Diff line number Diff line change
Expand Up @@ -1547,32 +1547,13 @@ public void shadingFill(COSName shadingName) throws IOException
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)
{
Expand Down Expand Up @@ -1606,6 +1587,34 @@ public void showAnnotation(PDAnnotation annotation) throws IOException
}
}

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)
Expand Down

0 comments on commit 6eafc4e

Please sign in to comment.