PDF Document Creation, Viewing
【PDF Document Creation, Viewing, and Transforming】
Quartz provides the data type CGPDFDocumentRef to represent a PDF document. You create a CGPDFDocument object using either the function CGPDFDocumentCreateWithProvider or the function CGPDFDocumentCreateWithURL. After you create a CGPDFDocument object, you can draw it to a graphics context.
Following code shows how to create a CGPDFDocument object and obtain the number of pages in the document. by
CGPDFDocumentGetNumberOfPages function. A detailed explanation for each numbered line of code appears following the listing.
CGPDFDocumentRef MyGetPDFDocumentRef (const char *filename)
{
CFStringRef path;
CFURLRef url;
CGPDFDocumentRef document;
size_t count; path = CFStringCreateWithCString (NULL, filename,
kCFStringEncodingUTF8);
url = CFURLCreateWithFileSystemPath (NULL, path, //
kCFURLPOSIXPathStyle, );
CFRelease (path);
document = CGPDFDocumentCreateWithURL (url);//
CFRelease(url);
count = CGPDFDocumentGetNumberOfPages (document);//
if (count == ) {
printf("`%s' needs at least one page!", filename);
return NULL;
}
return document;
}
Drawing a PDF page:
void MyDisplayPDFPage (CGContextRef myContext,
size_t pageNumber,
const char *filename)
{
CGPDFDocumentRef document;
CGPDFPageRef page; document = MyGetPDFDocumentRef (filename);//
page = CGPDFDocumentGetPage (document, pageNumber);//
CGContextDrawPDFPage (myContext, page);//
CGPDFDocumentRelease (document);//
}
PDF Document Creation, Viewing的更多相关文章
- POJ 3654 & ZOJ 2936 & HDU 2723 Electronic Document Security(模拟)
		题目链接: PKU:http://poj.org/problem?id=3654 ZJU:http://acm.zju.edu.cn/onlinejudge/showProblem.do?proble ... 
- HDU——2723Electronic Document Security(STL map嵌套set做法)
		Electronic Document Security Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ( ... 
- Delphi资源大全
		A curated list of awesome Delphi frameworks, libraries, resources, and shiny things. Inspired by awe ... 
- Awesome Delphi
		Awesome Delphi A curated list of awesome Delphi frameworks, libraries, resources, and shiny things. ... 
- Core Graphics 定制UIVIew 处理图片
		许多UIView的子类,如UIButton或UILabel,它们的形状都是系统固定的.但是,对于一些特殊的情况,我们需要绘制产品狗想要的图形.那么等待我们的只有两个选择:第一,可以使用UIImageV ... 
- pdf 中内容的坐标系
		PDF Page Coordinates (page size, field placement, etc.) AcroForm, Basics, Automation Page coordinate ... 
- 在.NET中使用iTextSharp创建/读取PDF报告: Part I [翻译]
		原文地址:Create/Read Advance PDF Report using iTextSharp in C# .NET: Part I By Debopam Pal, 27 Nov 20 ... 
- itextsharp c# asp.net 生成 pdf 文件
		一切的开始必须要有2个dll, 可以通过nuget 包xiazai, 关键字是itextsharp. using iTextSharp.text; using iTextSharp.text.pdf; ... 
- Pdf File Writer 中文应用(PDF文件编写器C#类库)
		该文由小居工作室(QQ:2482052910) 翻译并提供解答支持,原文地址:Pdf File Writer 中文应用(PDF文件编写器C#类库):http://www.cnblogs.com/ ... 
随机推荐
- sysstat工具
			sysstat工具可以监控系统的IO,CPU,SWAP,LOAD,NETWORK,DISK 安装后,系统会生成定时任务脚本 路径:/etc/cron.d/sysstat 内容: # Run syste ... 
- 【转】详解硬盘MBR
			原文网址:http://hi.baidu.com/waybq/item/a4490f026f9859d21ef046a4 硬盘是现在计算机上最常用的存储器之一.我们都知道,计算机之所以神奇,是因为它具 ... 
- java的static研究
			(1)static关键字:可以用于修饰属性.方法和类. 1,属性:无论一个类生成了多少个对象,所有这些对象共同使用唯一的一份静态的成员变量(不能修饰临时变量 2,方法:static修饰的方法叫做静态, ... 
- TS/ES/PS
			数字信号实际传送的是数据流,一般数据流包括以下三种: ES流(Elementary Stream): 也叫基本码流,包含视频.音频或数据的连续码流. PES流(Packet Elementary St ... 
- 黄聪:V2010中C#实现友好的等待任务完成时,出现的多线程悬浮窗体
			实现效果如下: 项目已经打包后,大家直接下载吧:[HCWaitForm.rar] 
- PHP调用OCX控件的具体方法
			需要设置php.ini文件,找到这行com.allow_dcom=true,把com组件支持启用 使用PHP调用OCX控件,本不是个难题,但现实中采用flash回避的方法更通用.真正使用ocx的不多, ... 
- 微信JS接口汇总及使用详解
			这篇文章主要介绍了微信JS接口汇总及使用详解,十分的全面.详尽,包含分享到朋友圈,分享给朋友,分享到QQ,拍照或从手机相册中选图,识别音频并返回识别结果,使用微信内置地图查看位置等接口,有需要的小伙伴 ... 
- SpringBoot入门(1)
			一.初始 ①.首先还是要创建一个maven工程 ②.然后编写Controller 让SpringBoot跑起来并不需要太多的代码,就能实现了我们平时要配置很多的功能,这是怎么做到的呢?我们就下面一个入 ... 
- oracle完全删除表空间
			步骤一: 删除user drop user ×× cascade 说明: 删除了user,只是删除了该user下的schema objects,是不会删除相应的tablespace的. 步骤二: 删除 ... 
- MultipartFile 转换为File
			选择用缓冲区来实现这个转换即使用java 创建的临时文件 使用 MultipartFile.transferto()方法 . MultipartFile multipartFile; File fil ... 
