aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-cli/src
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-as-cli/src')
-rw-r--r--pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java29
1 files changed, 23 insertions, 6 deletions
diff --git a/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java b/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java
index 47d06576..86769c49 100644
--- a/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java
+++ b/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java
@@ -85,6 +85,9 @@ public class Main {
public static final String CLI_ARG_CONF_SHORT = "conf";
public static final String CLI_ARG_CONF = "configuration";
+ public static final String CLI_ARG_SIGNATURE_BLOCK_PARAM_SHORT = "sbp";
+ public static final String CLI_ARG_SIGNATURE_BLOCK_PARAM = "signature_block_parameter";
+
public static final String CLI_ARG_DEPLOY_SHORT = "d";
public static final String CLI_ARG_DEPLOY = "deploy";
@@ -199,6 +202,10 @@ public class Main {
true, "The output file");
cliOptions.addOption(outputOption);
+ Option signatureBlockParameters = new Option(CLI_ARG_SIGNATURE_BLOCK_PARAM_SHORT, CLI_ARG_SIGNATURE_BLOCK_PARAM,
+ true, "Parameters or signature block");
+ cliOptions.addOption(signatureBlockParameters);
+
return cliOptions;
}
@@ -434,12 +441,22 @@ public class Main {
System.out.println("Starting signature for " + pdfFile);
System.out.println("Selected signature Profile " + profilID);
- //TODO get values from CLI
- Map<String, String> test = new HashMap<>();
- test.put("schoolName", "EGIZ testschule");
-
- test.put("subject","bbDbb");
- signParameter.setDynamicSignatureBlockArguments(test);
+ // get console parameters related to signature block
+ String[] signatureBlockParameters = null;
+ if (cli.hasOption(CLI_ARG_SIGNATURE_BLOCK_PARAM_SHORT)) {
+ signatureBlockParameters = cli.getOptionValues(CLI_ARG_SIGNATURE_BLOCK_PARAM_SHORT);
+ }
+ Map<String, String> signatureBlockParametersMap = new HashMap<>();
+ if(signatureBlockParameters != null && signatureBlockParameters.length > 0) {
+ for(String s : signatureBlockParameters) {
+ if(!s.contains("=")) {
+ throw new Exception("Invalid parameter: "+s);
+ }
+ String[] values = s.split("=", 2);
+ signatureBlockParametersMap.put(values[0], values[1]);
+ }
+ }
+ signParameter.setDynamicSignatureBlockArguments(signatureBlockParametersMap);
SignResult result = null;
try {