From a898c819e2b496d63c5335faa6f232e7f16423cb Mon Sep 17 00:00:00 2001 From: Alexander Marsalek Date: Thu, 22 Jul 2021 17:55:53 +0200 Subject: generate placeholders without leading zeros and limit length to 5 digits --- .../gv/egiz/pdfas/web/servlets/PlaceholderGeneratorServlet.java | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'pdf-as-web/src/main/java/at/gv/egiz/pdfas') 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; } -- cgit v1.2.3