如果pdf有多页,如何在objective-c中转到pdf的下一页

时间:2010-06-01 09:59:41

标签: iphone objective-c

我有多页pdf,我想转到pdf的下一页, 怎么去。

1 个答案:

答案 0 :(得分:1)

(页面 - >您要显示的页面,pdfReference:对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();
  }

将其插入drawRect :( CGRect),你可以去