pdfbox-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tilman Hausherr (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (PDFBOX-4227) java.util.zip.DataFormatException: invalid distance too far back
Date Wed, 23 May 2018 16:55:00 GMT

    [ https://issues.apache.org/jira/browse/PDFBOX-4227?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16487633#comment-16487633
] 

Tilman Hausherr commented on PDFBOX-4227:
-----------------------------------------

Rendering works fine because the metadata isn't used.

What would you like us to do? The easiest would be to skip a bad XMP metadata, but then it
would be missing in the merged PDF. Another possibility would be to create some code just
for you, that would repair such files (if you can identify them) prior to merging them.

> java.util.zip.DataFormatException: invalid distance too far back
> ----------------------------------------------------------------
>
>                 Key: PDFBOX-4227
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4227
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 2.0.9
>            Reporter: Michael Miller
>            Priority: Major
>         Attachments: testCorrupt.pdf
>
>
> I get a zip exception with the attached PDF file, which renders successfully in a couple
of PDF viewers I tried.
> ByteArrayInputStream pdfInputStream = new ByteArrayInputStream(pdfByteArray);
> PDFMergerUtility merger = new PDFMergerUtility();
> merger.addSource(pdfInputStream);
> ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
> merger.setDestinationStream(outputStream);
> merger.mergeDocuments(MemoryUsageSetting.setupMainMemoryOnly());
>  
> PDF file attached.
> Stack Trace:
> java.io.IOException: java.util.zip.DataFormatException: invalid distance too far back
>  at org.apache.pdfbox.filter.FlateFilter.decode(FlateFilter.java:83)
>  at org.apache.pdfbox.filter.Filter.decode(Filter.java:87)
>  at org.apache.pdfbox.cos.COSInputStream.create(COSInputStream.java:77)
>  at org.apache.pdfbox.cos.COSStream.createInputStream(COSStream.java:175)
>  at org.apache.pdfbox.cos.COSStream.createInputStream(COSStream.java:163)
>  at org.apache.pdfbox.multipdf.PDFMergerUtility.appendDocument(PDFMergerUtility.java:516)
>  at org.apache.pdfbox.multipdf.PDFMergerUtility.mergeDocuments(PDFMergerUtility.java:263)
>  ...
>  Caused by: java.util.zip.DataFormatException: invalid distance too far back
>  at java.util.zip.Inflater.inflateBytes(Native Method)
>  at java.util.zip.Inflater.inflate(Inflater.java:259)
>  at java.util.zip.Inflater.inflate(Inflater.java:280)
>  at org.apache.pdfbox.filter.FlateFilter.decompress(FlateFilter.java:108)
>  at org.apache.pdfbox.filter.FlateFilter.decode(FlateFilter.java:74)
>  ... 35 more



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org


Mime
View raw message