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

Tilman Hausherr commented on PDFBOX-1963:
-----------------------------------------

Looking back, I realize that the "test" I had wasn't worth the name, because it 
didn't test whether the file written did have the correct compression.

I wrote a test this weekend, however, that test needs JAI. We can't distribute 
JAI. But we could use it for test scope only.

My proposed change would alter the code at three places:

1) in TestImageIOUtils
{code}
            // testing TIFF
            imageType = "tif";
            writeImage(document, imageType, outDir + file.getName() + "-bw-", 
ImageType.BINARY, dpi);
            String tiffCompression = getTiffCompression(outDir + file.getName() 
+ "-bw-1.tif");
            assertEquals("CCITT T.6", tiffCompression);
            writeImage(document, imageType, outDir + file.getName() + "-co-", 
ImageType.RGB, dpi);
BufferedImage.TYPE_INT_RGB, resolution);
            tiffCompression = getTiffCompression(outDir + file.getName() + 
"-co-1.tif");
            assertEquals("LZW", tiffCompression);
{code}

2)
I'm not including the code for getTiffCompression(), it simply returns the 
compression by reading the meta data XML object, e.g "LZW" or "CCITT T.6".

3) in the pdfbox pom.xml:
{code}
        <dependency>
            <groupId>javax.media</groupId>
            <artifactId>jai_imageio</artifactId>
            <version>1.1</version>
            <scope>test</scope>
        </dependency>        
...
        <repository>
            <id>osgeo</id>
            <name>Open Source Geospatial Foundation Repository</name>
            <url>http://download.osgeo.org/webdav/geotools/</url>
        </repository>  
{code}


> PDFImageWriter doesn't make use of PDFStreamEngine
> --------------------------------------------------
>
>                 Key: PDFBOX-1963
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1963
>             Project: PDFBox
>          Issue Type: Improvement
>          Components: Utilities
>    Affects Versions: 2.0.0
>            Reporter: John Hewson
>            Assignee: John Hewson
>             Fix For: 2.0.0
>
>
> PDFImageWriter is a subclass of PDFStreamEngine, however it never uses any of 
> its functionality, the writeImage methods could be marked as static and 
> behave in the same manner.
> The relationship between PDFImageWriter, RenderUtil, and ImageIOUtil no 
> longer matches its historical origins and needs to be refactored.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to