Comments (9)
That's 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.(PdfDocument.java:324)
at com.itextpdf.signatures.PdfSigner.initDocument(PdfSigner.java:306)
at com.itextpdf.signatures.PdfSigner.(PdfSigner.java:288)
at com.itextpdf.signatures.PdfSigner.(PdfSigner.java:271)
at BatchPDFSign.lib.BatchPDFSign.signFile(BatchPDFSign.java:73)
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
Exception in thread "main" com.itextpdf.kernel.PdfException: Append mode requires a document without errors, even if recovery is possible.
at com.itextpdf.kernel.pdf.PdfDocument.open(PdfDocument.java:1918)
at com.itextpdf.kernel.pdf.PdfDocument.(PdfDocument.java:324)
at com.itextpdf.signatures.PdfSigner.initDocument(PdfSigner.java:306)
at com.itextpdf.signatures.PdfSigner.(PdfSigner.java:288)
at com.itextpdf.signatures.PdfSigner.(PdfSigner.java:271)
at BatchPDFSign.lib.BatchPDFSign.signFile(BatchPDFSign.java:73)
at BatchPDFSign.portable.Main.main(Main.java:48)
from batchpdfsign.
I've tried it with the sample file supplied by the OP of the question, found here. Can you the file or some similar file?
The version of iText7 the OP used was 7.0.4, we use 7.1.11. So I think the bug would be fixed already.
from batchpdfsign.
I've tried it with the sample file supplied by the OP of the question, found here. Can you the file or some similar file?
The version of iText7 the OP used was 7.0.4, we use 7.1.11. So I think the bug would be fixed already.
I agree. Look, if I try to with following code
StampingProperties properties = new StampingProperties();
instead of
StampingProperties properties = new StampingProperties().preserveEncryption().useAppendMode();
It works !
I think useAppendModemode and preserveEncryption requires a document without errors, even if recovery is possible in itext7.
from batchpdfsign.
from batchpdfsign.
I'll have to test if removing preserveEncyription() still works with PDF/A
from batchpdfsign.
@jmarxuach can you try out if version 1.0.5.1 works, because I only removed .useAppendMode().
from batchpdfsign.
@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
from batchpdfsign.
@jmarxuach your pdf file is probably damaged, can you try with a similar file?
from batchpdfsign.
@jmarxuach your pdf file is probably damaged, can you try with a similar file?
My Pdf file is 1,4 version and is created with https://wkhtmltopdf.org/ I can open it with acrobat reader DC and the signed PDF too.
Anyway, now BatchPDFSign works even if prints the exception. My PDF file is a worst case test. I have created a release v1.0.5.1
To me, issue is solved. May be I will open a new one to remember to solve the exception print.
from batchpdfsign.
Related Issues (15)
- [Request] Maven Package HOT 5
- Maven portable pom.xml has wrong dependency version HOT 1
- Is it possible to add a reason to signature? HOT 2
- Reporting a string of error when running. HOT 2
- Proposed feature - Add signature field and signature text
- Timestamp server down HOT 1
- Does not sign, the error is displayed: "PdfReader is not opened with owner password" and last "Unknown PdfException." HOT 1
- Not enough space HOT 1
- Location, reason options not recognized HOT 5
- Hi, timeout tsa problem. HOT 1
- Signature validation HOT 3
- New functions
- ERROR com.itextpdf.kernel.pdf.PdfReader - Error occurred while reading cross reference table. Cross reference table will be rebuilt HOT 1
- [Request] Updating the About page HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from batchpdfsign.