While I was going thru the pdf document in quartz 2D, they were saying about getting a page from the CGPDFDocument object. Then the draw the page in a CGContextRef object.
CGPDFDocumentRef document = MyGetPDFDocumentRef (filename);
CGPDFPageRef page = CGPDFDocumentGetPage (document, pageNumber);
CGContextDrawPDFPage (myContext, page);
CGPDFDocumentRelease (document);
Everything is done into this context. I dont understand how these things done to a context can 开发者_Python百科be viewed in a view OR Am i missing something? I am viewing the pdf in a webView.
A CGContextRef
is a canvas for drawing 2D stuff on it. The code you quoted draws a PDF page on the canvas.
Every UIView
has a -drawRect:
method for rendering the view on screen. In the method a CGContextRef
is automatically provided (UIGraphicsGetCurrentContext()
) for you to draw what you needed.
精彩评论