From 3df0c815ba9a7fc53412ec2f39d72951e8de9789 Mon Sep 17 00:00:00 2001 From: Emina Ahmetovic Date: Thu, 28 Jan 2021 09:13:05 +0100 Subject: new RC version, sort placeholders by id --- build.gradle | 2 +- .../lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 150d8166..8b3d6d60 100644 --- a/build.gradle +++ b/build.gradle @@ -18,7 +18,7 @@ task wrapper(type: Wrapper) { allprojects { apply plugin: "com.github.ben-manes.versions" repositories { mavenCentral() } - version = '4.1.7-RC-0.0.1' + version = '4.1.7-RC-0.0.2' } configurations { 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 720aec53..eec9b6c1 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 @@ -896,15 +896,26 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants { return existingLocations; } - //find first available placeholder + //find first placeholder_id public SignaturePlaceholderData checkAvailablePlaceholders(List placeholders, List existingPlaceholders) { SignaturePlaceholderData result = null; if(placeholders!=null) { for(int i = 0; i < placeholders.size(); ++i) { + //take smallest id if(!existingPlaceholders.contains(placeholders.get(i).getPlaceholderName())) { - result = placeholders.get(i); - break; + SignaturePlaceholderData spd = placeholders.get(i); + if (spd.getId() != null) { + if(result == null) { + result = spd; + } else { + String currentID = result.getId(); + String testID = spd.getId(); + if(testID.compareToIgnoreCase(currentID) < 0) { + result = spd; + } + } + } } } } -- cgit v1.2.3