I have a japanese PDF document that I'm trying to render correctly on the iPad.
I'm using the following code:
CFURLRef pdfURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, (CFStringRef)pdfFilename, kCFURLPOSIXPathStyle, false);
CGPDFDocumentRef pdfRef = CGPDFDocumentCreateWithURL((CFURLRef)pdfURL);
CFRelease(pdfURL);
CGPDFPageRef pdfPage = CGPDFDocumentGetPage(pdfRef, page);
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGContextRef context = CGBitmapContextCreate(NULL,
pdfPageSize.size.width*pdfScale,
pdfPageSize.size.height*pdfScale,
8,
(int)pdfPageSize.size.width*pdfScale * 4,
colorSpace,
kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big);
CGColorSpaceRelease(colorSpace);
CGPDFPageRetain(pdfPage);
CGAffineTransform transform = aspectFit(CGPDFPageGetBoxRect(pdfPage, kCGPDFBleedBox),
CGContextGetClipBoundingBox(context));
CGContextConcatCTM(context, transform);
CGContextDrawPDFPage(context, pdfPage);
CGPDFPageRelease (pdfPage);
CGImageRef image = CGBitmapContextCreateImage(context);
CGContextRelease(context);
The japanese characters are not showing correctly (i.e. boxes instead of the character). I am not aware of any character set parameter which could configure the pdf handling.
Does anybody know how to correctly handle foreign characters?
Thank you all in advance!