2010-04-05 63 views
0

我顯示使用使用石英石樣品此代碼瀏覽PDF內容:CGContext上 - PDF保證金

// PDF page drawing expects a Lower-Left coordinate system, so we flip the coordinate system 
// before we start drawing. 
CGContextTranslateCTM(context, 0.0, self.bounds.size.height); 
CGContextScaleCTM(context, 1.0, -1.0); 

// Grab the first PDF page 
CGPDFPageRef page = CGPDFDocumentGetPage(pdf, pageNo); 
// We're about to modify the context CTM to draw the PDF page where we want it, so save the graphics state in case we want to do more drawing 
CGContextSaveGState(context); 
// CGPDFPageGetDrawingTransform provides an easy way to get the transform for a PDF page. It will scale down to fit, including any 
// base rotations necessary to display the PDF page correctly. 
CGAffineTransform pdfTransform = CGPDFPageGetDrawingTransform(page, kCGPDFCropBox, self.bounds, 0, true); 
// And apply the transform. 
CGContextConcatCTM(context, pdfTransform); 
// Finally, we draw the page and restore the graphics state for further manipulations! 
CGContextDrawPDFPage(context, page); 
CGContextRestoreGState(context); 

使用所有這一切工作正常。我想爲PDF上下文設置邊距,默認情況下它會在每邊顯示50 px邊距。我試過CGContext方法,但沒有得到適當的。任何人都可以幫助我嗎?

回答

0

PDFs沒有真正的利潤率概念。如果你不是文檔內容的負責人,那麼你所能做的只是縮小文檔內容。