0% found this document useful (0 votes)
153 views

Cgpdfdocument Reference: Graphics & Animation: 2D Drawing

CGPDFDocument Reference Graphics and Animation: 2D Drawing Apple Inc. No part of this publication may be reproduced, stored in a retrieval system, or transmitted. Use of the "keyboard" Apple logo (Option-Shift-K) for commercial purposes without the prior written consent of Apple may constitute trademark infringement and unfair competition. Apple retains all intellectual property rights associated with the technology described in this document.

Uploaded by

SocialDoc
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
153 views

Cgpdfdocument Reference: Graphics & Animation: 2D Drawing

CGPDFDocument Reference Graphics and Animation: 2D Drawing Apple Inc. No part of this publication may be reproduced, stored in a retrieval system, or transmitted. Use of the "keyboard" Apple logo (Option-Shift-K) for commercial purposes without the prior written consent of Apple may constitute trademark infringement and unfair competition. Apple retains all intellectual property rights associated with the technology described in this document.

Uploaded by

SocialDoc
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

CGPDFDocument Reference

Graphics & Animation: 2D Drawing

2006-12-22
IN NO EVENT WILL APPLE BE LIABLE FOR DIRECT,
INDIRECT, SPECIAL, INCIDENTAL, OR
Apple Inc. CONSEQUENTIAL DAMAGES RESULTING FROM ANY
© 2003, 2006 Apple Computer, Inc. DEFECT OR INACCURACY IN THIS DOCUMENT, even
if advised of the possibility of such damages.
All rights reserved.
THE WARRANTY AND REMEDIES SET FORTH ABOVE
ARE EXCLUSIVE AND IN LIEU OF ALL OTHERS, ORAL
No part of this publication may be reproduced, OR WRITTEN, EXPRESS OR IMPLIED. No Apple
stored in a retrieval system, or transmitted, in dealer, agent, or employee is authorized to make
any modification, extension, or addition to this
any form or by any means, mechanical, warranty.
electronic, photocopying, recording, or Some states do not allow the exclusion or limitation
otherwise, without prior written permission of of implied warranties or liability for incidental or
consequential damages, so the above limitation or
Apple Inc., with the following exceptions: Any exclusion may not apply to you. This warranty gives
person is hereby authorized to store you specific legal rights, and you may also have
documentation on a single computer for other rights which vary from state to state.
personal use only and to print copies of
documentation for personal use provided that
the documentation contains Apple’s copyright
notice.
The Apple logo is a trademark of Apple Inc.
Use of the “keyboard” Apple logo
(Option-Shift-K) for commercial purposes
without the prior written consent of Apple may
constitute trademark infringement and unfair
competition in violation of federal and state
laws.
No licenses, express or implied, are granted
with respect to any of the technology described
in this document. Apple retains all intellectual
property rights associated with the technology
described in this document. This document is
intended to assist application developers to
develop applications only for Apple-labeled
computers.
Every effort has been made to ensure that the
information in this document is accurate. Apple
is not responsible for typographical errors.
Apple Inc.
1 Infinite Loop
Cupertino, CA 95014
408-996-1010

Apple, the Apple logo, Mac, Mac OS, Pages, and


Quartz are trademarks of Apple Inc., registered
in the United States and other countries.
Adobe, Acrobat, and PostScript are trademarks
or registered trademarks of Adobe Systems
Incorporated in the U.S. and/or other countries.
Simultaneously published in the United States
and Canada.
Even though Apple has reviewed this document,
APPLE MAKES NO WARRANTY OR REPRESENTATION,
EITHER EXPRESS OR IMPLIED, WITH RESPECT TO
THIS DOCUMENT, ITS QUALITY, ACCURACY,
MERCHANTABILITY, OR FITNESS FOR A PARTICULAR
PURPOSE. AS A RESULT, THIS DOCUMENT IS
PROVIDED “AS IS,” AND YOU, THE READER, ARE
ASSUMING THE ENTIRE RISK AS TO ITS QUALITY
AND ACCURACY.
Contents

CGPDFDocument Reference 5

Overview 5
Functions by Task 5
Creating PDF Document Objects 5
Retaining and Releasing PDF Documents 5
Getting the CFType ID for a PDF Document Object 6
Getting Information About Quartz PDF Documents 6
Managing Encryption 6
Getting Page Information 6
Functions 7
CGPDFDocumentAllowsCopying 7
CGPDFDocumentAllowsPrinting 7
CGPDFDocumentCreateWithProvider 8
CGPDFDocumentCreateWithURL 8
CGPDFDocumentGetCatalog 9
CGPDFDocumentGetID 9
CGPDFDocumentGetInfo 10
CGPDFDocumentGetNumberOfPages 10
CGPDFDocumentGetPage 11
CGPDFDocumentGetTypeID 11
CGPDFDocumentGetVersion 11
CGPDFDocumentIsEncrypted 12
CGPDFDocumentIsUnlocked 12
CGPDFDocumentRelease 13
CGPDFDocumentRetain 13
CGPDFDocumentUnlockWithPassword 14
Data Types 15
CGPDFDocumentRef 15

Appendix A Deprecated CGPDFDocument Functions 17

Deprecated in Mac OS X version 10.3 and later 17


CGPDFDocumentGetArtBox 17
CGPDFDocumentGetBleedBox 17
CGPDFDocumentGetCropBox 18
CGPDFDocumentGetMediaBox 19
CGPDFDocumentGetRotationAngle 19
CGPDFDocumentGetTrimBox 20

3
2006-12-22 | © 2003, 2006 Apple Computer, Inc. All Rights Reserved.
CONTENTS

Document Revision History 23

Index 25

4
2006-12-22 | © 2003, 2006 Apple Computer, Inc. All Rights Reserved.
CGPDFDocument Reference

Derived From: CFType


Framework: ApplicationServices/ApplicationServices.h
Companion guide Quartz 2D Programming Guide

Declared in CGPDFDocument.h

Overview

The CGPDFDocumentRef opaque type encapsulates a document that contains PDF (Portable Document
Format) drawing information. PDF provides an efficient format for cross-platform exchange of documents
with rich content. PDF files can contain multiple pages of images and text. A PDF document object contains
all the information relating to a PDF document, including its catalog and contents.

Note that PDF documents may be encrypted, and that some operations may be restricted until a valid
password is supplied—see the functions listed in “Managing Encryption” (page 6). Quartz also supports
decrypting encrypted documents.

Quartz can both display and generate files that are compliant with the PDF standard. When imaging PDF
files, CGPDFDocumentRef is the basic type used to represent a PDF document.

Functions by Task

Creating PDF Document Objects


CGPDFDocumentCreateWithProvider (page 8)
Creates a Quartz PDF document using a data provider.
CGPDFDocumentCreateWithURL (page 8)
Creates a Quartz PDF document using data specified by a URL.

Retaining and Releasing PDF Documents


CGPDFDocumentRelease (page 13)
Decrements the retain count of a PDF document.
CGPDFDocumentRetain (page 13)
Increments the retain count of a Quartz PDF document.

Overview 5
2006-12-22 | © 2003, 2006 Apple Computer, Inc. All Rights Reserved.
CGPDFDocument Reference

Getting the CFType ID for a PDF Document Object


CGPDFDocumentGetTypeID (page 11)
Returns the type identifier for Quartz PDF documents.

Getting Information About Quartz PDF Documents


CGPDFDocumentGetCatalog (page 9)
Returns the document catalog of a Quartz PDF document.
CGPDFDocumentGetNumberOfPages (page 10)
Returns the number of pages in a PDF document.
CGPDFDocumentGetPage (page 11)
Returns a page from a Quartz PDF document.
CGPDFDocumentGetVersion (page 11)
Returns the major and minor version numbers of a Quartz PDF document.
CGPDFDocumentGetInfo (page 10)
Gets the information dictionary for a PDF document.
CGPDFDocumentGetID (page 9)
Gets the file identifier for a PDF document.

Managing Encryption
CGPDFDocumentAllowsCopying (page 7)
Returns whether the specified PDF document allows copying.
CGPDFDocumentAllowsPrinting (page 7)
Returns whether a PDF document allows printing.
CGPDFDocumentIsEncrypted (page 12)
Returns whether the specified PDF file is encrypted.
CGPDFDocumentIsUnlocked (page 12)
Returns whether the specified PDF document is currently unlocked.
CGPDFDocumentUnlockWithPassword (page 14)
Unlocks an encrypted PDF document, if a valid password is supplied.

Getting Page Information


CGPDFDocumentGetArtBox (page 17) Deprecated in Mac OS X version 10.3 and later
Returns the art box of a page in a PDF document.
CGPDFDocumentGetBleedBox (page 17) Deprecated in Mac OS X version 10.3 and later
Returns the bleed box of a page in a PDF document.
CGPDFDocumentGetCropBox (page 18) Deprecated in Mac OS X version 10.3 and later
Returns the crop box of a page in a PDF document.
CGPDFDocumentGetMediaBox (page 19) Deprecated in Mac OS X version 10.3 and later
Returns the media box of a page in a PDF document.

6 Functions by Task
2006-12-22 | © 2003, 2006 Apple Computer, Inc. All Rights Reserved.
CGPDFDocument Reference

CGPDFDocumentGetRotationAngle (page 19) Deprecated in Mac OS X version 10.3 and later


Returns the rotation angle of a page in a PDF document.
CGPDFDocumentGetTrimBox (page 20) Deprecated in Mac OS X version 10.3 and later
Returns the trim box of a page in a PDF document.

Functions

CGPDFDocumentAllowsCopying
Returns whether the specified PDF document allows copying.

bool CGPDFDocumentAllowsCopying (
CGPDFDocumentRef document
);

Parameters
document
A PDF document.
Return Value
A Boolean that, if true, indicates that the document allows copying. If the value is false, the document
does not allow copying.

Discussion
This function returns true if the specified PDF document allows copying. It returns false if the document
is encrypted and the current password doesn't grant permission to perform copying.

Availability
Available in Mac OS X version 10.2 and later.

Declared In
CGPDFDocument.h

CGPDFDocumentAllowsPrinting
Returns whether a PDF document allows printing.

bool CGPDFDocumentAllowsPrinting (
CGPDFDocumentRef document
);

Parameters
document
A PDF document.
Return Value
A Boolean that, if true, indicates that the document allows printing. If the value is false, the document
does not allow printing.

Discussion
This function returns true if the specified PDF document allows printing. It returns false if the document
is encrypted and the current password doesn't grant permission to perform printing.

Functions 7
2006-12-22 | © 2003, 2006 Apple Computer, Inc. All Rights Reserved.
CGPDFDocument Reference

Availability
Available in Mac OS X version 10.2 and later.

Declared In
CGPDFDocument.h

CGPDFDocumentCreateWithProvider
Creates a Quartz PDF document using a data provider.

CGPDFDocumentRef CGPDFDocumentCreateWithProvider (
CGDataProviderRef provider
);

Parameters
provider
A data provider that supplies the PDF document data.
Return Value
A new Quartz PDF document, or NULL if a document can not be created. You are responsible for releasing
the object using CGPDFDocumentRelease (page 13).

Discussion
Distributing individual pages of a PDF document to separate threads is not supported. If you want to use
threads, consider creating a separate document for each thread and operating on a block of pages per thread.

Availability
Available in Mac OS X version 10.0 and later.

See Also
CGContextDrawPDFDocument

Declared In
CGPDFDocument.h

CGPDFDocumentCreateWithURL
Creates a Quartz PDF document using data specified by a URL.

CGPDFDocumentRef CGPDFDocumentCreateWithURL (
CFURLRef url
);

Parameters
url
The URL address at which the PDF document data is located.
Return Value
A new Quartz PDF document, or NULL if a document could not be created. You are responsible for releasing
the object using CGPDFDocumentRelease (page 13).

Discussion
Distributing individual pages of a PDF document to separate threads is not supported. If you want to use
threads, consider creating a separate document for each thread and operating on a block of pages per thread.

8 Functions
2006-12-22 | © 2003, 2006 Apple Computer, Inc. All Rights Reserved.
CGPDFDocument Reference

Availability
Available in Mac OS X version 10.0 and later.

See Also
CGContextDrawPDFDocument

Related Sample Code


Quartz EB

Declared In
CGPDFDocument.h

CGPDFDocumentGetCatalog
Returns the document catalog of a Quartz PDF document.

CGPDFDictionaryRef CGPDFDocumentGetCatalog (
CGPDFDocumentRef document
);

Parameters
document
A PDF document.
Return Value
The document catalog of the specified document.

Discussion
The entries in a PDF document catalog recursively describe the contents of the PDF document. You can
access the contents of a PDF document catalog by calling the function CGPDFDocumentGetCatalog. For
information on accessing PDF metadata, see Quartz 2D Programming Guide.

Availability
Available in Mac OS X version 10.3 and later.

Declared In
CGPDFDocument.h

CGPDFDocumentGetID
Gets the file identifier for a PDF document.

CGPDFArrayRef CGPDFDocumentGetID (
CGPDFDocumentRef document
);

Parameters
document
The document whose file identifier you want to obtain.
Return Value
Returns the file identifier for the document.

Functions 9
2006-12-22 | © 2003, 2006 Apple Computer, Inc. All Rights Reserved.
CGPDFDocument Reference

Discussion
A PDF file identifier is defined in the PDF specification as an array of two strings, the first of which is a
permanent identifier that doesn’t change even when the file is updated. The second string changes each
time the file is updated. For more information, see PDF Reference: Version 1.3 (Second Edition), Adobe Systems
Incorporated.

Availability
Available in Mac OS X v10.4 and later.

Declared In
CGPDFDocument.h

CGPDFDocumentGetInfo
Gets the information dictionary for a PDF document.

CGPDFDictionaryRef CGPDFDocumentGetInfo (
CGPDFDocumentRef document
);

Parameters
document
The document whose dictionary you want to obtain.
Return Value
The information dictionary for the document.

Availability
Available in Mac OS X v10.4 and later.

Declared In
CGPDFDocument.h

CGPDFDocumentGetNumberOfPages
Returns the number of pages in a PDF document.

size_t CGPDFDocumentGetNumberOfPages (
CGPDFDocumentRef document
);

Parameters
document
The PDF document to examine.
Return Value
The total number of pages in the PDF document.

Availability
Available in Mac OS X version 10.0 and later.

Related Sample Code


Quartz EB

10 Functions
2006-12-22 | © 2003, 2006 Apple Computer, Inc. All Rights Reserved.
CGPDFDocument Reference

Declared In
CGPDFDocument.h

CGPDFDocumentGetPage
Returns a page from a Quartz PDF document.

CGPDFPageRef CGPDFDocumentGetPage (
CGPDFDocumentRef document,
size_t pageNumber
);

Parameters
document
A PDF document.
pageNumber
The number of the page requested.
Return Value
Return the PDF page corresponding to the specified page number, or NULL if no such page exists in the
document. Pages are numbered starting at 1.

Availability
Available in Mac OS X version 10.3 and later.

Declared In
CGPDFDocument.h

CGPDFDocumentGetTypeID
Returns the type identifier for Quartz PDF documents.

CFTypeID CGPDFDocumentGetTypeID (
void
);

Return Value
The identifier for the opaque type CGPDFDocumentRef (page 15).

Availability
Available in Mac OS X version 10.2 and later.

Declared In
CGPDFDocument.h

CGPDFDocumentGetVersion
Returns the major and minor version numbers of a Quartz PDF document.

Functions 11
2006-12-22 | © 2003, 2006 Apple Computer, Inc. All Rights Reserved.
CGPDFDocument Reference

void CGPDFDocumentGetVersion (
CGPDFDocumentRef document,
int *majorVersion,
int *minorVersion
);

Parameters
document
A PDF document.
majorVersion
On return, contains the major version number of the document.
minorVersion
On return, contains the minor version number of the document.
Return Value
On return, the values of the majorVersion and minorVersion parameters are set to the major and minor
version numbers of the document respectively.

Availability
Available in Mac OS X version 10.3 and later.

Declared In
CGPDFDocument.h

CGPDFDocumentIsEncrypted
Returns whether the specified PDF file is encrypted.

bool CGPDFDocumentIsEncrypted (
CGPDFDocumentRef document
);

Parameters
document
A PDF document.
Return Value
A Boolean that, if true, indicates that the document is encrypted. If the value is false, the document is not
encrypted.

Discussion
If the document is encrypted, a password must be supplied before certain operations are enabled. For more
information, see CGPDFDocumentUnlockWithPassword (page 14).

Availability
Available in Mac OS X version 10.2 and later.

Declared In
CGPDFDocument.h

CGPDFDocumentIsUnlocked
Returns whether the specified PDF document is currently unlocked.

12 Functions
2006-12-22 | © 2003, 2006 Apple Computer, Inc. All Rights Reserved.
CGPDFDocument Reference

bool CGPDFDocumentIsUnlocked (
CGPDFDocumentRef document
);

Parameters
document
A PDF document.
Return Value
A Boolean that, if true, indicates that the document is not locked. If the value is false, the document is
locked.

Discussion
There are two possible reasons why a PDF document is unlocked:

■ The document is not encrypted.


■ The document is encrypted, and a valid password was previously specified using
CGPDFDocumentUnlockWithPassword (page 14).

Availability
Available in Mac OS X version 10.2 and later.

Declared In
CGPDFDocument.h

CGPDFDocumentRelease
Decrements the retain count of a PDF document.

void CGPDFDocumentRelease (
CGPDFDocumentRef document
);

Parameters
document
The PDF document to release.
Discussion
This function is equivalent to CFRelease, except that it does not cause an error if the document parameter
is NULL.

Availability
Available in Mac OS X version 10.0 and later.

Related Sample Code


Quartz EB

Declared In
CGPDFDocument.h

CGPDFDocumentRetain
Increments the retain count of a Quartz PDF document.

Functions 13
2006-12-22 | © 2003, 2006 Apple Computer, Inc. All Rights Reserved.
CGPDFDocument Reference

CGPDFDocumentRef CGPDFDocumentRetain (
CGPDFDocumentRef document
);

Parameters
document
The PDF document to retain.
Return Value
The same document you passed in as the document parameter.

Discussion
This function is equivalent to CFRetain, except that it does not cause an error if the document parameter
is NULL.

Availability
Available in Mac OS X version 10.0 and later.

Declared In
CGPDFDocument.h

CGPDFDocumentUnlockWithPassword
Unlocks an encrypted PDF document, if a valid password is supplied.

bool CGPDFDocumentUnlockWithPassword (
CGPDFDocumentRef document,
const char *password
);

Parameters
document
A PDF document.
password
A pointer to a string that contains the password.
Return Value
A Boolean that, if true, indicates that the document has been successfully unlocked. If the value is false,
the document has not been unlocked.

Discussion
Given an encrypted PDF document and a password, this function does the following:

■ Sets the lock state of the document, based on the validity of the password.
■ Returns true if the document is unlocked.
■ Returns false if the document cannot be unlocked with the specified password.

Unlocking a PDF document makes it possible to decrypt the document and perform other privileged
operations. Different passwords enable different operations.

Availability
Available in Mac OS X version 10.2 and later.

14 Functions
2006-12-22 | © 2003, 2006 Apple Computer, Inc. All Rights Reserved.
CGPDFDocument Reference

Declared In
CGPDFDocument.h

Data Types

CGPDFDocumentRef
An opaque type that represents a PDF (Portable Document Format) document.

typedef struct CGPDFDocument * CGPDFDocumentRef;

Availability
Available in Mac OS X v10.0 and later.

Declared In
CGPDFDocument.h

Data Types 15
2006-12-22 | © 2003, 2006 Apple Computer, Inc. All Rights Reserved.
CGPDFDocument Reference

16 Data Types
2006-12-22 | © 2003, 2006 Apple Computer, Inc. All Rights Reserved.
APPENDIX A

Deprecated CGPDFDocument Functions

A function identified as deprecated has been superseded and may become unsupported in the future.

Deprecated in Mac OS X version 10.3 and later

CGPDFDocumentGetArtBox
Returns the art box of a page in a PDF document. (Deprecated in Mac OS X version 10.3 and later.)

CGRect CGPDFDocumentGetArtBox (
CGPDFDocumentRef document,
int page
);

Parameters
document
The PDF document to examine.
page
An integer that specifies the number of the page to examine.
Return Value
A rectangle that represents the art box for the specified page, expressed in default PDF user space units
(points).

Discussion
The replacement function for this one is CGPDFPageGetBoxRect, which gets the rectangle associated with
a type of box (art, media, crop, bleed trim) that represents a content region or page dimensions of a PDF
page. For more information see CGPDFPage Reference.

The art box defines the extent of the page’s meaningful content (including potential white space) as intended
by the document creator. The default value is the page’s crop box.

Availability
Available in Mac OS X version 10.0 and later.
Deprecated in Mac OS X version 10.3 and later.

Declared In
CGPDFDocument.h

CGPDFDocumentGetBleedBox
Returns the bleed box of a page in a PDF document. (Deprecated in Mac OS X version 10.3 and later.)

Deprecated in Mac OS X version 10.3 and later 17


2006-12-22 | © 2003, 2006 Apple Computer, Inc. All Rights Reserved.
APPENDIX A
Deprecated CGPDFDocument Functions

CGRect CGPDFDocumentGetBleedBox (
CGPDFDocumentRef document,
int page
);

Parameters
document
The PDF document to examine.
page
An integer that specifies the number of the page to examine.
Return Value
A rectangle that represents the bleed box for the specified page, expressed in default PDF user space units
(points).

Discussion
The replacement function for this one is CGPDFPageGetBoxRect, which gets the rectangle associated with
a type of box (art, media, crop, bleed trim) that represents a content region or page dimensions of a PDF
page. For more information see CGPDFPage Reference.

The bleed box defines the bounds to which the contents of the page should be clipped when output in a
production environment. The default value is the page’s crop box.

Availability
Available in Mac OS X version 10.0 and later.
Deprecated in Mac OS X version 10.3 and later.

Declared In
CGPDFDocument.h

CGPDFDocumentGetCropBox
Returns the crop box of a page in a PDF document. (Deprecated in Mac OS X version 10.3 and later.)

CGRect CGPDFDocumentGetCropBox (
CGPDFDocumentRef document,
int page
);

Parameters
document
The PDF document to examine.
page
An integer that specifies the number of the page to examine.
Return Value
A rectangle that represents the crop box for the specified page, expressed in default PDF user space units
(points).

Discussion
The replacement function for this one is CGPDFPageGetBoxRect, which gets the rectangle associated with
a type of box (art, media, crop, bleed trim) that represents a content region or page dimensions of a PDF
page. For more information see CGPDFPage Reference.

18 Deprecated in Mac OS X version 10.3 and later


2006-12-22 | © 2003, 2006 Apple Computer, Inc. All Rights Reserved.
APPENDIX A
Deprecated CGPDFDocument Functions

The crop box defines the region to which the contents of the page are to be clipped (or cropped) when
displayed or printed. Unlike the other boxes, the crop box has no defined meaning in terms of physical page
geometry or intended use—it merely suggests where the page should be clipped.

Availability
Available in Mac OS X version 10.0 and later.
Deprecated in Mac OS X version 10.3 and later.

Declared In
CGPDFDocument.h

CGPDFDocumentGetMediaBox
Returns the media box of a page in a PDF document. (Deprecated in Mac OS X version 10.3 and later.)

CGRect CGPDFDocumentGetMediaBox (
CGPDFDocumentRef document,
int page
);

Parameters
document
The PDF document to examine.
page
An integer that specifies the number of the page to examine.
Return Value
A rectangle that represents the media box for the specified page, expressed in default PDF user space units
(points).

Discussion
The replacement function for this one is CGPDFPageGetBoxRect, which gets the rectangle associated with
a type of box (art, media, crop, bleed trim) that represents a content region or page dimensions of a PDF
page. For more information see CGPDFPage Reference.

The media box defines the location and size of the physical medium on which the page is intended to be
displayed or printed. For example, if the page size is 8.5 by 11 inches, this function returns the coordinate
pairs (0,0) and (612,792).

Availability
Available in Mac OS X version 10.0 and later.
Deprecated in Mac OS X version 10.3 and later.

Related Sample Code


Quartz EB

Declared In
CGPDFDocument.h

CGPDFDocumentGetRotationAngle
Returns the rotation angle of a page in a PDF document. (Deprecated in Mac OS X version 10.3 and later.)

Deprecated in Mac OS X version 10.3 and later 19


2006-12-22 | © 2003, 2006 Apple Computer, Inc. All Rights Reserved.
APPENDIX A
Deprecated CGPDFDocument Functions

int CGPDFDocumentGetRotationAngle (
CGPDFDocumentRef document,
int page
);

Parameters
document
The PDF document to examine.
page
An integer that specifies the number of the page to examine.
Return Value
The rotation angle of the page, expressed in degrees. If the specified page does not exist, returns 0.

Discussion
The replacement function for this one is CGPDFPageGetRotationAngle. For more information see CGPDFPage
Reference.

Availability
Available in Mac OS X version 10.0 and later.
Deprecated in Mac OS X version 10.3 and later.

Declared In
CGPDFDocument.h

CGPDFDocumentGetTrimBox
Returns the trim box of a page in a PDF document. (Deprecated in Mac OS X version 10.3 and later.)

CGRect CGPDFDocumentGetTrimBox (
CGPDFDocumentRef document,
int page
);

Parameters
document
The PDF document to examine.
page
A value specifying the number of the page to examine.
Return Value
Returns a rectangle that represents the trim box for the specified page, expressed in default PDF user space
units (points).

Discussion
The replacement function for this one is CGPDFPageGetBoxRect, which gets the rectangle associated with
a type of box (art, media, crop, bleed trim) that represents a content region or page dimensions of a PDF
page. For more information see CGPDFPage Reference.

The trim box defines the intended dimensions of the finished page after trimming. It may be smaller than
the media box, to allow for production-related content such as printing instructions, cut marks, or color bars.
The default value is the page’s crop box.

Availability
Available in Mac OS X version 10.0 and later.

20 Deprecated in Mac OS X version 10.3 and later


2006-12-22 | © 2003, 2006 Apple Computer, Inc. All Rights Reserved.
APPENDIX A
Deprecated CGPDFDocument Functions

Deprecated in Mac OS X version 10.3 and later.

Declared In
CGPDFDocument.h

Deprecated in Mac OS X version 10.3 and later 21


2006-12-22 | © 2003, 2006 Apple Computer, Inc. All Rights Reserved.
APPENDIX A
Deprecated CGPDFDocument Functions

22 Deprecated in Mac OS X version 10.3 and later


2006-12-22 | © 2003, 2006 Apple Computer, Inc. All Rights Reserved.
REVISION HISTORY

Document Revision History

This table describes the changes to CGPDFDocument Reference.

Date Notes

2006-12-22 Added information about using threads.

2005-04-29 Updated for Mac OS X v10.4.

Added the functions CGPDFDocumentGetInfo (page 10) and


CGPDFDocumentGetID (page 9).

2004-08-31 Added introductory material, additional information about deprecated functions,


and cross references to conceptual documentation.

2004-02-26 First version of this document. An earlier version of this information appeared
in Quartz 2D Reference.

23
2006-12-22 | © 2003, 2006 Apple Computer, Inc. All Rights Reserved.
REVISION HISTORY
Document Revision History

24
2006-12-22 | © 2003, 2006 Apple Computer, Inc. All Rights Reserved.
Index

C
CGPDFDocumentAllowsCopying function 7
CGPDFDocumentAllowsPrinting function 7
CGPDFDocumentCreateWithProvider function 8
CGPDFDocumentCreateWithURL function 8
CGPDFDocumentGetArtBox function (Deprecated in Mac
OS X version 10.3 and later) 17
CGPDFDocumentGetBleedBox function (Deprecated in
Mac OS X version 10.3 and later) 17
CGPDFDocumentGetCatalog function 9
CGPDFDocumentGetCropBox function (Deprecated in
Mac OS X version 10.3 and later) 18
CGPDFDocumentGetID function 9
CGPDFDocumentGetInfo function 10
CGPDFDocumentGetMediaBox function (Deprecated in
Mac OS X version 10.3 and later) 19
CGPDFDocumentGetNumberOfPages function 10
CGPDFDocumentGetPage function 11
CGPDFDocumentGetRotationAngle function
(Deprecated in Mac OS X version 10.3 and later) 19
CGPDFDocumentGetTrimBox function (Deprecated in
Mac OS X version 10.3 and later) 20
CGPDFDocumentGetTypeID function 11
CGPDFDocumentGetVersion function 11
CGPDFDocumentIsEncrypted function 12
CGPDFDocumentIsUnlocked function 12
CGPDFDocumentRef data type 15
CGPDFDocumentRelease function 13
CGPDFDocumentRetain function 13
CGPDFDocumentUnlockWithPassword function 14

25
2006-12-22 | © 2003, 2006 Apple Computer, Inc. All Rights Reserved.

You might also like