Skip navigation.
 
mlScaling CGPDFPageRefs
FROM : Maryanna Rogers
DATE : Thu Jan 24 17:15:31 2008

Hi,

I'm trying to load a pdf file, scale some portion of it (zoom in, for
example), and draw this scaled result to a CGBitmapContext.

I've tried things like the following, with no luck:

CGPDFPageRef page = CGPDFDocumentGetPage(doc, 1);
CGAffineTransform m = CGPDFPageGetDrawingTransform (page,
kCGPDFMediaBox, CGRectMake(0, 0, 50, 50), 0, true);
CGContextConcatCTM (myPDFContext, m);
CGContextClipToRect (myPDFContext, CGRectMake(0, 0, 4, 4));

CGContextDrawPDFPage(myBitmapContext, page);

I'm not comfortable with the transformations I've done here, but it's
all I've been able to find in the Apple documentation.

Again, what I would like to do, is have an existing bitmap context of
a given size (128 x 128, for example), and draw scaled subregions of a
given PDF document page into that bitmap context. Is there a simple
way to do this?

Thanks!

~m

Related mailsAuthorDate
mlScaling CGPDFPageRefs Maryanna Rogers Jan 24, 17:15
mlRe: Scaling CGPDFPageRefs David Duncan Jan 24, 18:48
mlRe: Scaling CGPDFPageRefs John Calhoun Jan 24, 23:47
mlRe: Scaling CGPDFPageRefs David Duncan Jan 25, 00:40