aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Marsalek <amarsalek@iaik.tugraz.at>2021-07-22 17:55:53 +0200
committerAlexander Marsalek <amarsalek@iaik.tugraz.at>2021-07-22 17:55:53 +0200
commita898c819e2b496d63c5335faa6f232e7f16423cb (patch)
tree080ab717cb788f5703c216fbb6a67a5a5df231b3
parentf56db3e87ce5cf7f8b345796cc95660a872b3a18 (diff)
downloadpdf-as-4-a898c819e2b496d63c5335faa6f232e7f16423cb.tar.gz
pdf-as-4-a898c819e2b496d63c5335faa6f232e7f16423cb.tar.bz2
pdf-as-4-a898c819e2b496d63c5335faa6f232e7f16423cb.zip
generate placeholders without leading zeros and limit length to 5 digits
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/PlaceholderGeneratorServlet.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/PlaceholderGeneratorServlet.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/PlaceholderGeneratorServlet.java
index 002e0678..a35269d2 100644
--- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/PlaceholderGeneratorServlet.java
+++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/PlaceholderGeneratorServlet.java
@@ -75,6 +75,14 @@ public class PlaceholderGeneratorServlet extends HttpServlet implements Placehol
if(id != null && !id.isEmpty()) {
id = id.replaceAll("[^0-9]", "");
if(id != null && !id.isEmpty()) {
+ try{
+ if(id.length()> 5)
+ id = id.substring(0,5);
+ int value = Integer.parseInt(id);
+ id = Integer.toString(value);//remove leading zeros
+ }catch(Exception e){
+
+ }
buildString = buildString + ";" + SignaturePlaceholderData.ID_KEY + "=" + id;
filename = filename + "_" + id;
}