jmarxuach / batchpdfsign Goto Github PK
View Code? Open in Web Editor NEWCLI 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
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
Searching in google I found this that suggest there is a bug in itext7, but im not sure.
I have a PDF that throws this error, but i can't attach because is confidential.
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.
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?
The timestamp server seems to be down. Indeed, a wget
to https://freetsa.org/tsr
fails:
Does someone knows another timestamp server that we can temporarily use to direct, and can we make this a configurable attribute?
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}
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
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)
how to validate a signed document against a certificate ?
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:
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
@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)
A Maven package can be created every time a new version is created.
The feature is already included and just has to be activated.
https://github.com/jmarxuach/BatchPDFSign/blob/master/.github/workflows/maven-publish.yml
The version of the lib dependency in the portable pom.xml is still on 1.0.5, should be 1.0.5.1
Good morning,
I need to add a reason to PDF signatures..... is there a way to do it?
Greetings,
Gonzalo
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.