[ https://issues.apache.org/jira/browse/PDFBOX-3003?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14947156#comment-14947156 ]
Tilman Hausherr edited comment on PDFBOX-3003 at 10/7/15 7:14 PM: ------------------------------------------------------------------ My changes break preflight (can be seen with digitalcorpora file 453184.pdf, p24). There's a bug in the use of ColorSpaces.valueOf(). Colorspaces is an enum type: {code} public enum ColorSpaces { Lab("Lab"), CalRGB("CalRGB"), CalGray("CalGray"), DeviceN("DeviceN"), Indexed("Indexed"), Indexed_SHORT("I"), Pattern( "Pattern"), ICCBased("ICCBased"), DeviceRGB("DeviceRGB"), DeviceRGB_SHORT("RGB"), DeviceGray("DeviceGray"), DeviceGray_SHORT( "G"), DeviceCMYK("DeviceCMYK"), DeviceCMYK_SHORT("CMYK"), Separation("Separation"); {code} However the string parameter of valueOf "must match exactly an identifier used to declare an enum constant in this type". I.e. "CMYK" cannot work (but "DeviceCMYK_SHORT" would). This has worked until now because further code worked as if this was a resource color name, which worked because the short names were accepted by PDColorSpace.create(). Solution: rename the enum elements. was (Author: tilman): My changes break preflight. There's a bug in the use of ColorSpaces.valueOf(). Colorspaces is an enum type: {code} public enum ColorSpaces { Lab("Lab"), CalRGB("CalRGB"), CalGray("CalGray"), DeviceN("DeviceN"), Indexed("Indexed"), Indexed_SHORT("I"), Pattern( "Pattern"), ICCBased("ICCBased"), DeviceRGB("DeviceRGB"), DeviceRGB_SHORT("RGB"), DeviceGray("DeviceGray"), DeviceGray_SHORT( "G"), DeviceCMYK("DeviceCMYK"), DeviceCMYK_SHORT("CMYK"), Separation("Separation"); {code} However the string parameter of valueOf "must match exactly an identifier used to declare an enum constant in this type". I.e. "CMYK" cannot work (but "DeviceCMYK_SHORT" would). This has worked until now because further code worked as if this was a resource color name, which worked because the short names were accepted by PDColorSpace.create(). Solution: rename the enum elements. > Incorrect color space processing for inline images > -------------------------------------------------- > > Key: PDFBOX-3003 > URL: https://issues.apache.org/jira/browse/PDFBOX-3003 > Project: PDFBox > Issue Type: Bug > Components: PDModel > Affects Versions: 2.0.0 > Reporter: Evgeniy Muravitskiy > Assignee: Tilman Hausherr > Fix For: 2.0.0 > > Attachments: ColorSpaceInlineImage.patch > > > Getting wrong color space for inline images because of abbreviations. (PDF > Reference 1.4, chapter 4.8.6). > According to specification inline images can use directly (not by names) only > 4 color spaces: DeviceGray (Gray), DeviceCMYK (CMYK), DeviceRGB (RGB), > Indexed (I). -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org