diff options
author | Alexander Marsalek <amarsalek@iaik.tugraz.at> | 2021-07-22 17:55:53 +0200 |
---|---|---|
committer | Alexander Marsalek <amarsalek@iaik.tugraz.at> | 2021-07-22 17:55:53 +0200 |
commit | a898c819e2b496d63c5335faa6f232e7f16423cb (patch) | |
tree | 080ab717cb788f5703c216fbb6a67a5a5df231b3 /pdf-as-web/src/main/java/at/gv | |
parent | f56db3e87ce5cf7f8b345796cc95660a872b3a18 (diff) | |
download | pdf-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
Diffstat (limited to 'pdf-as-web/src/main/java/at/gv')
-rw-r--r-- | pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/PlaceholderGeneratorServlet.java | 8 |
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; } |