From a51e5b49070a6e6d4e4723e714b08e08884ddd7b Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Mon, 22 Feb 2016 08:50:45 +0100 Subject: introduced minimum width for visual signature when positioned with a placeholder --- .../pdfas/lib/api/IConfigurationConstants.java | 1 + .../SignatureProfileConfiguration.java | 24 ++++++++++++++++++++++ .../at/knowcenter/wag/egov/egiz/pdf/TablePos.java | 2 +- 3 files changed, 26 insertions(+), 1 deletion(-) (limited to 'pdf-as-lib/src/main/java') diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/IConfigurationConstants.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/IConfigurationConstants.java index a73a4846..7a955e3f 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/IConfigurationConstants.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/IConfigurationConstants.java @@ -42,6 +42,7 @@ public interface IConfigurationConstants { public static final String LEGACY_POSITIONING = ".legacy.pos"; + public static final String MIN_WIDTH = "minWidth"; public static final String PLACEHOLDER_ID = "placeholder_id"; public static final String PLACEHOLDER_MODE = "placeholder_mode"; diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/configuration/SignatureProfileConfiguration.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/configuration/SignatureProfileConfiguration.java index 04448b96..789094cb 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/configuration/SignatureProfileConfiguration.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/configuration/SignatureProfileConfiguration.java @@ -23,12 +23,17 @@ ******************************************************************************/ package at.gv.egiz.pdfas.lib.impl.configuration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import at.gv.egiz.pdfas.common.settings.ISettings; import at.gv.egiz.pdfas.lib.api.IConfigurationConstants; public class SignatureProfileConfiguration extends SpecificBaseConfiguration implements IConfigurationConstants { + private static final Logger logger = LoggerFactory.getLogger(SignatureProfileConfiguration.class); + protected String profileID; public SignatureProfileConfiguration(ISettings configuration, @@ -37,6 +42,25 @@ public class SignatureProfileConfiguration extends SpecificBaseConfiguration this.profileID = profileID; } + public float getMinWidth() { + String key = SIG_OBJECT + SEPERATOR + profileID + SEPERATOR + MIN_WIDTH; + + String minWidthValue = this.configuration.getValue(key); + + float result = Float.MAX_VALUE; + + if(minWidthValue != null) { + try { + result = Float.parseFloat(minWidthValue); + logger.debug("Got min width for profile {}: {}", profileID, result); + } catch(NumberFormatException e) { + logger.warn("Configuration Entry: {} should be a float number", key); + } + } + + return result; + } + public boolean isVisualSignature() { String key = SIG_OBJECT + SEPERATOR + profileID + SEPERATOR + TABLE + SEPERATOR + MAIN; diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/TablePos.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/TablePos.java index e49b481e..ce32e467 100644 --- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/TablePos.java +++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/TablePos.java @@ -86,7 +86,7 @@ public class TablePos implements Serializable /** * The width of the block. */ - private float width = 0.0f; + public float width = 0.0f; /** * The top y position of the footer line. */ -- cgit v1.2.3