[
https://issues.apache.org/jira/browse/PDFBOX-5036?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andreas Gerstinger updated PDFBOX-5036:
---------------------------------------
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:
{noformat}
public static void main(String[] args) {
try {
PDDocument document = PDDocument.load(new File("Phaeton.pdf"));
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...");
}
}
{noformat}
was:
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:
{noformat}
public static void main(String[] args) {
try {
PDDocument document = PDDocument.load(new File("Phaeton.pdf"));
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...");
}
}
{noformat}
> IllegalArgumentException in PDImageXObject.getImage()
> -----------------------------------------------------
>
> Key: PDFBOX-5036
> URL: https://issues.apache.org/jira/browse/PDFBOX-5036
> Project: PDFBox
> Issue Type: Bug
> Affects Versions: 2.0.21
> Environment: JDK11
> Reporter: Andreas Gerstinger
> Priority: Major
> Attachments: Phaeton.pdf
>
>
> 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:
> {noformat}
> public static void main(String[] args) {
> try {
> PDDocument document = PDDocument.load(new File("Phaeton.pdf"));
> 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...");
> }
> }
> {noformat}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]