From c683ceb96e7c3e1d8fea6ebc90d61e0fb41fe9a4 Mon Sep 17 00:00:00 2001 From: Christian Maierhofer Date: Mon, 24 Feb 2014 13:38:15 +0100 Subject: added missing posF to parameter extractor --- .../java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java | 16 +++++++++++++++- .../egiz/pdfas/web/helper/PdfAsParameterExtractor.java | 5 +++++ 2 files changed, 20 insertions(+), 1 deletion(-) (limited to 'pdf-as-web/src/main/java') diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java index 450908a9..db933a6b 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java @@ -140,8 +140,9 @@ public class PdfAsHelper { String posY = PdfAsParameterExtractor.getSigPosY(request); String posW = PdfAsParameterExtractor.getSigPosW(request); String posR = PdfAsParameterExtractor.getSigPosR(request); + String posF = PdfAsParameterExtractor.getSigPosF(request); - if (posP == null && posW == null && posX == null && posY == null && posR == null) { + if (posP == null && posW == null && posX == null && posY == null && posR == null && posF == null) { return null; } @@ -213,6 +214,19 @@ public class PdfAsHelper { } else { sb.append("r:0;"); } + + if (posF != null) { + try { + Float.parseFloat(posF); + } catch (NumberFormatException e) { + throw new PdfAsWebException( + PdfAsParameterExtractor.PARAM_SIG_POS_F + + " has invalid value!", e); + } + sb.append("f:" + posF.trim() + ";"); + } else { + sb.append("f:0;"); + } return sb.toString(); } diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsParameterExtractor.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsParameterExtractor.java index dbdb3716..532bfadb 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsParameterExtractor.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsParameterExtractor.java @@ -42,6 +42,7 @@ public class PdfAsParameterExtractor { public static final String PARAM_SIG_POS_X = "sig-pos-x"; public static final String PARAM_SIG_POS_W = "sig-pos-w"; public static final String PARAM_SIG_POS_R = "sig-pos-r"; + public static final String PARAM_SIG_POS_F = "sig-pos-f"; public static final String PARAM_SIG_IDX = "sig-idx"; public static String getConnector(HttpServletRequest request) { @@ -100,6 +101,10 @@ public class PdfAsParameterExtractor { return (String)request.getAttribute(PARAM_SIG_POS_R); } + public static String getSigPosF(HttpServletRequest request) { + return (String)request.getAttribute(PARAM_SIG_POS_F); + } + public static String getSigIdx(HttpServletRequest request) { return (String)request.getAttribute(PARAM_SIG_IDX); } -- cgit v1.2.3