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的更多相关文章

  1. 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 ...

  2. HDU——2723Electronic Document Security(STL map嵌套set做法)

    Electronic Document Security Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K ( ...

  3. Delphi资源大全

    A curated list of awesome Delphi frameworks, libraries, resources, and shiny things. Inspired by awe ...

  4. Awesome Delphi

    Awesome Delphi  A curated list of awesome Delphi frameworks, libraries, resources, and shiny things. ...

  5. Core Graphics 定制UIVIew 处理图片

    许多UIView的子类,如UIButton或UILabel,它们的形状都是系统固定的.但是,对于一些特殊的情况,我们需要绘制产品狗想要的图形.那么等待我们的只有两个选择:第一,可以使用UIImageV ...

  6. pdf 中内容的坐标系

    PDF Page Coordinates (page size, field placement, etc.) AcroForm, Basics, Automation Page coordinate ...

  7. 在.NET中使用iTextSharp创建/读取PDF报告: Part I [翻译]

    原文地址:Create/Read Advance PDF Report using iTextSharp in C# .NET: Part I    By Debopam Pal, 27 Nov 20 ...

  8. itextsharp c# asp.net 生成 pdf 文件

    一切的开始必须要有2个dll, 可以通过nuget 包xiazai, 关键字是itextsharp. using iTextSharp.text; using iTextSharp.text.pdf; ...

  9. Pdf File Writer 中文应用(PDF文件编写器C#类库)

    该文由小居工作室(QQ:2482052910)    翻译并提供解答支持,原文地址:Pdf File Writer 中文应用(PDF文件编写器C#类库):http://www.cnblogs.com/ ...

随机推荐

  1. conan c&&c++ 包管理工具使用

    测试使用的是JFrog Artifactory CE 进行的私有包管理,具体的安装可以参考相关文档 启动JFrog Artifactory CE 使用docker docker run -d -p 8 ...

  2. curl查询公网出口IP

    liuzhizhi@lzz-rmbp|logs # curl ipinfo.io { "ip": "114.110.1.38", "hostname& ...

  3. bzoj 4036 [HAOI2015]按位或——min-max容斥+FMT

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=4036 题解:https://www.cnblogs.com/Zinn/p/10260126. ...

  4. hive 处理小文件,减少map数

    1.hive.merge.mapfiles,True时会合并map输出.2.hive.merge.mapredfiles,True时会合并reduce输出.3.hive.merge.size.per. ...

  5. MySQL建表规范与常见问题 (go)

    一. 表设计 库名.表名.字段名必须使用小写字母,“_”分割. 库名.表名.字段名必须不超过12个字符. 库名.表名.字段名见名知意,建议使用名词而不是动词. 建议使用InnoDB存储引擎. 存储精确 ...

  6. oracle数据库死锁的查看及解决

    Oracle常见死锁发生的原因以及解决方法 www.MyException.Cn  网友分享于:2014-09-02  浏览:0次       Oracle常见死锁发生的原因以及解决办法 一,删除和更 ...

  7. JSON数组对象某个属性值查找

    1.引用国外开源Linq写法的js框架 地址:https://archive.codeplex.com/?p=jslinq https://www.nuget.org/packages/jslinq ...

  8. [html][javascript] 正则匹配示例

    var str="akdlfaklhello 1234klfd1441ksalfd9000kals8998j2345fd;lsa"; var reg = new RegExp(/( ...

  9. 031:Cetus sharding

    目录 一.主机环境 二.搭建环境 1.准备环境 三.Cetus安装 1.下载包和安装依赖包 2.Cetus安装 1.安装说明 2.安装实施 四.Cetus配置 1.创建和修改配置文件 2.启动cetu ...

  10. 记一次 在 HP zbook G3 笔记本上安装Ubuntu16.04LTS 的 心(填)路(坑)旅程

    背景 同事MM申请的新笔记本暂时没有用,问我需不需要用. 本着 “宇宙都是xx的”(厚颜无耻~~)思想就接受了. 拿到本本一看,HP zbook G3, 配置还不错(500G SSD, 16G mem ...