Skip to content

Commit 76549ad

Browse files
committed
PDFBOX-5660: optimize, as suggested by Valery Bokov; closes #282
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1929051 13f79535-47bb-0310-9956-ffa450edef68
1 parent 8a5ce11 commit 76549ad

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDSignatureField.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.apache.logging.log4j.LogManager;
2525
import org.apache.pdfbox.cos.COSDictionary;
2626
import org.apache.pdfbox.cos.COSName;
27+
import org.apache.pdfbox.pdmodel.common.PDRectangle;
2728
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationWidget;
2829
import org.apache.pdfbox.pdmodel.interactive.digitalsignature.PDSeedValue;
2930
import org.apache.pdfbox.pdmodel.interactive.digitalsignature.PDSignature;
@@ -196,10 +197,11 @@ void constructAppearances() throws IOException
196197
PDAnnotationWidget widget = this.getWidgets().get(0);
197198
if (widget != null)
198199
{
200+
PDRectangle rectangle = widget.getRectangle();
199201
// check if the signature is visible
200-
if (widget.getRectangle() == null ||
201-
Float.compare(widget.getRectangle().getHeight(), 0) == 0 && Float.compare(widget.getRectangle().getWidth(), 0) == 0 ||
202-
widget.isNoView() || widget.isHidden())
202+
if (rectangle == null ||
203+
Float.compare(rectangle.getHeight(), 0) == 0 && Float.compare(rectangle.getWidth(), 0) == 0 ||
204+
widget.isNoView() || widget.isHidden())
203205
{
204206
return;
205207
}

0 commit comments

Comments
 (0)