You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Isabelle Giguere (JIRA)" <ji...@apache.org> on 2018/06/08 21:07:00 UTC

[jira] [Commented] (PDFBOX-3750) java.util.zip.DataFormatException when parsing a PDF

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

Isabelle Giguere commented on PDFBOX-3750:
------------------------------------------

Hi;

I realize this is closed, but the issue was reproduced using Tika 1.17 + PDF Box 2.0.8, and also using Tika 1.18 + PDF Box 2.0.9

I'm attaching a PDF to reproduce the issue.

> java.util.zip.DataFormatException when parsing a PDF
> ----------------------------------------------------
>
>                 Key: PDFBOX-3750
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3750
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 2.0.3
>         Environment: java version "1.8.0_121"
> Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
> Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
> org.apache.tika:tika-parsers:1.14
>            Reporter: Moritz Becker
>            Assignee: Tilman Hausherr
>            Priority: Major
>             Fix For: 2.0.6, 3.0.0 PDFBox
>
>         Attachments: PDFBOX-3750-badToUnicode.pdf
>
>
> I use the following code to parse a PDF:
> {code:java}
> PDFParser pdfparser = new PDFParser();
>         pdfparser.parse(Test.class.getResourceAsStream("/testdoc.pdf"), handler, metadata, pcontext);
> {code}
> This results in the following exception:
> {noformat}
> Exception in thread "main" org.apache.tika.exception.TikaException: Unable to extract PDF content
> 	at org.apache.tika.parser.pdf.PDF2XHTML.process(PDF2XHTML.java:133)
> 	at org.apache.tika.parser.pdf.PDFParser.parse(PDFParser.java:150)
> 	at com.curecomp.tika.Test.main(Test.java:28)
> Caused by: java.io.IOException: java.util.zip.DataFormatException: too many length or distance symbols
> 	at org.apache.pdfbox.filter.FlateFilter.decode(FlateFilter.java:82)
> 	at org.apache.pdfbox.cos.COSInputStream.create(COSInputStream.java:69)
> 	at org.apache.pdfbox.cos.COSStream.createInputStream(COSStream.java:162)
> 	at org.apache.pdfbox.pdmodel.font.PDFont.readCMap(PDFont.java:189)
> 	at org.apache.pdfbox.pdmodel.font.PDFont.<init>(PDFont.java:134)
> 	at org.apache.pdfbox.pdmodel.font.PDSimpleFont.<init>(PDSimpleFont.java:84)
> 	at org.apache.pdfbox.pdmodel.font.PDTrueTypeFont.<init>(PDTrueTypeFont.java:164)
> 	at org.apache.pdfbox.pdmodel.font.PDFontFactory.createFont(PDFontFactory.java:75)
> 	at org.apache.pdfbox.pdmodel.PDResources.getFont(PDResources.java:143)
> 	at org.apache.pdfbox.contentstream.operator.text.SetFontAndSize.process(SetFontAndSize.java:60)
> 	at org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:815)
> 	at org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:472)
> 	at org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:446)
> 	at org.apache.pdfbox.contentstream.PDFStreamEngine.processPage(PDFStreamEngine.java:149)
> 	at org.apache.pdfbox.text.LegacyPDFStreamEngine.processPage(LegacyPDFStreamEngine.java:139)
> 	at org.apache.pdfbox.text.PDFTextStripper.processPage(PDFTextStripper.java:391)
> 	at org.apache.tika.parser.pdf.PDF2XHTML.processPage(PDF2XHTML.java:141)
> 	at org.apache.pdfbox.text.PDFTextStripper.processPages(PDFTextStripper.java:319)
> 	at org.apache.pdfbox.text.PDFTextStripper.writeText(PDFTextStripper.java:266)
> 	at org.apache.tika.parser.pdf.PDF2XHTML.process(PDF2XHTML.java:111)
> 	... 2 more
> Caused by: java.util.zip.DataFormatException: too many length or distance symbols
> 	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:107)
> 	at org.apache.pdfbox.filter.FlateFilter.decode(FlateFilter.java:73)
> 	... 21 more
> {noformat}
> The PDF can be read using Adobe Reader XI 11.0.12.



--
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