aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-pdfbox-2/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-as-pdfbox-2/src/main')
-rw-r--r--pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/placeholder/SignatureFieldsExtractor.java39
-rw-r--r--pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/placeholder/SignaturePlaceholderExtractor.java9
2 files changed, 39 insertions, 9 deletions
diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/placeholder/SignatureFieldsExtractor.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/placeholder/SignatureFieldsExtractor.java
index a8473858..0ccce1f8 100644
--- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/placeholder/SignatureFieldsExtractor.java
+++ b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/placeholder/SignatureFieldsExtractor.java
@@ -1,5 +1,7 @@
package at.gv.egiz.pdfas.lib.impl.pdfbox2.placeholder;
+import at.gv.egiz.pdfas.lib.impl.placeholder.PlaceholderExtractorConstants;
+import at.gv.egiz.pdfas.lib.impl.placeholder.SignaturePlaceholderData;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.interactive.digitalsignature.PDSignature;
import org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm;
@@ -30,4 +32,41 @@ public class SignatureFieldsExtractor {
}
return signatureFieldNames;
}
+ /*
+ Needed by PDF-OVER
+ */
+ public static SignaturePlaceholderData getNextSignaturePlaceHolder(PDDocument doc) {
+ try {
+ SignaturePlaceholderExtractor signaturePlaceholderExtractor = new SignaturePlaceholderExtractor("1",
+ PlaceholderExtractorConstants.PLACEHOLDER_MATCH_MODE_SORTED, doc);
+ return signaturePlaceholderExtractor.extract(doc, "1",
+ PlaceholderExtractorConstants.PLACEHOLDER_MATCH_MODE_SORTED);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ public static SignaturePlaceholderData getSignaturePlaceHolder(PDDocument doc, String placeholderId,
+ int mode) {
+ try {
+ SignaturePlaceholderExtractor signaturePlaceholderExtractor = new SignaturePlaceholderExtractor( placeholderId,
+ mode, doc);
+ return signaturePlaceholderExtractor.extract(doc, placeholderId, mode);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ public static List<SignaturePlaceholderData> getSignaturePlaceHolderList(PDDocument doc, String placeholderId, int mode) {
+ try {
+ SignaturePlaceholderExtractor signaturePlaceholderExtractor = new SignaturePlaceholderExtractor( placeholderId,
+ mode, doc);
+ return signaturePlaceholderExtractor.extractList(doc, placeholderId, mode);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
}
diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/placeholder/SignaturePlaceholderExtractor.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/placeholder/SignaturePlaceholderExtractor.java
index 4031d07f..71eef856 100644
--- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/placeholder/SignaturePlaceholderExtractor.java
+++ b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/placeholder/SignaturePlaceholderExtractor.java
@@ -194,14 +194,6 @@ public class SignaturePlaceholderExtractor extends PDFStreamEngine implements Pl
public List<SignaturePlaceholderData> extractList(PDDocument doc,
String placeholderId, int matchMode) throws PdfAsException {
SignaturePlaceholderContext.setSignaturePlaceholderData(null);
-// List<SignaturePlaceholderData> placeholders = new ArrayList<>();
-// SignaturePlaceholderExtractor extractor;
-// try {
-// extractor = new SignaturePlaceholderExtractor(placeholderId,
-// matchMode, doc);
-// } catch (IOException | ClassNotFoundException | InstantiationException | IllegalAccessException e2) {
-// throw new PDFIOException("error.pdf.io.04", e2);
-// }
int pageNr = 0;
for(PDPage page : doc.getPages()){
@@ -236,7 +228,6 @@ public class SignaturePlaceholderExtractor extends PDFStreamEngine implements Pl
if (matchMode == PLACEHOLDER_MATCH_MODE_STRICT) {
throw new PlaceholderExtractionException("error.pdf.stamp.09");
}
-
return null;
}