ios 学习之你画我话绘图四 读取pdf (官方代码)
来源:互联网 发布:php编译安装pdo mysql 编辑:程序博客网 时间:2024/04/18 04:29
-(void)drawInContext:(CGContextRef)context
{
// 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(self.pdfDocument,1);
// 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);
}
-(CGPDFDocumentRef)pdfDocument
{
if (_pdfDocument ==NULL)
{
CFURLRef pdfURL =CFBundleCopyResourceURL(CFBundleGetMainBundle(),CFSTR("Quartz.pdf"),NULL, NULL);
_pdfDocument =CGPDFDocumentCreateWithURL((CFURLRef)pdfURL);
CFRelease(pdfURL);
}
return_pdfDocument;
}
-(void)dealloc
{
CGPDFDocumentRelease(_pdfDocument);
}
@end
- ios 学习之你画我话绘图四 读取pdf (官方代码)
- ios 学习之你画我话绘图七 椭圆形
- ios 学习之你画我话绘图三 画线
- ios 学习之你画我话绘图六 矩形
- ios 学习之你画我话绘图一 绘制文本和图像
- ios 学习之你画我话绘图二 熟悉下CGContextRef
- ios 学习之你画我话绘图五 构造路径基础知识
- IOS之Quartz2D绘图6.PDF文档生成
- apache POI学习(四)——apache官方读取方式试验
- TensorFlow官方教程学习笔记(四)——MNIST数据集的读取
- iOS开发学习之Quartz2D绘图
- iOS开发学习之Quartz2D绘图
- iOS图像处理(8)在PDF中绘图
- 一步一步跟我学习lucene(15)---java读取word excel pdf及lucene搜索之正则表达式查询RegExQuery和手机邮箱查询示例
- 绘图(四,view之绘图双缓冲)
- 绘图与动画学习笔记(四)
- Android3D绘图之OpenGL ES(四)
- Web导出(四)之iText将HTML代码导出PDF
- mkfs.ext2 mkfs.vfat 格式化u盘时失败
- oracle undo insert实验
- Linux系统Load average负载详细解释
- 泰晤士报2013全球大学声望排行榜TOP100
- ACM 外星人 关于STL map的困惑
- ios 学习之你画我话绘图四 读取pdf (官方代码)
- HDU 4756 次小生成树裸题
- 源文件存放在虚拟机共享目录导致asp.net调试时[没有相关的源行]问题
- 黑马程序员_集合知识2
- iOS开发>>>NSData 与 NSString,Byte数组,UIImage 的相互转换
- hdu3836 最强连通图,trajan算法...
- linux C函数之strdup函数分析
- 黑马程序员_java面向对象
- 闭包使用之两类交互