Gamut / Color space problems when using CGContextDrawPDFPage

余生颓废 提交于 2019-12-24 06:45:18

问题


I'm rendering a PDF file on iPad using core graphics.

The colors however look different to the PDF when opening it using OS X preview or acrobat.

Here is a picture with the left being from Acrobat, the right being in iOS simulator:

Does anyone have an idea what I could be doing wrong? I'm not doing anything fancy with my graphics context, except translation/scaling, clipping and then calling CGContextDrawPDFPage

(So far I have only tried on the iOS simulator. )


回答1:


You need to use RGB profile, not CMYK profile.

You can transform your PDF with a Quartz Filter. It will integrate a new color profile in your document, like "Apple RGB".




回答2:


This is an old thread, but the problem still persists as of iOS 9.3.2.

Fixing that does not seem to be a priority at Apple. And I can't blame them - they have bigger issues to solve. We reported this bug a few years back and switched to our own rendering engine in the commercial PSPDFKit SDK on both iOS and Android. (Disclaimer: I work there)

The color transform is the only known workaround but requires Adobe Acrobat and manual steps to change. We figured that this is not something that we can burden our customers with so we ultimately replaced Apple's rendering engine - having full control also allowed us to make things both faster and more stable. We have a document that provides some resources on how to get started writing a custom renderer.

Please also report a radar at radar.apple.com - this is something that eventually should be fixed, and Apple priorities feature requests based on the number of requests. Then again, there are still many open crashers and bugs like missing text that we still have open from the time where we still used CGPDF, so I assume these will have a higher priority.

This support document from Adobe outlines how you can convert the colors: https://helpx.adobe.com/acrobat/using/color-conversion-ink-management-acrobat.html



来源:https://stackoverflow.com/questions/8482994/gamut-color-space-problems-when-using-cgcontextdrawpdfpage

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