I don’t think you need the code which flips the PDF upside down. I’ve done this before (manual pagination, but without a scroll view) and never had to flip the context vertically. My main concern is that you are doing it on every iteration – if you have a valid reason for flipping it, you probably don’t need it in the loop, but just once before the loop begins. Also the code CGContextTranslateCTM(pdfContext,0,-ty);
might need to be replaced with CGContextTranslateCTM(pdfContext,0,heightOfPdf);
If that doesn’t work, try UIGraphicsBeginPDFPage();
instead of CGContextBeginPage()
, that’s the only major difference between your code and mine.