From 0f72666691e481b64d8901802e7894cb58b0c2c4 Mon Sep 17 00:00:00 2001 From: pdanner Date: Thu, 27 Jan 2011 12:44:26 +0000 Subject: git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@731 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- .../java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java b/src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java index 96e5ad1..8b6bd5f 100644 --- a/src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java +++ b/src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java @@ -5,6 +5,7 @@ package at.gv.egiz.pdfas.impl.api; import java.io.File; import java.io.UnsupportedEncodingException; +import java.text.MessageFormat; import java.util.ArrayList; import java.util.Iterator; import java.util.List; @@ -104,7 +105,7 @@ public class PdfAsObject implements PdfAs /** * The log. */ - private static Log log = LogFactory.getLog(CheckHelper.class); + private static Log log = LogFactory.getLog(PdfAsObject.class); private static final String ENABLE_PLACEHOLDER_SEARCH_KEY = "enable_placeholder_search"; @@ -650,12 +651,23 @@ public class PdfAsObject implements PdfAs signParameters.setSignatureProfileId(defaultProfile); } + boolean fromPlaceholder = false; TablePos pos = null; - if (spd != null && spd.getTablePos() != null) + if (spd != null && spd.getTablePos() != null){ + fromPlaceholder = true; pos = spd.getTablePos(); - else + } else pos = PosHelper.formTablePos(signParameters.getSignaturePositioning()); + if (!pos.isWauto() && pos.getWidth() < 150) { + // very small, warn user + String msg = "The {0} for the signature ({1}) is very small. The signature block might not get placed correcty."; + String[] arguments = new String[]{ "given width", "" + pos.getWidth()}; + if (fromPlaceholder) + arguments[0] = "width of the placeholder image that will be used"; + log.warn(MessageFormat.format(msg, arguments)); + } + Signator signator = createSignator(signParameters.getSignatureType()); SignatorInformation signatorInfo = signator.prepareSign( -- cgit v1.2.3