Skip to content

Commit 6eafc4e

Browse files
committed
PDFBOX-5660: split large method
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1923761 13f79535-47bb-0310-9956-ffa450edef68
1 parent 91408d9 commit 6eafc4e

File tree

1 file changed

+30
-21
lines changed

1 file changed

+30
-21
lines changed

pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1547,32 +1547,13 @@ public void shadingFill(COSName shadingName) throws IOException
15471547
public void showAnnotation(PDAnnotation annotation) throws IOException
15481548
{
15491549
lastClips = null;
1550-
if (destination == RenderDestination.PRINT && !annotation.isPrinted())
1551-
{
1552-
return;
1553-
}
1554-
if ((destination == RenderDestination.VIEW || destination == RenderDestination.EXPORT) &&
1555-
annotation.isNoView())
1556-
{
1557-
return;
1558-
}
1559-
if (annotation.isHidden())
1560-
{
1561-
return;
1562-
}
1563-
if (annotation.isInvisible() && annotation instanceof PDAnnotationUnknown)
1564-
{
1565-
// "If set, do not display the annotation if it does not belong to one
1566-
// of the standard annotation types and no annotation handler is available."
1567-
return;
1568-
}
1569-
//TODO support NoZoom, example can be found in p5 of PDFBOX-2348
15701550

1571-
if (isHiddenOCG(annotation.getOptionalContent()))
1551+
if (shouldSkipAnnotation(annotation))
15721552
{
15731553
return;
15741554
}
15751555

1556+
//TODO support NoZoom, example can be found in p5 of PDFBOX-2348
15761557
PDAppearanceDictionary appearance = annotation.getAppearance();
15771558
if (appearance == null || appearance.getNormalAppearance() == null)
15781559
{
@@ -1606,6 +1587,34 @@ public void showAnnotation(PDAnnotation annotation) throws IOException
16061587
}
16071588
}
16081589

1590+
private boolean shouldSkipAnnotation(PDAnnotation annotation)
1591+
{
1592+
if (destination == RenderDestination.PRINT && !annotation.isPrinted())
1593+
{
1594+
return true;
1595+
}
1596+
if ((destination == RenderDestination.VIEW || destination == RenderDestination.EXPORT) &&
1597+
annotation.isNoView())
1598+
{
1599+
return true;
1600+
}
1601+
if (annotation.isHidden())
1602+
{
1603+
return true;
1604+
}
1605+
if (annotation.isInvisible() && annotation instanceof PDAnnotationUnknown)
1606+
{
1607+
// "If set, do not display the annotation if it does not belong to one
1608+
// of the standard annotation types and no annotation handler is available."
1609+
return true;
1610+
}
1611+
if (isHiddenOCG(annotation.getOptionalContent()))
1612+
{
1613+
return true;
1614+
}
1615+
return false;
1616+
}
1617+
16091618
private boolean hasTransparency(PDFormXObject form) throws IOException
16101619
{
16111620
if (form == null)

0 commit comments

Comments
 (0)