From c2accdef2e43307954718ad5683c881155588365 Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Tue, 18 Feb 2014 09:27:30 +0100 Subject: Added rotation parameter to PDF-AS Web Signed-off-by: Andreas Fitzek --- .../main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java | 14 ++++++++++++++ .../gv/egiz/pdfas/web/helper/PdfAsParameterExtractor.java | 5 +++++ 2 files changed, 19 insertions(+) (limited to 'pdf-as-web/src/main/java/at/gv/egiz') 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 607c6228..9f35fbc6 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 @@ -116,6 +116,7 @@ public class PdfAsHelper { String posX = PdfAsParameterExtractor.getSigPosX(request); String posY = PdfAsParameterExtractor.getSigPosY(request); String posW = PdfAsParameterExtractor.getSigPosW(request); + String posR = PdfAsParameterExtractor.getSigPosR(request); if (posP == null && posW == null && posX == null && posY == null) { return null; @@ -176,6 +177,19 @@ public class PdfAsHelper { } else { sb.append("p:auto;"); } + + if (posR != null) { + try { + Float.parseFloat(posR); + } catch (NumberFormatException e) { + throw new PdfAsWebException( + PdfAsParameterExtractor.PARAM_SIG_POS_R + + " has invalid value!", e); + } + sb.append("r:" + posR.trim() + ";"); + } else { + sb.append("r: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 b20a6656..500266be 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 @@ -18,6 +18,7 @@ public class PdfAsParameterExtractor { public static final String PARAM_SIG_POS_Y = "sig-pos-y"; 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_IDX = "sig-idx"; public static String getConnector(HttpServletRequest request) { @@ -72,6 +73,10 @@ public class PdfAsParameterExtractor { return (String)request.getAttribute(PARAM_SIG_POS_W); } + public static String getSigPosR(HttpServletRequest request) { + return (String)request.getAttribute(PARAM_SIG_POS_R); + } + public static String getSigIdx(HttpServletRequest request) { return (String)request.getAttribute(PARAM_SIG_IDX); } -- cgit v1.2.3