You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Andrew Duffy (JIRA)" <ji...@apache.org> on 2009/09/12 16:10:58 UTC

[jira] Created: (PDFBOX-528) Inlined images with a ColorSpace in the resource dictionary don't work

Inlined images with a ColorSpace in the resource dictionary don't work
----------------------------------------------------------------------

                 Key: PDFBOX-528
                 URL: https://issues.apache.org/jira/browse/PDFBOX-528
             Project: PDFBox
          Issue Type: Bug
          Components: PDModel
            Reporter: Andrew Duffy
            Priority: Minor
             Fix For: 0.8.0-incubator


The attached PDF when drawn outputs this to stderr:

java.io.IOException: Error: Unknown colorspace 'R12'
 	at org.apache.pdfbox.pdmodel.graphics.color.PDColorSpaceFactory.createColorSpace(PDColorSpaceFactory.java:158)
 	at org.apache.pdfbox.pdmodel.graphics.color.PDColorSpaceFactory.createColorSpace(PDColorSpaceFactory.java:62)
	at org.apache.pdfbox.util.ImageParameters.getColorSpace(ImageParameters.java:127)
 	at org.apache.pdfbox.pdmodel.graphics.xobject.PDInlinedImage.createImage(PDInlinedImage.java:121)
 	at org.apache.pdfbox.util.operator.pagedrawer.BeginInlineImage.process(BeginInlineImage.java:57)
 	at org.apache.pdfbox.util.PDFStreamEngine.processOperator(PDFStreamEngine.java:510)
 	at org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:223)
 	at org.apache.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:182)
 	at org.apache.pdfbox.pdfviewer.PageDrawer.drawPage(PageDrawer.java:92)
 	at org.apache.pdfbox.pdmodel.PDPage.convertToImage(PDPage.java:686)

This is because PDInlinedImage doesn't check for a colorspace in the page resources like SetStrokingColorSpace and SetNonStrokingColorSpace do.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (PDFBOX-528) Inlined images with a ColorSpace in the resource dictionary don't work

Posted by "Andrew Duffy (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PDFBOX-528?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrew Duffy updated PDFBOX-528:
--------------------------------

    Attachment: survey.pdf

> Inlined images with a ColorSpace in the resource dictionary don't work
> ----------------------------------------------------------------------
>
>                 Key: PDFBOX-528
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-528
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>            Reporter: Andrew Duffy
>            Priority: Minor
>             Fix For: 0.8.0-incubator
>
>         Attachments: survey.pdf
>
>
> The attached PDF when drawn outputs this to stderr:
> java.io.IOException: Error: Unknown colorspace 'R12'
>  	at org.apache.pdfbox.pdmodel.graphics.color.PDColorSpaceFactory.createColorSpace(PDColorSpaceFactory.java:158)
>  	at org.apache.pdfbox.pdmodel.graphics.color.PDColorSpaceFactory.createColorSpace(PDColorSpaceFactory.java:62)
> 	at org.apache.pdfbox.util.ImageParameters.getColorSpace(ImageParameters.java:127)
>  	at org.apache.pdfbox.pdmodel.graphics.xobject.PDInlinedImage.createImage(PDInlinedImage.java:121)
>  	at org.apache.pdfbox.util.operator.pagedrawer.BeginInlineImage.process(BeginInlineImage.java:57)
>  	at org.apache.pdfbox.util.PDFStreamEngine.processOperator(PDFStreamEngine.java:510)
>  	at org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:223)
>  	at org.apache.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:182)
>  	at org.apache.pdfbox.pdfviewer.PageDrawer.drawPage(PageDrawer.java:92)
>  	at org.apache.pdfbox.pdmodel.PDPage.convertToImage(PDPage.java:686)
> This is because PDInlinedImage doesn't check for a colorspace in the page resources like SetStrokingColorSpace and SetNonStrokingColorSpace do.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (PDFBOX-528) Inlined images with a ColorSpace in the resource dictionary don't work

Posted by "Daniel Wilson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PDFBOX-528?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12754549#action_12754549 ] 

Daniel Wilson commented on PDFBOX-528:
--------------------------------------

Error confirmed in pre-patch code.

In fact, that PDF is raising a BUNCH of errors.  For all those errors, it's not rendering all that badly ... but I'll test the patch in a few minutes.

> Inlined images with a ColorSpace in the resource dictionary don't work
> ----------------------------------------------------------------------
>
>                 Key: PDFBOX-528
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-528
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>            Reporter: Andrew Duffy
>            Priority: Minor
>             Fix For: 0.8.0-incubator
>
>         Attachments: namedColorSpace.patch, survey.pdf
>
>
> The attached PDF when drawn outputs this to stderr:
> java.io.IOException: Error: Unknown colorspace 'R12'
>  	at org.apache.pdfbox.pdmodel.graphics.color.PDColorSpaceFactory.createColorSpace(PDColorSpaceFactory.java:158)
>  	at org.apache.pdfbox.pdmodel.graphics.color.PDColorSpaceFactory.createColorSpace(PDColorSpaceFactory.java:62)
> 	at org.apache.pdfbox.util.ImageParameters.getColorSpace(ImageParameters.java:127)
>  	at org.apache.pdfbox.pdmodel.graphics.xobject.PDInlinedImage.createImage(PDInlinedImage.java:121)
>  	at org.apache.pdfbox.util.operator.pagedrawer.BeginInlineImage.process(BeginInlineImage.java:57)
>  	at org.apache.pdfbox.util.PDFStreamEngine.processOperator(PDFStreamEngine.java:510)
>  	at org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:223)
>  	at org.apache.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:182)
>  	at org.apache.pdfbox.pdfviewer.PageDrawer.drawPage(PageDrawer.java:92)
>  	at org.apache.pdfbox.pdmodel.PDPage.convertToImage(PDPage.java:686)
> This is because PDInlinedImage doesn't check for a colorspace in the page resources like SetStrokingColorSpace and SetNonStrokingColorSpace do.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (PDFBOX-528) Inlined images with a ColorSpace in the resource dictionary don't work

Posted by "Andrew Duffy (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PDFBOX-528?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrew Duffy updated PDFBOX-528:
--------------------------------

    Attachment: namedColorSpace.patch

The attached patch fixes this by adding a method to PDColorSpaceFactory that will create a colorspace with a look up in a supplied color space map at the correct point; altering PDInlinedImage, ImageParameters and BeginInlineImage to use the new method, and finally, altering SetNonStrokingColorSpace and SetStrokingColorSpace to use the new method

> Inlined images with a ColorSpace in the resource dictionary don't work
> ----------------------------------------------------------------------
>
>                 Key: PDFBOX-528
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-528
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>            Reporter: Andrew Duffy
>            Priority: Minor
>             Fix For: 0.8.0-incubator
>
>         Attachments: namedColorSpace.patch, survey.pdf
>
>
> The attached PDF when drawn outputs this to stderr:
> java.io.IOException: Error: Unknown colorspace 'R12'
>  	at org.apache.pdfbox.pdmodel.graphics.color.PDColorSpaceFactory.createColorSpace(PDColorSpaceFactory.java:158)
>  	at org.apache.pdfbox.pdmodel.graphics.color.PDColorSpaceFactory.createColorSpace(PDColorSpaceFactory.java:62)
> 	at org.apache.pdfbox.util.ImageParameters.getColorSpace(ImageParameters.java:127)
>  	at org.apache.pdfbox.pdmodel.graphics.xobject.PDInlinedImage.createImage(PDInlinedImage.java:121)
>  	at org.apache.pdfbox.util.operator.pagedrawer.BeginInlineImage.process(BeginInlineImage.java:57)
>  	at org.apache.pdfbox.util.PDFStreamEngine.processOperator(PDFStreamEngine.java:510)
>  	at org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:223)
>  	at org.apache.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:182)
>  	at org.apache.pdfbox.pdfviewer.PageDrawer.drawPage(PageDrawer.java:92)
>  	at org.apache.pdfbox.pdmodel.PDPage.convertToImage(PDPage.java:686)
> This is because PDInlinedImage doesn't check for a colorspace in the page resources like SetStrokingColorSpace and SetNonStrokingColorSpace do.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (PDFBOX-528) Inlined images with a ColorSpace in the resource dictionary don't work

Posted by "Daniel Wilson (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PDFBOX-528?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Wilson resolved PDFBOX-528.
----------------------------------

    Resolution: Fixed

Incorporated Andrew's patch

> Inlined images with a ColorSpace in the resource dictionary don't work
> ----------------------------------------------------------------------
>
>                 Key: PDFBOX-528
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-528
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>            Reporter: Andrew Duffy
>            Priority: Minor
>             Fix For: 0.8.0-incubator
>
>         Attachments: namedColorSpace.patch, survey.pdf
>
>
> The attached PDF when drawn outputs this to stderr:
> java.io.IOException: Error: Unknown colorspace 'R12'
>  	at org.apache.pdfbox.pdmodel.graphics.color.PDColorSpaceFactory.createColorSpace(PDColorSpaceFactory.java:158)
>  	at org.apache.pdfbox.pdmodel.graphics.color.PDColorSpaceFactory.createColorSpace(PDColorSpaceFactory.java:62)
> 	at org.apache.pdfbox.util.ImageParameters.getColorSpace(ImageParameters.java:127)
>  	at org.apache.pdfbox.pdmodel.graphics.xobject.PDInlinedImage.createImage(PDInlinedImage.java:121)
>  	at org.apache.pdfbox.util.operator.pagedrawer.BeginInlineImage.process(BeginInlineImage.java:57)
>  	at org.apache.pdfbox.util.PDFStreamEngine.processOperator(PDFStreamEngine.java:510)
>  	at org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:223)
>  	at org.apache.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:182)
>  	at org.apache.pdfbox.pdfviewer.PageDrawer.drawPage(PageDrawer.java:92)
>  	at org.apache.pdfbox.pdmodel.PDPage.convertToImage(PDPage.java:686)
> This is because PDInlinedImage doesn't check for a colorspace in the page resources like SetStrokingColorSpace and SetNonStrokingColorSpace do.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (PDFBOX-528) Inlined images with a ColorSpace in the resource dictionary don't work

Posted by "Daniel Wilson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PDFBOX-528?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12754562#action_12754562 ] 

Daniel Wilson commented on PDFBOX-528:
--------------------------------------

Your patch resolves the issue ... and doesn't break any other image test cases. I'll accept it into the code.

Thanks!

> Inlined images with a ColorSpace in the resource dictionary don't work
> ----------------------------------------------------------------------
>
>                 Key: PDFBOX-528
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-528
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>            Reporter: Andrew Duffy
>            Priority: Minor
>             Fix For: 0.8.0-incubator
>
>         Attachments: namedColorSpace.patch, survey.pdf
>
>
> The attached PDF when drawn outputs this to stderr:
> java.io.IOException: Error: Unknown colorspace 'R12'
>  	at org.apache.pdfbox.pdmodel.graphics.color.PDColorSpaceFactory.createColorSpace(PDColorSpaceFactory.java:158)
>  	at org.apache.pdfbox.pdmodel.graphics.color.PDColorSpaceFactory.createColorSpace(PDColorSpaceFactory.java:62)
> 	at org.apache.pdfbox.util.ImageParameters.getColorSpace(ImageParameters.java:127)
>  	at org.apache.pdfbox.pdmodel.graphics.xobject.PDInlinedImage.createImage(PDInlinedImage.java:121)
>  	at org.apache.pdfbox.util.operator.pagedrawer.BeginInlineImage.process(BeginInlineImage.java:57)
>  	at org.apache.pdfbox.util.PDFStreamEngine.processOperator(PDFStreamEngine.java:510)
>  	at org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:223)
>  	at org.apache.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:182)
>  	at org.apache.pdfbox.pdfviewer.PageDrawer.drawPage(PageDrawer.java:92)
>  	at org.apache.pdfbox.pdmodel.PDPage.convertToImage(PDPage.java:686)
> This is because PDInlinedImage doesn't check for a colorspace in the page resources like SetStrokingColorSpace and SetNonStrokingColorSpace do.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.