Author: tilman
Date: Tue Oct 7 12:16:11 2025
New Revision: 1928999
Log:
PDFBOX-5660: optimize, as suggested by Valery Bokov; closes #277
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
==============================================================================
---
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
Tue Oct 7 12:16:06 2025 (r1928998)
+++
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
Tue Oct 7 12:16:11 2025 (r1928999)
@@ -109,6 +109,7 @@ import org.apache.pdfbox.pdmodel.interac
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationUnknown;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceDictionary;
+import org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceEntry;
import org.apache.pdfbox.util.Matrix;
import org.apache.pdfbox.util.Vector;
@@ -1641,14 +1642,17 @@ public class PageDrawer extends PDFGraph
if (annotation.isNoRotate() && getCurrentPage().getRotation() != 0)
{
appearance = annotation.getAppearance();
- if (appearance != null && appearance.getNormalAppearance() != null
&&
- appearance.getNormalAppearance().isStream() &&
-
hasTransparency(appearance.getNormalAppearance().getAppearanceStream()))
- {
- // PDFBOX-4744: avoid appearances with transparency groups
until we have fixed
- // the rendering. A real solution should probably be
- // in PDFStreamEngine.processAnnotation().
- annotation.constructAppearances();
+ if (appearance != null)
+ {
+ PDAppearanceEntry appearanceEntry =
appearance.getNormalAppearance();
+ if (appearanceEntry != null && appearanceEntry.isStream() &&
+ hasTransparency(appearanceEntry.getAppearanceStream()))
+ {
+ // PDFBOX-4744: avoid appearances with transparency groups
until we have fixed
+ // the rendering. A real solution should probably be
+ // in PDFStreamEngine.processAnnotation().
+ annotation.constructAppearances();
+ }
}
PDRectangle rect = annotation.getRectangle();
AffineTransform savedTransform = graphics.getTransform();