I want to display PDF file in iPad using CATiled Layer
All is well but when i use CATiledLayer in my app and run it , PDF file will display like this shown in image
Here is my Code
For CATiled layer
tiledLayer = [CATiledLayer layer];
tiledLayer.delegate = self;
//Set load block of tiled layer
tiledLayer.tileSize = CGSizeMake(1024.0, 1024.0);
tiledLayer.levelsOfDetail = 1000;
tiledLayer.levelsOfDetailBias = 1000;
For drawInContext
CGContextSetRGBFillColor(ctx, 1.0, 1.0, 1.0, 1.0);
CGContextFillRect(ctx, CGContextGetClipBoundingBox(ctx));
CGContextTranslateCTM(ctx, 0.0, layer.bounds.size.height);
CGContextScaleCTM(ctx, 1.0, -1.0);
CGContextConcatCTM(ctx, CGPDFPageGetDrawingTransform(myPageRef, kCGPDFCropBox, layer.bounds, 0, true));
CGContextDrawPDFPage(ctx, myPageRef);
Please help me to solve this problem.Thank u in advance.
CGPDFPageGetDrawingTransform does not scale your pdf up – you need to write your own transform code to calculate the best aspect ratio for the pdf.
Note that CGPDFPageGetDrawingTransform also checks for rotation in the pdf, you can use sth like this to correct it manually: