Giter Site home page Giter Site logo

jmarxuach / batchpdfsign Goto Github PK

View Code? Open in Web Editor NEW
43.0 6.0 11.0 101 KB

CLI Command line tool to digital signature of PDF files with PKCS12 certificate. You can find the executable in the releases.

License: GNU General Public License v3.0

Java 100.00%
pdf signature batch-processing pkcs12 certificate sign signing pdf-document pdf-files command-line

batchpdfsign's Issues

Hi, timeout tsa problem.

First of all, thank you for this api.

¿Could you add a timeout to get the tsa ?
Some times it takes 5 minutes to get the response and it's really annoying.

Thank you.

Location, reason options not recognized

From the documentation:

--reason Reason field of the signature
--location Location field of the signature

However,

Unrecognized option: --reason
Unrecognized option: --location

I would like to use these options. Is it in a development branch only?

New functions

I would like to request two options.
1st - Have the possibility of disabling the use of TSA.
2nd - Have the possibility of inserting variables in the personalized signature text, such as: Electronically signed by ${signer}, ${timestamp}, ${location},
${reason}, ${contact}

Proposed feature - Add signature field and signature text

Hi,

I'm looking for a program that can detect a signature field in the PDF and sing it. I think it'd be a good feature to add to this program. Could be adding something like --field <arg>, where arg is the name of the field.

For example,
java -jar BatchPDFSignPortable.jar -k mycertificate.pfx -p CertificatePassword -i myfile.pdf -o myfilesigned.pdf --field "Signature" --signtext "Signed by John Doe"

Unfamiliar with java otherwise id do it myself. Great job nonetheless.

Kind regards

Not enough space

Hi Guys !!! What`s Up ? Going Well ? I hope so !!!

When i run over java 17, it it returns to me Not enough space ... What could be ? THANKS

java -jar BatchPDFSignPortable.jar -k pfxfile.pfx -p pfxpwd -i pdfIn.pdf -o pdfOut.pdf

[main] INFO com.itextpdf.signatures.TSAClientBouncyCastle - Timestamp generated: Thu Dec 01 08:52:27 BRT 2022

Not enough space

usage: BatchPDFSignPortable
--fs font size of text in signature rectangle (default:
12); needs --page to be specified as well
-i,--input input file path
-k,--key key file path
-o,--output output file
-p,--password keyfile password
--page page of signature rectangle; needs to be specified
to output signature rectangle
--rh height of signature rectangle; needs --page to be
specified as well
--rw width of signature rectangle; needs --page to be
specified as well
--rx x position of signature rectangle; needs --page to
be specified as well
--ry y position of signature rectangle; needs --page to
be specified as well
--signtext signature text; needs --page to be specified as
well
--tsa URI of the time service authority (TSA)

[Request] Updating the About page

The About description of the project still mentions Version 1.0.0.zip which is long outdated.

I propose this:
CLI Command line tool to digital signature of PDF files with PKCS12 certificate. You can find the executable in the releases.

Also adding tags would probably help other people find this project and I think it could be very useful to other people.
I propose the following tags:

  • cli
  • pdf
  • signature
  • java-8
  • java

Reporting a string of error when running.

I remember when I use it at the beginning of the year, it run successfully.
today, I tried to use it but it said:

D:\home λ gsudo java -jar ..\batchpdfsign-portable.jar -k `pfx` -p `password` -i `pdf` -o `_out.pdf`        
Exception in thread "main" com.itextpdf.kernel.PdfException: Unknown PdfException.
        at com.itextpdf.signatures.PdfPKCS7.getEncodedPKCS7(PdfPKCS7.java:934)
        at com.itextpdf.signatures.PdfSigner.signDetached(PdfSigner.java:648)
        at com.itextpdf.signatures.PdfSigner.signDetached(PdfSigner.java:538)
        at BatchPDFSign.lib.BatchPDFSign.signFile(BatchPDFSign.java:77)
        at BatchPDFSign.portable.Main.main(Main.java:48)
Caused by: java.net.SocketException: Permission denied: connect
        at java.net.DualStackPlainSocketImpl.connect0(Native Method)
        at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
        at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
        at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
        at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
        at java.net.PlainSocketImpl.connect(Unknown Source)
        at java.net.SocksSocketImpl.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at sun.security.ssl.SSLSocketImpl.connect(Unknown Source)
        at sun.security.ssl.BaseSSLSocketImpl.connect(Unknown Source)
        at sun.net.NetworkClient.doConnect(Unknown Source)
        at sun.net.www.http.HttpClient.openServer(Unknown Source)
        at sun.net.www.http.HttpClient.openServer(Unknown Source)
        at sun.net.www.protocol.https.HttpsClient.<init>(Unknown Source)
        at sun.net.www.protocol.https.HttpsClient.New(Unknown Source)
        at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(Unknown Source)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(Unknown Source)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
        at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
        at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(Unknown Source)
        at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)
        at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(Unknown Source)
        at com.itextpdf.signatures.SignUtils.getTsaResponseForUserRequest(SignUtils.java:280)
        at com.itextpdf.signatures.TSAClientBouncyCastle.getTSAResponse(TSAClientBouncyCastle.java:268)
        at com.itextpdf.signatures.TSAClientBouncyCastle.getTimeStampToken(TSAClientBouncyCastle.java:227)
        at com.itextpdf.signatures.PdfPKCS7.getEncodedPKCS7(PdfPKCS7.java:900)
        ... 4 more

ERROR com.itextpdf.kernel.pdf.PdfReader - Error occurred while reading cross reference table. Cross reference table will be rebuilt

@jmarxuach can you try out if version 1.0.5.1 works, because I only removed .useAppendMode().

It Works !! Even if prints the exception

[main] ERROR com.itextpdf.kernel.pdf.PdfReader - Error occurred while reading cross reference table. Cross reference table will be rebuilt.
com.itextpdf.io.IOException: Error at file pointer 46,820.
        at com.itextpdf.io.source.PdfTokenizer.throwError(PdfTokenizer.java:686)
        at com.itextpdf.kernel.pdf.PdfReader.readXrefSection(PdfReader.java:1011)
        at com.itextpdf.kernel.pdf.PdfReader.readXref(PdfReader.java:929)
        at com.itextpdf.kernel.pdf.PdfReader.readPdf(PdfReader.java:677)
        at com.itextpdf.kernel.pdf.PdfDocument.open(PdfDocument.java:1871)
        at com.itextpdf.kernel.pdf.PdfDocument.<init>(PdfDocument.java:324)
        at com.itextpdf.signatures.PdfSigner.initDocument(PdfSigner.java:306)
        at com.itextpdf.signatures.PdfSigner.<init>(PdfSigner.java:288)
        at com.itextpdf.signatures.PdfSigner.<init>(PdfSigner.java:271)
        at BatchPDFSign.lib.BatchPDFSign.signFile(BatchPDFSign.java:75)
        at BatchPDFSign.portable.Main.main(Main.java:48)
Caused by: com.itextpdf.io.IOException: file position {0} cross reference entry in this xref subsection.
        ... 11 more
[main] ERROR com.itextpdf.kernel.pdf.PdfReader - Error occurred while reading cross reference table. Cross reference table will be rebuilt.
com.itextpdf.io.IOException: Error at file pointer 46,820.
        at com.itextpdf.io.source.PdfTokenizer.throwError(PdfTokenizer.java:686)
        at com.itextpdf.kernel.pdf.PdfReader.readXrefSection(PdfReader.java:1011)
        at com.itextpdf.kernel.pdf.PdfReader.readXref(PdfReader.java:929)
        at com.itextpdf.kernel.pdf.PdfReader.readPdf(PdfReader.java:677)
        at com.itextpdf.kernel.pdf.PdfDocument.open(PdfDocument.java:1871)
        at com.itextpdf.kernel.pdf.PdfDocument.<init>(PdfDocument.java:324)
        at com.itextpdf.signatures.PdfSigner.initDocument(PdfSigner.java:306)
        at com.itextpdf.signatures.PdfSigner.<init>(PdfSigner.java:288)
        at com.itextpdf.signatures.PdfSigner.<init>(PdfSigner.java:271)
        at BatchPDFSign.lib.BatchPDFSign.signFile(BatchPDFSign.java:79)
        at BatchPDFSign.portable.Main.main(Main.java:48)
Caused by: com.itextpdf.io.IOException: file position {0} cross reference entry in this xref subsection.
        ... 11 more
[main] INFO com.itextpdf.signatures.TSAClientBouncyCastle - Timestamp generated: Thu Jul 23 14:54:01 CEST 2020

Originally posted by @jmarxuach in #6 (comment)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.