You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Dominic Tubach (JIRA)" <ji...@apache.org> on 2014/08/18 11:17:22 UTC

[jira] [Created] (PDFBOX-2275) ClassCastException in PDResources

Dominic Tubach created PDFBOX-2275:
--------------------------------------

             Summary: ClassCastException in PDResources
                 Key: PDFBOX-2275
                 URL: https://issues.apache.org/jira/browse/PDFBOX-2275
             Project: PDFBox
          Issue Type: Bug
          Components: PDModel
    Affects Versions: 2.0.0
            Reporter: Dominic Tubach


The code
{code}
COSObject cosObject = (COSObject)dict.getItem(objName);
{code} in the method getXObjects() in PDResources fails with a ClassCastException:
bq. org.apache.pdfbox.cos.COSStream cannot be cast to org.apache.pdfbox.cos.COSObject

The document issuing this exception is created using the following code:
{code}
PDDocument doc = new PDDocument();	
PDPage page = new PDPage();
doc.addPage(page);
PDImageXObject image = JPEGFactory.createFromStream(doc, imageStream);
try (PDPageContentStream contentStream = new PDPageContentStream(doc, page, false, false)) {
    contentStream.drawImage(image, 20, 20);
}
{code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)