Yannick Hanus created PDFBOX-5978:
-------------------------------------
Summary: Issue when saving pdf with NO_COMPRESSION
Key: PDFBOX-5978
URL: https://issues.apache.org/jira/browse/PDFBOX-5978
Project: PDFBox
Issue Type: Bug
Components: PDModel
Affects Versions: 3.0.4 JBIG2
Reporter: Yannick Hanus
Attachments: NO_COMPRESSION.65535f.png, Test_NO_COMPRESSION.java
Hello,
Java version : 21
Pdfbox version : 3.0.4
When a pdf is saved with option CompressParameters.NO_COMPRESSION, useless
lines like
_nnnnnnnnnn_ 65535 f
are added to xref section
When splitting a pdf, this side effect seems cumulative when saving each part.
Not really relevant when saving only one pdf but when splitting a pdf to 5000
parts, it becomes huge.
You can reproduce the issue with any pdf
Current workaround to fix this issue : open and save the produced pdf(s) with
itextpdf 5.5.13.4 remove the useless lines like _nnnnnnnnnn_ 65535 f :
try (InputStream is = new FileInputStream(tempFile)) {
PdfReader pdfReader = new PdfReader(is);
PdfStamper pdfStamper = new PdfStamper(pdfReader, new
FileOutputStream(targetSplitFile));
pdfStamper.close();
pdfReader.close();
} catch (Exception e) {
throw new RuntimeException("Unable to save with itext " +
targetSplitFile, e);
}
You can use the attached class to reproduce de issue.
Just pass the absolute path to a pdf as argument to the class
Regards
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]