I'm rendering PDF pages on iPhone using the code below. It works, but the margins seem much wider than when I view the same PDF using a Acrobat Reader or the Mac's Preview, and that consequently scales the content down much smaller than it otherwise would be. Is my code actually causing this behavior?
In regards to the bounds below, I verified the bounds being used by the code are basically the height and width of the entire screen area, less the status bar.
CGContextSetStrokeColorWithColor(context, backgroundColor.CGColor);
CGContextSetFillColorWithColor(context,backgroundColor.CGColor);
CGContextSetLineWidth(context, 2.0);
CGContextAddRect(context, CGRectMake(0.0,0.0, self.bounds.size.width, self.bounds.size.height));
CGContextDrawPath(context, kCGPathFillStroke);
CGContextTranslateCTM(context, 0.0, self.bounds.size.height);
CGContextScaleCTM(context, 1.0, -1.0);
CGPDFPageRef page = CGPDFDocumentGetPage(myPDF, (size_t) pageNum);
CGContextSaveGState(context);
CGAffineTransform pdfTransform = CGPDFPageGetDrawingTransform(page, kCGPDFMediaBox, self.bounds, 0, true);
CGContextConcatCTM(context, pdfTransform);
CGContextDrawPDFPage(context, page);
CGContextRestoreGState(context);