views:

117

answers:

1

i have multi pages pdf,i want to go to the next page of pdf, how to go this.

+1  A: 

(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

Fuggly