aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper
diff options
context:
space:
mode:
authorJakob Heher <jakob.heher@iaik.tugraz.at>2026-05-12 15:33:19 +0200
committerGitHub <noreply@github.com>2026-05-12 15:33:19 +0200
commitc8abbd8bef5349ab892a2853a4e5e3d5ed16b670 (patch)
tree04e86de8b547ac2685165cdf652b6c16355ae3c3 /pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper
parente2bfdc313c0b6395d272624688b4ed1cba7ce967 (diff)
downloadpdf-as-4-c8abbd8bef5349ab892a2853a4e5e3d5ed16b670.tar.gz
pdf-as-4-c8abbd8bef5349ab892a2853a4e5e3d5ed16b670.tar.bz2
pdf-as-4-c8abbd8bef5349ab892a2853a4e5e3d5ed16b670.zip
Update docs & various fixes discovered in the process (#86)
- update documentation for pdf-as 5 - document the v2 json api - fix a number of documentation quirks - document `keyId` parameter - px (pixels) -> pt (pdf page units) - document --verify_level - remove a number of documented features that were never implemented: - `adobeSignFieldValue` and `sigLogoAltText` from signature profiles - `UNDERLINE` and `STRIKETHRU` from fonts - `num-bytes` parameter - `verify_only`/`sign_only` enable states for profiles - update mobile BKU base URL - update pdfbox backend default to 3 in sample configurations - consistently made boolean parsing from configuration files case permissive - add moa verification timeout - add support for BOLDITALIC to all base fonts, and for ITALIC to helvetica and courier - fix a number of small quirks - hibernate properties are now reloaded properly - fix the signature block parameter key regex - v1 json api now correctly checks for onlinebku/mobilebku being enabled - pdfbox 2 module correctly compares for integer equality regardless of cached boxed ints - test operationcountwatcher no longer sometimes breaks due to spring context differences
Diffstat (limited to 'pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper')
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java33
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsParameterExtractor.java12
2 files changed, 4 insertions, 41 deletions
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 95e9089f..4a4d15b2 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
@@ -181,33 +181,6 @@ public class PdfAsHelper {
return pdfAsConfig;
}
- private static void validatePdfSize(HttpServletRequest request,
- HttpServletResponse response, byte[] pdfData)
- throws PdfAsWebException {
- // Try to check num-bytes
- String pdfSizeString = PdfAsParameterExtractor.getNumBytes(request);
- if (pdfSizeString != null) {
- long pdfSize = -1;
- try {
- pdfSize = Long.parseLong(pdfSizeString);
- } catch (NumberFormatException e) {
- throw new PdfAsWebException(
- PdfAsParameterExtractor.PARAM_NUM_BYTES
- + " parameter has to be a positiv number!", e);
- }
- if (pdfSize <= 0) {
- throw new PdfAsWebException(
- "Invalid PDF Size! Has to bigger than zero!");
- }
-
- if (pdfData.length != pdfSize) {
- throw new PdfAsWebException("Signature Data Size and "
- + PdfAsParameterExtractor.PARAM_NUM_BYTES
- + " missmatch!");
- }
- }
- }
-
public static String buildPosString(HttpServletRequest request,
HttpServletResponse response) throws PdfAsWebException {
String posP = PdfAsParameterExtractor.getSigPosP(request);
@@ -270,19 +243,19 @@ public class PdfAsHelper {
sb.append("w:auto;");
}
}
- sb.append("w:" + posW.trim() + ";");
+ sb.append("w:").append(posW.trim()).append(";");
} else {
sb.append("w:auto;");
}
if (posP != null) {
- if (!(posP.equals("auto") || posP.equals("new"))) {
+ if (!(posP.equals("auto") || posP.equals("new") || posP.equals("last"))) {
try {
Integer.parseInt(posP);
} catch (NumberFormatException e) {
throw new PdfAsWebException(
PdfAsParameterExtractor.PARAM_SIG_POS_P
- + " has invalid value! (auto | new )");
+ + " has invalid value! (auto | new | last)");
}
}
sb.append("p:" + posP.trim() + ";");
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 0791e37e..ede5fdf5 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
@@ -41,7 +41,6 @@ public class PdfAsParameterExtractor {
public static final String PARAM_CONNECTOR = "connector";
public static final String PARAM_TRANSACTION_ID = "transactionId";
- public static final String PARAM_CONNECTOR_DEFAULT = "bku";
public static final String PARAM_FORMAT = "format";
public static final String PARAM_HTML = "html";
@@ -63,7 +62,6 @@ public class PdfAsParameterExtractor {
public static final String PARAM_VERIFY_LEVEL_OPTION_INT_ONLY = "intOnly";
public static final String PARAM_LOCALE = "locale";
- public static final String PARAM_NUM_BYTES = "num-bytes";
public static final String PARAM_PDF_URL = "pdf-url";
public static final String PARAM_SIG_TYPE = "sig-type";
public static final String PARAM_SIG_TYPE_ALIAS = "sig_type";
@@ -85,11 +83,7 @@ public class PdfAsParameterExtractor {
.getLogger(PdfAsParameterExtractor.class);
public static String getConnector(HttpServletRequest request) {
- String connector = (String)request.getAttribute(PARAM_CONNECTOR);
- if(connector != null) {
- return connector;
- }
- return PARAM_CONNECTOR_DEFAULT;
+ return (String)request.getAttribute(PARAM_CONNECTOR);
}
public static Map<String,String> getDynamicSignatureBlockParameters(HttpServletRequest request) throws Exception {
@@ -234,10 +228,6 @@ public class PdfAsParameterExtractor {
return null;
}
- public static String getNumBytes(HttpServletRequest request) {
- return (String)request.getAttribute(PARAM_NUM_BYTES);
- }
-
public static String getPdfUrl(HttpServletRequest request) {
return (String)request.getAttribute(PARAM_PDF_URL);
}