Attempting to render to BMP, WBMP or GIF causes IllegalStateException
---------------------------------------------------------------------

                 Key: PDFBOX-1190
                 URL: https://issues.apache.org/jira/browse/PDFBOX-1190
             Project: PDFBox
          Issue Type: Bug
          Components: Utilities
    Affects Versions: 1.6.0
         Environment: Win 7, Java 1.6
            Reporter: Lars Hougaard
            Priority: Minor


Attempting to render PDF to either BMP, WBMP or GIF causes 
IllegalStateException while rendering to JPG, JPEG or PNG works. All of these 
image formats are reported as being present and available via call: 
ImageIO.getWriterFormatNames()
The issue seems to be with this code in PDFImageWriter
                       if( writerParams.canWriteCompressed() )
                        {
                            
writerParams.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
                            writerParams.setCompressionQuality(1.0f);    // <== 
Exception here
                        }
 where a call to setCompressionType should precede setCompressionQuality for 
the failing image types listed above.

[looks like JUnit test cases only tests PNG ....]

Start of stack trace is this:
java.lang.IllegalStateException: No compression type set!
        at 
javax.imageio.ImageWriteParam.setCompressionQuality(ImageWriteParam.java:1230)
        at 
org.apache.pdfbox.util.PDFImageWriter.writeImage(PDFImageWriter.java:151)
                ......


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to