Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Duplicate
-
2.0.21
-
None
-
None
-
None
-
JDK11
Description
An IllegalArgumentException (runtime exception) is thrown in the getImage() method of PDImageXObject. The method declares to throw IOException, which is fine, but I do not know how to prevent it to throw the IllegalArgumentException. Only happens for some PDFs, one that is affected is attached.
Here is the code that provokes the exception:
public static void main(String[] args) { try { PDDocument document = PDDocument.load(new File("Phaeton.pdf")); // see attachment for an affected file PDResources pdRes = document.getPages().get(0).getResources(); for (COSName name : pdRes.getXObjectNames()) { PDXObject o = pdRes.getXObject(name); if (o instanceof PDImageXObject) { PDImageXObject img = (PDImageXObject) o; img.getImage(); // This throws an java.lang.IllegalArgumentException (runtime exception) - bug in PDFBOX??? } } } catch(IOException e) { System.out.println("IOException thrown..."); // do something here } }
Attachments
Attachments
Issue Links
- duplicates
-
PDFBOX-4221 Numbers of source Raster bands and source color space components do not match
- Closed
-
PDFBOX-4258 Numbers of source Raster bands and source color space components do not match
- Closed