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 --- .../lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'pdf-as-pdfbox-2/src/main/java/at/gv/egiz') 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