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

Tilman Hausherr commented on PDFBOX-6060:
-----------------------------------------

How about not changing the ordering?

> Allow use of 12 monkeys in DCTFilter
> ------------------------------------
>
>                 Key: PDFBOX-6060
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-6060
>             Project: PDFBox
>          Issue Type: Bug
>            Reporter: Simon Steiner
>            Priority: Major
>
> DCTFilter calls findRasterReader and returns the first reader, on error it 
> should try the 2nd reader as JDK cant read all jpegs
> {code:java}
>  public final DecodeResult decode(InputStream encoded, OutputStream decoded,
>                                          COSDictionary parameters, int index) 
> throws IOException {
>         Iterator<ImageReader> readers = 
> ImageIO.getImageReadersByFormatName("JPEG");
>         ImageInputStream iis = ImageIO.createImageInputStream(encoded);
>         iis.mark();
>         try {
>             while (readers.hasNext()) {
>                 ImageReader reader = readers.next();
>                 if (reader.canReadRaster()) {
>                     try {
>                         reader.setInput(iis);
>                         //...
>                     } catch (Exception e) {
>                         LOG.warn(e);
>                         iis.reset();
>                         continue;
>                     } finally {
>                         reader.dispose();
>                     }
>                     return new DecodeResult(parameters);
>                 }
>             }
>         } finally {
>             iis.close();
>         }
>         throw new MissingImageReaderException("Cannot read JPEG image: a 
> suitable JAI I/O image filter is not installed");
>     }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org

Reply via email to