[ 
https://issues.apache.org/jira/browse/PDFBOX-1190?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andreas Lehmkühler resolved PDFBOX-1190.
----------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.7.0
         Assignee: Andreas Lehmkühler

The compression type might get lost when setting the compression mode to 
MODE_EXPLICIT. There was another problem when adding the resolution to the 
metadata. 

I fixed that in revision 1220438.

I also added a unit test using PNG, JPG, BMP and WBMP as target format. GIF 
isn't supported as JDK 5 doesn't provide write support for it.

Thanks for the report!
                
> 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
>            Assignee: Andreas Lehmkühler
>            Priority: Minor
>             Fix For: 1.7.0
>
>
> 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