Author: tilman Date: Fri Mar 28 15:58:24 2014 New Revision: 1582785 URL: http://svn.apache.org/r1582785 Log: PDFBOX-457: ignore /Length value, not used by any other filter, and is wrong if this filter is not the first
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/CCITTFaxFilter.java Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/CCITTFaxFilter.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/CCITTFaxFilter.java?rev=1582785&r1=1582784&r2=1582785&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/CCITTFaxFilter.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/CCITTFaxFilter.java Fri Mar 28 15:58:24 2014 @@ -53,27 +53,6 @@ final class CCITTFaxFilter extends Filte COSDictionary decodeParms = (COSDictionary) parameters.getDictionaryObject(COSName.DECODE_PARMS, COSName.DP); - // get compressed data - int length = parameters.getInt(COSName.LENGTH, -1); - byte[] compressed; - if (length != -1) - { - compressed = new byte[length]; - long written = IOUtils.populateBuffer(encoded, compressed); - if (written != compressed.length) - { - log.warn("Buffer for compressed data did not match the length" - + " of the actual compressed data"); - } - } - else - { - // inline images don't provide the length of the stream so that - // we have to read until the end of the stream to find out the length - // the streams inline images are stored in are mostly small ones - compressed = IOUtils.toByteArray(encoded); - } - // parse dimensions int cols = decodeParms.getInt(COSName.COLUMNS, 1728); int rows = decodeParms.getInt(COSName.ROWS, 0); @@ -96,6 +75,7 @@ final class CCITTFaxFilter extends Filte TIFFFaxDecoder faxDecoder = new TIFFFaxDecoder(1, cols, rows); // TODO possible options?? long tiffOptions = 0; + byte[] compressed = IOUtils.toByteArray(encoded); byte[] decompressed = null; if (k == 0) {