Permalink
Browse files

fix: add -o out-file option

  • Loading branch information...
dengshilong committed Dec 8, 2016
1 parent 72eb353 commit 9b17fa04a380f9d387438f15a72eca2ba92e4714
@@ -214,6 +214,7 @@ hlp.location = location of a signatue (e.g. Washington DC). Empty by d
hlp.ocsp = enable OCSP certificate validation
hlp.ocspServerUrl = default OCSP server URL, which will be used in case the signing certificate doesn't contain this information
hlp.outPath = folder in which the signed documents will be stored. Default value is current folder.
hlp.outFile = output pdf file
hlp.outPrefix = prefix for signed file. Default value is empty prefix.
hlp.outSuffix = suffix for signed filename. Default value is "_signed". (e.g. sign process on file mydocument.pdf will create new file mydocument_signed.pdf)
hlp.ownerpwd = owner password for encrypted documents (used when -e option is given)
@@ -264,6 +264,10 @@
public static final String ARG_OUTPATH = "d";
public static final String ARG_OUTPATH_LONG = "out-directory";
public static final String ARG_OUTFILE = "o";
public static final String ARG_OUTFILE_LONG = "out-file";
public static final String ARG_OPREFIX = "op";
public static final String ARG_OPREFIX_LONG = "out-prefix";
@@ -238,7 +238,9 @@ private static void signFiles(SignerOptionsFromCmdLine anOpts) {
final StringBuilder tmpName = new StringBuilder(anOpts.getOutPath());
tmpName.append(anOpts.getOutPrefix());
tmpName.append(tmpNameBase).append(anOpts.getOutSuffix()).append(tmpSuffix);
anOpts.setOutFile(tmpName.toString());
String outFile = anOpts.getOutFile();
if (outFile == null)
anOpts.setOutFile(tmpName.toString());
if (tmpLogic.signFile()) {
successCount++;
} else {
@@ -130,6 +130,8 @@ public void loadCmdLine(final String[] anArgs) throws ParseException {
setKeyPasswd(line.getOptionValue(ARG_KEY_PWD));
if (line.hasOption(ARG_OUTPATH))
setOutPath(line.getOptionValue(ARG_OUTPATH));
if (line.hasOption(ARG_OUTFILE))
setOutFile(line.getOptionValue(ARG_OUTFILE));
if (line.hasOption(ARG_OPREFIX))
setOutPrefix(line.getOptionValue(ARG_OPREFIX));
if (line.hasOption(ARG_OSUFFIX))
@@ -304,6 +306,8 @@ private float getFloat(Object aVal, float aDefVal) {
OPTS.addOption(OptionBuilder.withLongOpt(ARG_OUTPATH_LONG).withDescription(RES.get("hlp.outPath")).hasArg()
.withArgName("path").create(ARG_OUTPATH));
OPTS.addOption(OptionBuilder.withLongOpt(ARG_OUTFILE_LONG).withDescription(RES.get("hlp.outFile")).hasArg()
.withArgName("outfile").create(ARG_OUTFILE));
OPTS.addOption(OptionBuilder.withLongOpt(ARG_OPREFIX_LONG).withDescription(RES.get("hlp.outPrefix")).hasArg()
.withArgName("prefix").create(ARG_OPREFIX));
OPTS.addOption(OptionBuilder.withLongOpt(ARG_OSUFFIX_LONG).withDescription(RES.get("hlp.outSuffix")).hasArg()

0 comments on commit 9b17fa0

Please sign in to comment.