From e6c60914f63c7ad0381ac008542b4ef9c1938383 Mon Sep 17 00:00:00 2001 From: Alexander Marsalek Date: Mon, 31 May 2021 19:15:56 +0200 Subject: tmp --- .../at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib') diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java index 6345a714..a6a7ced3 100644 --- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java +++ b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java @@ -916,7 +916,7 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants { if(placeholders!=null) { for(int i = 0; i < placeholders.size(); ++i) { //take smallest id - if(!existingPlaceholders.contains(placeholders.get(i).getPlaceholderName())) { + if(!existingPlaceholders.contains(placeholders.get(i).getPlaceholderName())) { SignaturePlaceholderData spd = placeholders.get(i); if (spd.getId() != null) { if(result == null) { @@ -924,6 +924,7 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants { } else { String currentID = result.getId(); String testID = spd.getId(); + //TODO why compare as string? if(testID.compareToIgnoreCase(currentID) < 0) { result = spd; } -- cgit v1.2.3 From fef273a399d7ce891262d217cc04e4aea032c919 Mon Sep 17 00:00:00 2001 From: Alexander Marsalek Date: Tue, 1 Jun 2021 11:18:24 +0200 Subject: try to parse placeholder id as int and sort as int with fallback to string --- .../lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib') diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java index a6a7ced3..fd0472ac 100644 --- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java +++ b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java @@ -922,11 +922,19 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants { if(result == null) { result = spd; } else { - String currentID = result.getId(); - String testID = spd.getId(); - //TODO why compare as string? - if(testID.compareToIgnoreCase(currentID) < 0) { - result = spd; + try{ + int currentID = Integer.parseInt(result.getId()); + int testID = Integer.parseInt(spd.getId()); + if(testID < currentID) { + result = spd; + } + }catch(Exception e){ + //fallback to string compare + String currentID = result.getId(); + String testID = spd.getId(); + if(testID.compareToIgnoreCase(currentID) < 0) { + result = spd; + } } } } -- cgit v1.2.3