PdfBox - PDColorSpaceFactory.createColorSpace(document, iccColorSpace) throws nullpointerexception

旧城冷巷雨未停 提交于 2019-12-02 03:10:44

Ok, this seems to be a bug with the first constructor. You could use the second constructor, which uses a COSArray:

The PDF spec explains what to do:

"An ICCBased colour space shall be an array: [/ICCBased stream]"

So you need to create a COSArray, with COSName.ICCBASED as first element, and a COSStream with your ICC data in the second. Create a COSStream and write to it with createFilteredStream(). That COSArray you can use for the second constructor.

Alternatively, just use PDDeviceCMYK.INSTANCE as the colorspace :-)

Update: I have opened issue PDFBOX-2812 and it has been fixed. You can get a snapshot in a few hours here.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!