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/ ...
随机推荐
- JDBC的操作步骤
JDBC的操作步骤 一.什么是JDBC JDBC(Java DataBase Connectivity,java数据库连接)是一种用于执行SQL语句的Java API,可以为多种关系数据库提供统一访问 ...
- ballerina 学习二十四 监控ballerina
ballerina 服务的监控还是比较方便的,以及集成了Prometheus Grafana Jaeger Elastic Stack 监控服务监控的集成 主要包含以下几个步骤 a. 安装docker ...
- apache伪静态设置
在网站根目录下新建一个.htaccess文件即可,编辑如下 RewriteEngine On #游戏列表详细介绍 RewriteRule ^g-([0-9]+).html$ game.php?acti ...
- table 如何给tr border颜色
border-collapse属性值 说明 separate 默认值,边框分开,不合并 collapse 边框合并,如果相邻,则共用一个边框 table,th,td{border:1px solid ...
- Linux环境安装jdk10
一. 下载jdk 下载方式一:直接在linux上下载 wget --no-check-certificate --no-cookies --header "Cookie: oraclelic ...
- NOIP 2005 校门外的树
#include<iostream> #include<cstring> using namespace std; int a[10005]; int main() { mem ...
- 常用的acl规则
一.常用的acl规则 haproxy的ACL用于实现基于请求报文的首部.响应报文的内容或其它的环境状态信息来做出转发决策,这大大增强了其配置弹性.其配置法则通常分为两步,首先去定义ACL ...
- 【详解】Linux的文件描述符fd与文件指针FILE*互相转换
使用系统调用的时候用文件描述符(file descriptor,简称fd)的时候比较多,但是操作比较原始.C库函数在I/O上提供了一些方便的包装(比如格式化I/O.重定向),但是对细节的控制不够. 如 ...
- 黄聪:360浏览器、chrome开发扩展插件教程(3)关于本地存储数据
转载:http://www.cnblogs.com/walkingp/archive/2011/04/04/2003875.html HTML5中的localStorage localStorage与 ...
- ffmpeg+nginx+video实现rtsp流转hls流,通过H5查看监控视频
一.FFmpeg下载:http://ffmpeg.zeranoe.com/builds/ 下载并解压FFmpeg文件夹,配置环境变量:在“Path”变量原有变量值内容上加上d:\ffmpeg\bin, ...