From 531124af765490a63c3a1121ba81fed21c6d7ab4 Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Thu, 5 Jun 2014 10:16:49 +0200 Subject: halign fixes --- .../lib/impl/stamping/pdfbox/PDFAsVisualSignatureBuilder.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'pdf-as-lib/src/main/java') diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsVisualSignatureBuilder.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsVisualSignatureBuilder.java index 3885169b..d2049f24 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsVisualSignatureBuilder.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsVisualSignatureBuilder.java @@ -28,7 +28,6 @@ import org.apache.pdfbox.pdmodel.edit.PDPageContentStream; import org.apache.pdfbox.pdmodel.font.PDFont; import org.apache.pdfbox.pdmodel.font.PDType1Font; import org.apache.pdfbox.pdmodel.graphics.xobject.PDJpeg; -import org.apache.pdfbox.pdmodel.graphics.xobject.PDPixelMap; import org.apache.pdfbox.pdmodel.graphics.xobject.PDXObjectForm; import org.apache.pdfbox.pdmodel.graphics.xobject.PDXObjectImage; import org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceDictionary; @@ -280,11 +279,15 @@ public class PDFAsVisualSignatureBuilder extends PDVisibleSigBuilder { float tx = textx; if(Style.CENTER.equals(halign)) { float offset = columnWidth - maxWidth - 2 * padding; - offset = offset / 2.0f; - tx += offset; + if(offset > 0) { + offset = offset / 2.0f; + tx += offset; + } } else if(Style.RIGHT.equals(halign)) { float offset = columnWidth - maxWidth - 2 * padding; - tx += offset; + if(offset > 0) { + tx += offset; + } } logger.debug("Writing: " + tx + " : " + ty + " = " -- cgit v1.2.3