You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (JIRA)" <ji...@apache.org> on 2014/09/07 12:14:28 UTC

[jira] [Comment Edited] (PDFBOX-2320) IOException: Could not read embedded TTF for font TimesNewRoman

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

Tilman Hausherr edited comment on PDFBOX-2320 at 9/7/14 10:13 AM:
------------------------------------------------------------------

A stream is incorrectly read in readUntilEndStream(), a byte is missing. I checked whether my "EndstreamOutputStream" is the cause by temporary removing it, but it isn't. readUntilEndStream() is different in BaseParser and in NonSequentialParser. We can assume that the one in BaseParser is the correct one, because 1. it handles this file (we must increase the pushbackbuffer), 2. there should be been complaints before because that part is used a lot in the old parser.

A modified version of readUntilEndStream() was entered in 2013 in rev 1465366 by [~lehmi]. The one in Baseparser is unchanged since 2011 except for some formatting changes. So lets just use the one from BaseParser so that we don't have code twice.

I'm doing the change only for 2.0 for now, I'll do it for 1.8.* after the upcoming release.


was (Author: tilman):
A stream is incorrectly read in readUntilEndStream(), a byte is missing. I checked whether my "EndstreamOutputStream" is the cause by temporary removing it, but it isn't. readUntilEndStream() is different in BaseParser and in NonSequentialParser. We can assume that the one in BaseParser is the correct one, because 1. it handles this file, 2. there should be been complaints before.

A modified version of readUntilEndStream() was entered in rev 1465366 by [~lehmi]. The one in Baseparser is unchanged since 2011 except for some formatting changes. So lets just use the one from BaseParser so that we don't have code twice.

I'm doing the change only for 2.0 for now, I'll do it for 1.8.* after the upcoming release.

> IOException: Could not read embedded TTF for font TimesNewRoman
> ---------------------------------------------------------------
>
>                 Key: PDFBOX-2320
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2320
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Parsing
>    Affects Versions: 2.0.0
>            Reporter: simon steiner
>
> http://svn.apache.org/viewvc/incubator/pdfbox/trunk/test/input/TEST_SetCharSpacing_Error.pdf?revision=682412&view=co&pathrev=793348
> java -jar ~/pdf-box-svn/app/target/pdfbox-app-2.0.0-SNAPSHOT.jar PDFToImage -nonSeq TEST_SetCharSpacing_Error.pdf
> {code}
> Sep 5, 2014 10:56:40 AM org.apache.pdfbox.pdfparser.NonSequentialPDFParser validateStreamLength
> SEVERE: The end of the stream doesn't point to the correct offset, using workaround to read the stream
> Sep 5, 2014 10:56:40 AM org.apache.pdfbox.pdfparser.NonSequentialPDFParser validateStreamLength
> SEVERE: The end of the stream doesn't point to the correct offset, using workaround to read the stream
> Sep 5, 2014 10:56:40 AM org.apache.pdfbox.filter.FlateFilter decode
> SEVERE: FlateFilter: stop reading corrupt stream due to a DataFormatException
> Sep 5, 2014 10:56:40 AM org.apache.pdfbox.filter.FlateFilter decode
> SEVERE: FlateFilter: stop reading corrupt stream due to a DataFormatException
> Sep 5, 2014 10:56:40 AM org.apache.pdfbox.filter.FlateFilter decode
> SEVERE: FlateFilter: stop reading corrupt stream due to a DataFormatException
> Sep 5, 2014 10:56:40 AM org.apache.pdfbox.filter.FlateFilter decode
> SEVERE: FlateFilter: stop reading corrupt stream due to a DataFormatException
> Sep 5, 2014 10:56:40 AM org.apache.pdfbox.filter.FlateFilter decode
> SEVERE: FlateFilter: stop reading corrupt stream due to a DataFormatException
> Sep 5, 2014 10:56:40 AM org.apache.pdfbox.filter.FlateFilter decode
> SEVERE: FlateFilter: stop reading corrupt stream due to a DataFormatException
> Sep 5, 2014 10:56:40 AM org.apache.pdfbox.filter.FlateFilter decode
> SEVERE: FlateFilter: stop reading corrupt stream due to a DataFormatException
> Sep 5, 2014 10:56:40 AM org.apache.pdfbox.filter.FlateFilter decode
> SEVERE: FlateFilter: stop reading corrupt stream due to a DataFormatException
> Sep 5, 2014 10:56:40 AM org.apache.pdfbox.filter.FlateFilter decode
> SEVERE: FlateFilter: stop reading corrupt stream due to a DataFormatException
> Sep 5, 2014 10:56:40 AM org.apache.pdfbox.filter.FlateFilter decode
> SEVERE: FlateFilter: stop reading corrupt stream due to a DataFormatException
> Exception in thread "main" java.io.IOException: Could not read embedded TTF for font TimesNewRoman
> 	at org.apache.pdfbox.pdmodel.font.PDTrueTypeFont.<init>(PDTrueTypeFont.java:116)
> 	at org.apache.pdfbox.pdmodel.font.PDFontFactory.createFont(PDFontFactory.java:73)
> 	at org.apache.pdfbox.pdmodel.PDResources.getFonts(PDResources.java:171)
> 	at org.apache.pdfbox.util.PDFStreamEngine.getFonts(PDFStreamEngine.java:543)
> 	at org.apache.pdfbox.util.operator.text.SetTextFont.process(SetTextFont.java:48)
> 	at org.apache.pdfbox.util.PDFStreamEngine.processOperator(PDFStreamEngine.java:510)
> 	at org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:275)
> 	at org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:240)
> 	at org.apache.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:194)
> 	at org.apache.pdfbox.rendering.PageDrawer.drawPage(PageDrawer.java:176)
> 	at org.apache.pdfbox.rendering.PDFRenderer.renderPage(PDFRenderer.java:228)
> 	at org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:160)
> 	at org.apache.pdfbox.rendering.PDFRenderer.renderImageWithDPI(PDFRenderer.java:109)
> 	at org.apache.pdfbox.tools.PDFToImage.main(PDFToImage.java:265)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
> Caused by: java.io.IOException: java.util.zip.DataFormatException: invalid block type
> 	at org.apache.pdfbox.filter.FlateFilter.decode(FlateFilter.java:83)
> 	at org.apache.pdfbox.cos.COSStream.doDecode(COSStream.java:365)
> 	at org.apache.pdfbox.cos.COSStream.doDecode(COSStream.java:286)
> 	at org.apache.pdfbox.cos.COSStream.getUnfilteredStream(COSStream.java:189)
> 	at org.apache.pdfbox.pdmodel.common.PDStream.createInputStream(PDStream.java:232)
> 	at org.apache.pdfbox.pdmodel.font.PDTrueTypeFont.<init>(PDTrueTypeFont.java:108)
> 	... 18 more
> Caused by: java.util.zip.DataFormatException: invalid block type
> 	at java.util.zip.Inflater.inflateBytes(Native Method)
> 	at java.util.zip.Inflater.inflate(Inflater.java:238)
> 	at java.util.zip.Inflater.inflate(Inflater.java:256)
> 	at org.apache.pdfbox.filter.FlateFilter.decompress(FlateFilter.java:101)
> 	at org.apache.pdfbox.filter.FlateFilter.decode(FlateFilter.java:74)
> 	... 23 more
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)