How to close jsignpdf process after finish in batch mode?

962 views
Skip to first unread message

George

unread,
Sep 24, 2013, 5:56:26 PM9/24/13
to jsig...@googlegroups.com
After runing in cmd: java -jar jsignpdf.jar ...(options) , all works fine, but jsign doesn't return the control to cmd. Ctrl+C doesnt work, so the only way is to kill the process. I want to automate signing pdf by running a batch. Would by nice to know if succesful signed by the exitcode. Is there a workaround? Thanks.

Josef Cacek

unread,
Sep 25, 2013, 3:06:18 AM9/25/13
to JSignPdf forum
Hi George,
the batch mode should really be the "batch mode" and complete without Ctrl+C.
Could you provide more details about your environment?
- OS version
- Java version
- JSignPdf version + parameters given to JSignPdf

The exit codes are implemented - check documentation - chapter 9.1
Program exit codes.

-- jc

On Tue, Sep 24, 2013 at 11:56 PM, George <ursuge...@gmail.com> wrote:
> After runing in cmd: java -jar jsignpdf.jar ...(options) , all works fine, but jsign doesn't return the control to cmd. Ctrl+C doesnt work, so the only way is to kill the process. I want to automate signing pdf by running a batch. Would by nice to know if succesful signed by the exitcode. Is there a workaround? Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups "JSignPdf" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to jsignpdf+u...@googlegroups.com.
> To post to this group, send email to jsig...@googlegroups.com.
> Visit this group at http://groups.google.com/group/jsignpdf.
> For more options, visit https://groups.google.com/groups/opt_out.

George

unread,
Sep 25, 2013, 4:12:22 AM9/25/13
to jsig...@googlegroups.com
 
SO: windows 7 ultimate 32-bit
JAVA: java version "1.7.0_25" Java(TM) SE Runtime Environment (build 1.7.0_25-b17) Java HotSpot(TM) Client VM (build 23.25-b01, mixed mode, sharing) 
 
JSignPDF version: 1.5.0
 
In cmd.exe prompt:
C:\Users\George>java -jar "C:\Program Files\JSignPdf\JSignPdf.jar" c:\factura.pdf --out-directory c:\ -kst WINDOWS-MY --certification-level CERTIFIED_NO_CHANGES_ALLOWED -llx 9 -lly 18 --visible-signature
INFO  Checking input and output PDF paths.
INFO  Getting key alias
INFO  Certificate George-PC\George expired already.
INFO  Used key alias: Irina Usuc
INFO  Loading private key
INFO  Getting certificate chain
INFO  Opening input PDF file: c:\factura.pdf
INFO  Creating output PDF file: c:/factura_signed.pdf
INFO  Creating signature
INFO  Setting certification level
INFO  Configuring visible signature
INFO  Use only layers recommend by Acrobat 6: true
INFO  Setting background image scale
INFO  Setting Layer 2 text (description)
INFO  Setting Layer 4 text (status)
INFO  Setting Render mode
INFO  Creating visible signature
INFO  Processing (it may take a while) ...
INFO  Closing result PDF stream
INFO  Finished: Signature succesfully created.
 
And the control doesn't return to cmd.exe.
Thanks.

Josef Cacek

unread,
Sep 25, 2013, 7:29:56 AM9/25/13
to JSignPdf forum
Thanks for details, but I'm sorry, I didn't find any problem on JSignPdf side. 
I've tested it now on Windows 2008 server and the program finished without any problem:

w:\tmp\jsignpdf-1.5.0>"%JAVA_HOME%\bin\java" -version
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b17)
Java HotSpot(TM) Client VM (build 23.25-b01, mixed mode)

w:\tmp\jsignpdf-1.5.0>"%JAVA_HOME%\bin\java" -jar JSignPdf.jar docs\JSignPdf.pdf --out-directory . -kst WINDOWS-MY --certification-level CERTIFIED_NO_CHANGES_ALLOWED -llx 9 -lly 18 --visible-signature
DEBUG Relaxing SSL security.
INFO  Checking input and output PDF paths.
INFO  Getting key alias
INFO  Used key alias: tomcat
INFO  Loading private key
INFO  Getting certificate chain
INFO  Opening input PDF file: docs\JSignPdf.pdf
INFO  Creating output PDF file: ./JSignPdf_signed.pdf
INFO  Creating signature
INFO  Setting certification level
INFO  Configuring visible signature
INFO  Use only layers recommend by Acrobat 6: true
INFO  Setting background image scale
INFO  Setting Layer 2 text (description)
INFO  Setting Layer 4 text (status)
INFO  Setting Render mode
INFO  Creating visible signature
INFO  Processing (it may take a while) ...
INFO  Closing result PDF stream
INFO  Finished: Signature succesfully created.

w:\tmp\jsignpdf-1.5.0>

Is your certificate directly in the windows certificate store or is it retrieved from a smart-card?

Could you try to use the version from installer?
and then call JSignPdfC.exe (instead of "java -jar JSignPdf.jar").

Regards,
-- jc

--

George

unread,
Sep 25, 2013, 2:55:56 PM9/25/13
to jsig...@googlegroups.com
Yes, the certificate is obtained from a smart-card. I'll try with jsignpdfc.exe. It accepts the same command line parameters ?
The same behaviour is obtained with: java -jar jsign.pdf -lkt . I tryed with the same result on a windows 8 64 bit .
Thanks for you support.

Josef Cacek

unread,
Sep 26, 2013, 2:51:04 AM9/26/13
to JSignPdf forum
JSignPdfC.exe is only a simple wrapper which uses a bundled JRE, so it gets the same program arguments.
Preferred way to use certificates on a smart-card is to configure PKCS#11 keystore.
-- jc


Reply all
Reply to author
Forward
0 new messages