1
을 렌더링 할 수 없습니다 :있는 CoreGraphics : 나는 테스트로 다음 코드를 사용하여 PDF 파일을 렌더링하고있어 컬러 PDF
#import <Foundation/Foundation.h>
#import <CoreGraphics/CoreGraphics.h>
int main(int argc, const char * argv[]) {
@autoreleasepool {
NSURL* theFile = [NSURL fileURLWithPath:@"test.pdf"];
CGContextRef pdfContext = CGPDFContextCreateWithURL((CFURLRef) theFile, nil, nil);
CGColorSpaceRef rgb = CGColorSpaceCreateDeviceRGB();
assert(CGColorSpaceGetNumberOfComponents(rgb) == 3);
CGContextSetFillColorSpace(pdfContext,rgb);
CGContextSetStrokeColorSpace(pdfContext, rgb);
CGColorSpaceRelease(rgb);
CGPDFContextBeginPage(pdfContext, nil);
CGFloat rgba[4] = {0.0,1.0,1.0,1.0};
CGContextSetFillColor(pdfContext, rgba);
CGContextFillRect(pdfContext, CGRectMake(100, 100, 100, 100));
CGPDFContextEndPage (pdfContext);
CGContextRelease (pdfContext);
}
return 0;
}
내가 상자가 시안 것으로 기대되지만 출력은 검은 색입니다.