Question

EDIT The pdf files I have been using apparently are on "indesign" format (whatever that means) and therefore have no colour profile, does anyone knows how can I add the profile myself if is possible at all? End of edit

thanks in advance for any hand that any one can lend on this problem.

First of all let me tell you that I am kind of new at developing for IOS, I am trying to make a pdf reader using quartz on xcode, everything works fine except for the rendering of the images, for some reason the color space is completely messed up. please take a look at this example.

This is the image that I am getting on my IOS device:

Image with wrong colorspace

And this is how it suppose to look:

enter image description here

as a reference the part of the code that is drawing the pdf page is the following:

- (void)drawLayer:(CATiledLayer *)layer inContext:(CGContextRef)context
{

ReaderContentPage *readerContentPage = self; // Retain self

CGContextSetRGBFillColor(context, 1.0f, 1.0f, 1.0f, 1.0f); // White

CGContextFillRect(context, CGContextGetClipBoundingBox(context)); // Fill

CGContextTranslateCTM(context, 0.0f, self.bounds.size.height); CGContextScaleCTM(context, 1.0f, -1.0f);

CGContextConcatCTM(context, CGPDFPageGetDrawingTransform(_PDFPageRef, kCGPDFCropBox, self.bounds, 0, true));

//CGContextSetRenderingIntent(context, kCGRenderingIntentDefault); CGContextSetInterpolationQuality(context, kCGInterpolationDefault);

CGContextDrawPDFPage(context, _PDFPageRef); // Render the PDF page into the context

if (readerContentPage != nil) readerContentPage = nil; // Release self
}

Please if anyone could help me with this problem.

David

Was it helpful?

Solution

As noted on my question the problem is caused by the lack of colour space on the pdf source file, on the android version of this application I am using a very good library call MUPDF that is also available for ios but unfortunately in my case the this version is slower than using the quartz framework.

As for this I had to export the pdf source using either rbg or cmyk colour space.

If However someone knows how to add the colour space within the application I would be very happy to know it

OTHER TIPS

I've had tremendous troubles with this. And I finally figured it out.

  1. Apple uses sRGB for iOS. To do this you must save your pdf (convert to) in sRGB. I do this with Illustrator -> new -> profile = "web", color space = "RGB" -> save as PDF -> (in options) convert to sRGB.

  2. CAUTION! When you copy past paths over to the new artboard in RGB, the RGB values may have been changed by Illustrator. This took me ages to figure out... Even though the saving to PDF part was right, Illustrator broke it by changing the values by default, making everything darker and more dull.

Hope this helps!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top