how to go to next page of pdf in objective-c if pdf have multi pages
i have multi pages pdf,i want to go to the next page of pdf开发者_Python百科, how to go this.
(page -> the page you want to display, pdfReference: a reference to a CGPDFDocumentRef)
pageReference = CGPDFDocumentGetPage(pdfReference, page);
CGContextRef context = UIGraphicsGetCurrentContext();
@try {
CGContextTranslateCTM(context, 0.0, self.bounds.size.height);
CGContextScaleCTM(context, scale, -scale);
CGContextSaveGState(context);
CGAffineTransform pdfTransform = CGPDFPageGetDrawingTransform(pageReference, kCGPDFCropBox, self.bounds, 0, true);
CGContextConcatCTM(context, pdfTransform);
CGContextDrawPDFPage(context, pageReference);
CGContextRestoreGState(context);
}
@finally {
UIGraphicsEndImageContext();
}
insert this into a drawRect:(CGRect) and you are fine to go
精彩评论