Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
PDF Rendering white background
- (NSData *)PDFDataForMultiPageDocument {
NSMutableData *data = [NSMutableData data];
CGDataConsumerRef consumer = CGDataConsumerCreateWithCFData((CFMutableDataRef)data);
if (NULL == consumer) {
NSLog(@"could not create consumer");
return nil;
}
CGRect r = CGRectMake(0.0, 0.0, 800.0, 600.0);;
CGContextRef ctx = CGPDFContextCreate(consumer, &r, NULL);
CFRelease(consumer);
NSGraphicsContext *gc = [NSGraphicsContext graphicsContextWithGraphicsPort:ctx flipped:NO];
CGContextBeginPage(ctx, &r);
CGContextSaveGState(ctx);
// CGContextClearRect(ctx, r);
const CGFloat clearColor[] = {1.0, 1.0, 0.0, 1.0};
CGContextSetFillColor(ctx, clearColor);
CGContextFillRect(ctx, CGRectMake(10.0, 10.0, 50.0, 50.0));
CGContextSetStrokeColor(ctx, clearColor);
CGContextStrokeEllipseInRect(ctx, r);
CGContextRestoreGState(ctx);
CGContextEndPage(ctx);
CGPDFContextClose(ctx);
CGContextRelease(ctx);
return data;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.