Anda di halaman 1dari 762

Adobe Acrobat 7.

Acrobat and PDF Library API


Overview

April 14, 2005

Adobe Solutions Network http://partners.adobe.com


Copyright 2004 Adobe Systems Incorporated. All rights reserved.
NOTICE: All information contained herein is the property of Adobe Systems Incorporated. No part of this publication (whether in hardcopy or
electronic form) may be reproduced or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or
otherwise, without the prior written consent of the Adobe Systems Incorporated.
PostScript is a registered trademark of Adobe Systems Incorporated. All instances of the name PostScript in the text are references to the
PostScript language as defined by Adobe Systems Incorporated unless otherwise stated. The name PostScript also is used as a product
trademark for Adobe Systems implementation of the PostScript language interpreter.
Except as otherwise stated, any reference to a PostScript printing device, PostScript display device, or similar item refers to a printing device,
display device or item (respectively) that contains PostScript technology created or licensed by Adobe Systems Incorporated and not to devices
or items that purport to be merely compatible with the PostScript language.
Adobe, the Adobe logo, Acrobat, the Acrobat logo, Acrobat Capture, Distiller, PostScript, the PostScript logo and Reader are either registered
trademarks or trademarks of Adobe Systems Incorporated in the United States and/or other countries.
Apple, Macintosh, and Power Macintosh are trademarks of Apple Computer, Inc., registered in the United States and other countries. PowerPC
is a registered trademark of IBM Corporation in the United States. ActiveX, Microsoft, Windows, and Windows NT are either registered
trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. Verity is a registered trademark of Verity,
Incorporated. UNIX is a registered trademark of The Open Group. Verity is a trademark of Verity, Inc. Lextek is a trademark of Lextek
International. All other trademarks are the property of their respective owners.
This publication and the information herein is furnished AS IS, is subject to change without notice, and should not be construed as a
commitment by Adobe Systems Incorporated. Adobe Systems Incorporated assumes no responsibility or liability for any errors or inaccuracies,
makes no warranty of any kind (express, implied, or statutory) with respect to this publication, and expressly disclaims any and all warranties
of merchantability, fitness for particular purposes, and noninfringement of third party rights.
Contents

Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Audience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Resources and Samples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
How This Document Is Organized . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Conventions Used in This Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

Chapter 1 Acrobat and PDF Library API Overview . . . . . . . . . . . . . . . 21


Integrating With Acrobat and Adobe Reader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
The Acrobat Core API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Core API Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Core API Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Scalar Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Simple Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Complex Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Opaque Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Cos Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Names Without ASAtoms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Understanding Coordinate Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
User Space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Device Space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Translating between User Space and Device Space . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Machine Port Space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Using Rectangles and Quadrilaterals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Handling Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Adding New Object Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Storing Private Data in PDF Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Data Type Changes in Acrobat 6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Support for Backward Compatibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Testing With the TEST_OLD_VERSION Macro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
APIs Specific to the PDF Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

Acrobat and PDF Library API Overview 3


Contents

Chapter 2 PDF Library and Plug-in Applications . . . . . . . . . . . . . . . . 39


Controlling Acrobat Professional, Acrobat Standard, and Adobe Reader . . . . . . . . . . . . . . . . . 39
Drawing Into Another Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Indexed Searching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Steps in the Acrobat Products Indexed Searching . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Extracting Text. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Modifying File Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Creating New Annotation Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Accessing the Info Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Adding Private Data To PDF Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Popular PDF Library Applications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

Chapter 3 Acrobat and PDF Library API Objects . . . . . . . . . . . . . . . . 45


AS Layer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
AV Layer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Cos Layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
PD Layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .105
PDFEdit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .151
PDSEdit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .185

Chapter 4 Overview of the Acrobat Extended APIs . . . . . . . . . . . . . 193


Search Extended API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .193
Search DDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .194
Search APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .194
Catalog Extended API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .195
Catalog DDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .195
Catalog APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .195
PDF Consultant (Scrubber) and Accessibility Checker Extended API . . . . . . . . . . . . . . . . . . . .195
Acrobat Agents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .196
How the Consultant Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .197
Important Issues For Consultant Development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .198
Importing the Consultant HFTs Into a Plugin. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .200
Creating and Destroying Consultants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .201
Registering Agents With The Consultant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .202
Consultant Object Type Identification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .204
Creating Your Agent Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .205
Recognizing Objects of Interest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .207

4 Acrobat and PDF Library API Overview


Contents

Consultant APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .208


Digital Signature (DigSig) Extended API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .209
Plug-in Relationships. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .210
The PubSec Layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .210
Digital Signature Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .211
Digital Signature Scenarios . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .211
Initializing a Plug-in to Work With the Digital Signature Plug-in. . . . . . . . . . . . . . . . . . . .212
Understanding the Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .212
DigSigsUse of Core API Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .216
PubSec and DigSig APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .217
Forms Extended API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .220
OLE for Forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .220
Forms APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .220
Weblink Extended API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .222
Weblink Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .222
Weblink Driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .223
Writing a Custom Driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .223
Weblink APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .224
Spelling Extended API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .225
Using the Spelling HFT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .225
Text Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .226
Spelling APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .226
AcroColor Extended API. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .227
AcroColor APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .229

Chapter 5 Acrobat Support (AS) Layer . . . . . . . . . . . . . . . . . . . . 233


ASAtom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .233
ASCab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .233
ASCab Method Naming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .234
Handling Pointers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .234
ASCab Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .234
ASCallback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .237
ASDate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .238
ASExtension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .239
ASFile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .239
ASFileSys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .241
ASPlatformPath . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .245
ASStm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .247

Acrobat and PDF Library API Overview 5


Contents

ASText . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .248
ASTimeSpan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .252
Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .253
Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .253
Fixed-point Math . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .254
Fixed-point Utility Macros. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .254
Fixed-point Mathematics Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .254
Fixed-point Matrix Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .254
HFT Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .255
Memory Allocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .255
Thread-safe Multithreading APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .256
Using Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .257
Platform-Specific Utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .257
Macintosh. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .257
UNIX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .257
Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .259

Chapter 6 Acrobat Viewer (AV) Layer . . . . . . . . . . . . . . . . . . . . . 261


General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .262
AVActionHandler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .262
AVAlert . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .263
AVAnnotHandler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .263
AVApp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .264
AVCommand. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .270
Invoking AVCommands Programmatically . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .270
Configuring Commands. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .271
AVCommand Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .272
AVConversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .273
AVCrypt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .274
AVDoc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .275
AVGrafSelect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .280
AVMenu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .280
AVMenubar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .282
AVMenuItem. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .283
AVPageView . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .285
AVSweetPea . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .293
AVSys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .294

6 Acrobat and PDF Library API Overview


Contents

AVTool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .295
AVToolBar. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .295
AVToolButton . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .296
AVUndo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .298
AVWindow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .299

Chapter 7 Portable Document (PD) Layer . . . . . . . . . . . . . . . . . . . 303


General PD Layer Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .304
Metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .304
New Metadata Features in PDF 1.4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .305
Metadata APIs in Acrobat 5.0. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .305
PDAction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .306
PDAnnot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .307
PDBead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .309
PDBookmark. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .310
PDCharProc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .312
PDDoc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .313
Querying PDDoc Permissions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .313
Enumeration With PDDoc Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .314
PDDoc Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .315
PDFileSpec . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .322
PDFont . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .323
PDForm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .327
PDGraphic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .327
PDImage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .328
PDInlineImage. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .328
PDLinkAnnot. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .329
PDNameTree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .330
PDNumTree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .331
PDOCConfig . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .331
PDOCContext . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .333
PDOCG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .337
PDOCMD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .339
PDPage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .341
PDPageLabel. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .346
PDPath . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .347

Acrobat and PDF Library API Overview 7


Contents

PDStyle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .347
PDText . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .347
PDTextAnnot. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .348
PDTextSelect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .348
PDThread . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .350
PDThumb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .351
PDTrans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .351
PDViewDestination. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .352
PDWord . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .352
PDWordFinder. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .355
PDXObject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .356

Chapter 8 PDFEdit LayerCreating and Editing Page Content . . . . . . 357


Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .357
Overview of PDFEdit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .357
Why PDFEdit? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .357
What is PDFEdit? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .358
PDFEdit Paradigm. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .358
PDFEdit Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .359
Basic Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .359
PDEElement Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .361
PDEElement Attribute Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .361
Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .362
Comparing PDFEdit to Other Core API Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .363
Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .363
Mapping Between PDF Operators and PDFEdit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .363
Page Contents Stream and PDFEdit Object List Correspondence . . . . . . . . . . . . . . . . . . .364
Enumerating Page Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .364
Using PDFEdit versus PDWordFinder. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .365
Using PDFEdit Versus PDPageAddCosContents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .365
Hit Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .365
Using PDFEdit Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .366
Reference Counting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .366
Matrix Operations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .367
Clip Objects and Sharing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .367
Marked Content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .367
Cos Objects and Documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .368
XObjects and PDEObjects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .368

8 Acrobat and PDF Library API Overview


Contents

Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .368
Client Identifiers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .369
Guide to Page Creation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .369
Common Code Sequence. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .369
Ways To Modify a Pages Content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .370
Debugging Tools and Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .374
Object Dump. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .375
PDFEdit Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .377
Dump Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .377
General Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .377
PDEClip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .377
PDEColorSpace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .378
PDEContainer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .378
PDEContent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .380
PDEDeviceNColors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .381
PDEElement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .381
PDEExtGState . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .383
Setting the Opacity of an Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .383
PDEExtGState Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .384
PDEFont. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .385
PDEForm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .388
PDEGroup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .388
PDEImage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .388
PDEObject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .391
PDEPath. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .391
PDEPattern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .392
PDEPlace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .392
PDEPS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .392
PDEShading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .393
PDESoftMask. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .393
PDEText . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .394
PDETextItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .396
PDEUnknown . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .397
PDEXGroup. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .397
PDEXObject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .398
PDSysEncoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .398
PDSysFont . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .398

Acrobat and PDF Library API Overview 9


Contents

Chapter 9 PDSEdit LayerCreating and Editing Logical Structure . . . . 401


Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .401
Why Have Logical Structure?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .401
Logical Structure in a PDF Document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .402
The Structure Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .403
Navigating a PDF Document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .403
Extracting Data From a PDF Document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .403
Adding Structure Data To a PDF Document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .403
Using pdfmark to Add Structure Data to PDF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .403
PDSEdit Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .404
PDSTreeRoot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .404
PDSElement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .405
PDSAttrObj . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .409
PDSMC. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .409
PDSOBJR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .410
PDSClassMap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .410
PDSRoleMap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .410
Relationship of PDSEdit and PDFEdit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .411
Using the PDSEdit API: Examining Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .411
Structure Tree Root . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .411
Structure Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .412
Traversing Elements in a Subtree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .412
Object Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .414
Other Object Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .414
Element Types and the Role Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .414
Classes and the Class Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .415
Using the PDSEdit API: Creating Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .415
Structure Tree Root . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .415
Structure Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .415
Adding Marked Content to an Element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .416
Adding an Object Reference to an Element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .417
Class Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .417
Role Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .418

Chapter 10 Cos Layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419


Cos Objects: Direct and Indirect. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .419
File Structure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .420
Cos Objects in the Core API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .420

10 Acrobat and PDF Library API Overview


Contents

CosDoc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .421
CosObj. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .422
CosObjCollection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .423
CosArray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .424
CosBoolean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .424
CosDict . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .425
CosFixed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .426
CosInteger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .426
CosName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .426
CosNull . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .427
CosStream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .427
CosString . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .427
Encryption/Decryption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .428

Chapter 11 Handlers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429


Action Handlers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .430
Annotation Handlers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .430
AVCommand Handlers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .431
Creating an AVCommand Handler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .431
Exposing AVCommands to the Batch Framework. . . . . . . . . . . . . . . . . . . . . . . . . . . . .432
File Format Conversion Handlers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .434
File Specification Handlers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .435
Selection Servers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .435
Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .436
Window Handlers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .437
File Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .438
Progress Monitors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .439
Transition Handlers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .439

Chapter 12 Document Security . . . . . . . . . . . . . . . . . . . . . . . . . 441


Encryption and Decryption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .441
Security Handlers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .442
Adding a Security Handler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .443
Security Handler Callbacks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .444
New Security Features in Acrobat 5.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .444
Opening a File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .445

Acrobat and PDF Library API Overview 11


Contents

Acrobats Built-in Authorization Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .446


Saving a File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .447
Setting a Documents Security. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .447
Implementation Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .448
Saving a File With a New Encryption Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .448
Opening an Encrypted File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .448
Utility Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .449

Chapter 13 Handling Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . 451


Exception Handlers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .451
Raising Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .454
Handling an Exception Later . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .454
Returning From an Exception Handler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .454
API Methods That Raise Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .456
Exception Handler Caveats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .456
Do Not Use goto In a DURING...HANDLER Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .456
Do Not Nest Exception Handlers In a Single Function . . . . . . . . . . . . . . . . . . . . . . . . . .457
Be Careful About Register Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .458

Chapter 14 Changes To This Document For Recent Revisions . . . . . . . . 461


Changes in This Document for 6.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .461
API Changes in Acrobat 6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .461
Changes in This Document for 7.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .462

Appendix A Object Interrelationships . . . . . . . . . . . . . . . . . . . . . . 465

Appendix B Portable Document Format . . . . . . . . . . . . . . . . . . . . 467


Relationship of Acrobat and PDF Versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .467
Introduction To PDF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .467
PDF Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .468
File Structure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .468
Document Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .470
Page Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .471

Appendix C Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473


Comments Command Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .473

12 Acrobat and PDF Library API Overview


Contents

Document Command Group. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .474


JavaScript Command Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .479
Page Command Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .480
PDF Consultant Command Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .482
Enumerators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .485
Font Subtypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .487
Glyph Names of Word Separators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .488
Key Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .489
Language Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .491
Menu and Menu Item Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .493
File Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .493
Replaceable Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .495
Selection Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .496
Toolbar and Toolbar Button Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .497
Tool Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .499
Type/Creator Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .500
View Destination Fit Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .502

Appendix D Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 513


Severities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .513

Appendix E Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 541

Appendix F Platform Support Provided by Each API . . . . . . . . . . . . . 597

Appendix G API Changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 687


Version 2.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .687
Version 3.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .688
Version 3.01 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .696
Adobe PDF Library, Version 1.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .697
Version 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .702
Version 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .713
Version 6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .730
New Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .730
Modified Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .731
Deprecated Methods and Callbacks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .731
New and Modified Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .732

Acrobat and PDF Library API Overview 13


Contents

Methods with Cosmetic Type Changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .742


New and Modified Callbacks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .745
Callbacks with Cosmetic Type Changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .747
New and Modified Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .748
Data with Cosmetic Type Changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .750
New Notifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .751
Version 7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .753
New Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .753
Deprecated Methods and Callbacks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .753
New Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .753
NewCallbacks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .756
New Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .756
New Notifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .757

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 759

14 Acrobat and PDF Library API Overview


Preface

Description
This document provides a conceptual overview of the PDF Library and Acrobat core and
extended application programming interfaces (APIs). It is intended to familiarize you with
these APIs, as documented in detail in the Acrobat and PDF Library API Reference. The APIs
are accessed using the Acrobat and PDF Library SDKs.
The Acrobat core and extended APIs are used primarily by Acrobat plug-ins. Plug-ins can be
created for Acrobat Professional, Acrobat Standard, and Adobe Reader. The PDF Library
SDK is used to create individual executable programs and has access to most of the same
APIs as the Acrobat SDK, plus some APIs specific to the PDF Library.
NOTE: Many of the APIs specific to plug-in development, such as those dealing with HFTs,
callbacks, and event handlers, are described in detail in the Acrobat SDK Plug-in
Guide, so are not treated in any great detail in this overview. Similarly, plug-in
applications and how they differ from other SDK applications are described in the
Acrobat SDK Users Guide.
NOTE: The information in this document that does not apply to the PDF library SDK are
primarily the sections on the AcroView (AV) layer of the APIs and the extended APIs
(with the exception of the AcroColor APIs, which can be used by PDF Library
applications). Most of the information in Chapter 11, Handlers, also does not apply
to the PDF Library, with the notable exception of the information on handling file
systems.
Using the Acrobat APIs, a plug-in can perform functions such as:
Controlling an Acrobat session
Customizing the Acrobat user interface
Augmenting existing Acrobat functions
Displaying Portable Document Format (PDF) documents in an application-supplied
window, without using the Acrobat user interface
Manipulating the contents of a PDF file
Adding private data to PDF files
Using the PDF Library APIs, a compiled application can perform functions such as:
Develop a custom PDF creation application
Develop a custom PDF display application
Manipulate and edit existing PDF files
Develop a highly customized printing application

Acrobat and PDF Library API Overview 15


Preface
Audience

Develop a custom security and encryption application


Linearize and optimize PDF creation

Audience
This document is included with both the Adobe Acrobat SDK and the PDF Library SDK.
While the PDF Library SDK is of limited utility to Acrobat SDK developers, the reverse is not
true: many of the samples and much of the documentation that ships with the Acrobat SDK
can also be of great value to PDF Library application developers.
The audience of this document is Acrobat and Adobe Reader plug-in developers, and PDF
Library application developers. Interapplication communication (IAC) application
developers will also find much of the information helpful.
This document assumes that you are familiar with the Acrobat product family and that you
are an experienced user of Acrobat products. You should understand ANSI-C or C++ and be
familiar with programming on your development platform. If you plan to manipulate data
in PDF files, you should be familiar with the contents and structure of PDF files, as described
in the PDF Reference. For an overview of PDF structures, see Appendix B in this document.
If you are new to writing plug-ins, work through some sample plug-ins in the Acrobat SDK
Plug-In Guide. Then you can explore other sample plug-ins provided with the SDK.
If you are writing an application using the PDF Library, see the PDF Library Overview for a
general description of the library and how to use it.

Resources and Samples


For more information, see the following SDK documents, which are referenced in this
overview:
Acrobat and PDF Library API Reference contains the method prototypes and details on
arguments. By using this reference online, you can copy prototypes directly into your
plug-in as you are coding it.
Acrobat SDK Users Guide provides an overview of the Acrobat SDK and the supporting
documentation.
Developing for Adobe Reader provides an introduction to those portions of the Adobe
Acrobat Software Development Kit (SDK) that pertain to your development efforts for
Adobe Reader.
Acrobat SDK Plug-in Guide explains how to use the Acrobat core and extended APIs to
write plug-ins for Acrobat and Adobe Reader. It describes basic Acrobat development
concepts, provides an overview of how Acrobat interacts with plug-ins at load-time and
initialization, and includes chapters that explain and show by example how to code
various tasks that your plug-in can perform to manipulate and enhance the Acrobat user
interface as well as manipulate the contents of underlying PDF documents. This

16 Acrobat and PDF Library API Overview


Preface
How This Document Is Organized

document also provides guidelines for developing plug-ins, including registering plug-
in names and development environment requirements.
PDF Library Overview presents a description of the components of the PDF Library and
PDF Library SDK. It includes detailed instructions on how developers use the PDF Library
on the platform of their choice.
PDF Reference, fifth edition, version 1.6 describes PDF version 1.6 in detail, including PDF
object types, file format, and document structure.
ADM Programmers Guide and Reference describes how to create platform-independent
dialogs for your plug-in.
Additional documents that you should have available for reference are listed below.
Adobe Reader-enabled Plug-ins describes the steps required to enable a plug-in to be
loaded by Adobe Reader.
PostScript Language Reference, third edition describes the syntax and semantics of the
PostScript language and the Adobe imaging model.

How This Document Is Organized


This document is organized as follows:
Chapter 1, Acrobat and PDF Library API Overview, describes the overall structure of the
Acrobat core and extended APIs, the PDF Library APIs, and associated objects, methods,
and data types.
Chapter 2, PDF Library and Plug-in Applications, describes some of the things that
plug-ins and PDF Library can do.
Chapter 3, Acrobat and PDF Library API Objects, summarizes all of the Acrobat and PDF
Library objects and the primary methods that act upon them.
Chapter 4, Overview of the Acrobat Extended APIs, provides an overview of the
Acrobat extended APIs, which are the APIs that are exposed from plug-ins that Adobe
includes with the Acrobat and Adobe Reader products. Also discussed are the AcroColor
APIs, which are part of the core API but which do not conform to the layered naming
convention so are categorized with the extended APIs.
Chapter 5, Acrobat Support (AS) Layer, describes the methods for manipulating
objects in the Acrobat support (AS) layer, as well as platform-specific methods.
Chapter 6, Acrobat Viewer (AV) Layer, describes the Acrobat Viewer (AV) layer methods
for controlling the Acrobat or Adobe Reader application and modifying its user
interface.
Chapter 7, Portable Document (PD) Layer, describes the portable document (PD) layer
of object methods that enable plug-ins and PDF Library applications to access and
manipulate most data in a PDF file.

Acrobat and PDF Library API Overview 17


Preface
How This Document Is Organized

Chapter 8, PDFEdit LayerCreating and Editing Page Content, describes PDFEdit, a


collection of objects that enable your plug-in or PDF Library application to treat a pages
contents as a list of objects rather than manipulating content stream marking operators.
Chapter 9, PDSEdit LayerCreating and Editing Logical Structure, describes PDSEdit, a
collection of objects that enable your plug-in or PDF Library application to create and
examine the logical structure in PDF files.
Chapter 10, Cos Layer, describes the Cos object methods, which provide access to the
low-level object types and file structure in PDF files.
Chapter 11, Handlers, describes handlers, a collection of methods that expand the
number of object types Acrobat supports by adding new types of tools, annotations,
actions, file systems, and so on. Most of this information applies only to plug-ins.
Chapter 12, Document Security, describes the core API document security features:
security handlers, encryption and decryption methods, and utility methods. The APIs
associated with the Digital Signatures (DigSig) plug-in are described in Chapter 4,
Overview of the Acrobat Extended APIs.
Chapter 13, Handling Errors, covers Acrobats error system, providing advice on how to
write exception handlers.
Chapter 14, Changes To This Document For Recent Revisions, lists the additions and
modifications to this document for the last couple of releases of the SDK.
Appendix A, Object Interrelationships, illustrates object interrelationships.
Appendix B, Portable Document Format, provides an overview of PDF structures.
Appendix C, Lists, provides supplemental information to the Acrobat and PDF Library
API Reference. It provides detailed descriptions of important enumerated lists.
Appendix D, Errors, provides supplemental information to the Acrobat and PDF Library
API Reference. It summarizes and provides detailed descriptions of all the API error codes.
Appendix E, Macros, provides supplemental information to the Acrobat and PDF Library
API Reference. It documents many of the macros available in the header files.
Appendix F, Platform Support Provided by Each API, provides supplemental
information to the Acrobat and PDF Library API Reference. It indicates, for every API, the
platforms on which the APIs are supportedAcrobat Professional, Acrobat Standard,
Adobe Reader, and/or PDF Library.
Appendix G, API Changes, provides supplemental information to the Acrobat and PDF
Library API Reference. It lists all the changes to the API that have occurred over the past
several releases, by order of release.

18 Acrobat and PDF Library API Overview


Preface
Conventions Used in This Book

Conventions Used in This Book


The Acrobat documentation uses text styles according to the following conventions.

Font Used for Examples


monospaced Paths and filenames C:\templates\mytmpl.fm

Code examples set off These are variable declarations:


from plain text AVMenu commandMenu,helpMenu;

monospaced bold Code items within plain The GetExtensionID method ...
text
Parameter names and The enumeration terminates if proc
literal values in returns false.
reference documents
monospaced italic Pseudocode ACCB1 void ACCB2 ExeProc(void)
{ do something }
Placeholders in code AFSimple_Calculate(cFunction,
examples cFields)

blue Live links to Web pages The Adobe Solutions Network URL is:
http://partners.adobe.com/asn/
Live links to sections See Using the SDK.
within this document
Live links to code items Test whether an ASAtom exists.
within this document
bold PostScript language and The setpagedevice operator
PDF operators,
keywords, dictionary
key names
User interface names The File menu
italic Document titles that are Acrobat Core API Overview
not live links
New terms User space specifies coordinates for...
PostScript variables filename deletefile

Acrobat and PDF Library API Overview 19


Preface
Conventions Used in This Book

20 Acrobat and PDF Library API Overview


1 Acrobat and PDF Library API
Overview

The Acrobat core API is a set of interfaces you can use to write PDF Library applications and
plug-ins that integrate with Acrobat and Adobe Reader. The Acrobat extended APIs are
interfaces that you can also use to write plug-ins that integrate with Acrobat and Adobe
Reader, but that are exposed from plug-ins rather than from within the core of Acrobat
and Adobe Reader themselves. The PDF Library APIs mostly overlap with the Acrobat core
API (with the important exception of the AV-layer APIs, which are used only by plug-ins),
but extend it as well with a small number of interfaces specific to the PDF Library. This
chapter introduces the core API, extended APIs, and PDF Library API.
This chapter deals primarily with the Acrobat core APIs, most of which are shared with the
PDF Library and all of which are shared with plug-ins along with the extended APIs. For a
detailed overview of the extended APIs, see Chapter 4, Overview of the Acrobat Extended
APIs. For more information about the PDF Library, see the PDF Library Overview, which is
included as part of the PDF Library SDK.

Integrating With Acrobat and Adobe Reader


You can develop software that integrates with Acrobat and the Adobe Reader in three
fundamental ways:
Create plug-ins that are dynamically linked to Acrobat and the Adobe Reader, and that
extend their functionality.
Write a separate application process that uses interapplication communication (IAC) to
control Acrobat functionality. DDE and OLE are supported on Windows, and Apple
events/AppleScript on the Macintosh. IAC programs are not covered in detail in this
document, though the APIs are very similar. For more information on IAC, see the
Acrobat Interapplication Communication Overview and Acrobat Interapplication
Communication Reference.
Write JavaSc ript programs that can be loaded when Acrobat launches, or included as
part of a PDF file. JavaScript programs are not covered in this document, though the
APIs are very similar. For more information on using JavaScript, see the Acrobat
JavaScript Scripting Guide and Acrobat JavaScript Scripting Reference.
Which of these approaches you choose depends on your application. The pros and cons of
each approach for different applications is discussed in the Acrobat SDK Users Guide. The
information in this overview and in the Acrobat and PDF Library API Reference serve to
enhance your understanding of the APIs, regardless of the approach you choose.

Acrobat and PDF Library API Overview 21


Acrobat and PDF Library API Overview
1
The Acrobat Core API

FIGURE 1.1 Ways to integrate with Acrobat and Adobe Reader

JavaScript Acrobat or the Adobe Reader

Plug-In ... Plug-In


IAC IAC

External
Application ... External
Application

Through IAC interfaces, an application can control Acrobat or Adobe Reader in the same
ways the interactive user can. JavaScript and plug-ins can control Acrobat and Adobe
Reader in the same way, but, in addition, they can extend them using the much broader
range of API methods.
Your projects scope determines which of these methods better meets your needs. You can
also use a combination approach, by creating a plug-in and a separate application, where
the application sends messages to the plug-in, and the plug-in manipulates Acrobat or
Adobe Reader. JavaScript can also be added to the mix.

The Acrobat Core API


The core API consists of a set of methods that operate on objects. The objects have types
and encapsulate their data. This object orientation is a conceptual model, implemented
using a standard ANSI C-programming interface. Methods are C functions; objects are
opaque data types. The core API is supported on Microsoft 32-bit Windows, Apple
Macintosh, and UNIX platforms.
The core API methods are organized into the hierarchy shown in Figure 1.2.

22 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Overview
1
The Acrobat Core API

FIGURE 1.2 Overview of Core API

Acrobat Viewer (AV) Layer


(menu selections, other user-level actions)

Acrobat Support
Portable Document (PD) Layer (AS)
(bookmarks, pages, thumbnails, annotations, ...)
(file access,
platform-
independent
PDFEdit PDSEdit utilities, callbacks,
(page content) (structure info) exceptions, ...)

Cos Layer
(strings, numbers, dictionaries, ...)

Acrobat Viewer Layer


The Acrobat Viewer (AV) layer (also known as AcroView or AV Model) deals with the Acrobat
or Adobe Reader application. Its methods allow plug-ins to manipulate components of
Acrobat or the Adobe Reader application itself, such as menus and menu items.
NOTE: The AV layer is not available to users of the PDF Library.
Portable Document Layer
The Portable Document (PD) layer (also known as PDModel) provides access to
components of PDF documents. Its methods allow plug-ins and PDF Library applications to
manipulate document components such as document pages and annotations. Closely
related to the PD layer are two method groups, each of which controls a different aspect of
a PDF document:
PDFEdit methods deal with physical representation of a PDF document. More
specifically, PDFEdit methods treat page content as a list of objects whose values and
attributes a plug-in or PDF Library application can modify. The methods allow your
plug-in or PDF Library application to read, write, edit, and create page contents and
page resources, which may contain fonts, images, and so on.
PDSEdit methods deal with the logical structure of a PDF document. A PDF documents
logical structure is built independently of its physical representation, with pointers from
the logical structure to the physical representation, and the reverse. PDSEdit methods
store the logical structure information. They allow your plug-in or PDF Library
application to access PDF files by means of a structure tree. Having logical structure in
PDF files facilitates navigating, searching, and extracting data from PDF documents. For

Acrobat and PDF Library API Overview 23


Acrobat and PDF Library API Overview
1
Core API Objects

example, PDSEdit methods can obtain logically-ordered content, independently of


drawing order.
Acrobat Support
The Acrobat Support (AS) layer provides platform-independent utility functions and allows
plug-ins and PDF Library applications to override the built-in file-handling mechanisms.
Cos Layer
The Cos Object System (Cos) layer provides access to the building blocks used to construct
documents. Cos methods allow plug-ins and PDF Library applications to manipulate low-
level data in a PDF file, such as dictionary and string objects.
Platform-Specific Methods
In addition to the method groups represented in Figure 1.2, the core API includes
platform-specific plug-in utilities to handle issues that are unique to Macintosh, Windows
and UNIX platforms.

Core API Objects


Most objects accessible by AV and PD layer methods are opaque. They are, in general,
neither pointers nor pointers to pointers. They provide equivalent functionality in that they
merely reference an objects data rather than containing it. They cannot reliably be
syntactically considered a void *. If you assign one object to another variable, both
variables affect the same internal object.
Typically objects are named using the following conventions. There are exceptions. For
example, not all pointers to structures end in P. However, your familiarity with the
conventions described here should help you recognize the types when you encounter
them in the Acrobat SDK documentation.
The name of the concrete definition for a complex type ends in Rec, for record.
Typically, a pointer to simple or complex type ends in P, for pointer.
Opaque types do not contain a P suffix. For example, a PDDoc object references a PDF
document.
Three names identify complex types that provide callback methods:
Monitor: Aset of callbacks for an enumeration method (also used for
ProgressMonitor)
Server: An implementation for a service added by a plug-in
Handler: An implementation for a subtype of object handled by a plug-in
Callback method names typically contain the suffix Proc, for procedure.

24 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Overview
1
Core API Methods

Core API Methods


There are several types of methods in the core API. See the Acrobat abd PDF Library API
Reference for complete information on all methods.
Method names generally are of the form:
<layer><object><verb><thing>,
where
layer identifies the methods layer (AV for Acrobat Viewer, PD for Portable Document,
Cos for Cos, and AS for Acrobat Support)
object identifies the object upon which the method acts (for example, menu, window,
font, bookmark, annotation, dictionary, string, or file)
verb specifies an action such as Get, Set, Acquire, Release, Create, New, and
Destroy. See Table 1.1 for a list of the most common verbs in method names.
thing Is specific to each method, usually an object of the operation. May not always be
present.

TABLE 1.1 Verbs in API method names

New Creates a new unattached object. Example: AVMenuNew.


AddNew Creates a new object using the specified parameters and adds the new
object to the current object. Example: PDBookmarkAddNewChild.
Add Adds the second object as a child to the current object. Example:
PDBookmarkAddChild.
Create Creates a new object of a given type. Example: PDDocCreatePage.
Destroy Destroys the specified object and releases its resources immediately.
Example: PDBookmarkDestroy.
Open Opens an object from storage or a stream. Example:
AVDocOpenFromFile.
Close Destroys an object that was opened. Closes the underlying storage or
stream. Example: ASFileClose.
Acquire Obtains a shareable resource from a parent object. Or, increments a
reference counter for an object. The shared object is not destroyed until all
acquirers have released it. Example: AVMenuItemAcquire.
Release Releases a shared object. Example: PDPageRelease.
Delete Removes the second object from the current object and destroys the
second object. Example: PDDocDeletePages.

Acrobat and PDF Library API Overview 25


Acrobat and PDF Library API Overview
1
Core API Methods

TABLE 1.1 Verbs in API method names

Remove Removes the second object from the current object but does not destroy it.
Example: AVMenuRemove.
Get Retrieves an attribute of the object. Example: AVWindowGetTitle
Set Sets an attribute of the object. Example: PDAnnotSetFlags. (Note: Cos
uses the verb Put).
Is Retrieves a boolean attribute of the object. Example:
PDBookmarkIsOpen.
Enum Enumerates the specified descendant objects of the current object.
Example: PDDocEnumFonts.

While many of the API method names follow this form, there are exceptions. Conversion
methods, for example, are of the form: <layer><object><source_object>to<dest_object>
An example is AVPageViewPointToDevice.
Get and Set methods are used for getting and setting object attributes. Each object type
has zero or more attributes. For example, an annotation object (PDAnnot) contains
attributes such as color and date. You can obtain and modify the value of an objects
attributes using methods such as PDAnnotGetColor and PDAnnotSetDate.
In some cases, the return value of a Get method is another object. For example,
AVDocGetAVWindow returns an AVWindow object corresponding to a specified AVDoc.
Other methods that return objects have the word Acquire in their name. These methods
are always paired with a corresponding Release method, and have the additional side
effect of incrementing or decrementing a reference count. The core API uses
Acquire/Release methods, for example, to determine whether or not it is safe to free a
memory structure representing an object.
If you use an Acquire method to obtain an object, you must subsequently use the
Release method to correctly update the reference counter, as shown here:
PDDoc doc;
PDPage page;

doc = PDDocOpenFromASFile ("AFILE.PDF", NULL, TRUE);


page = PDDocAcquirePage (doc, 42);

/* Now were done with page */


PDPageRelease (page);
In the code above, note that the PDPage is acquired through the document that contains
it (using PDDocAcquirePage), and is released using PDPageRelease. Failure to match
Acquire/Release pairs generally results in Acrobat complaining that a document
cannot be closed due to non-zero reference counts.
Because the core API does not keep track of objects that do not have Acquire/Release
methods, there is no way for Acrobat plug-ins to know when such objects are being used,

26 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Overview
1
Data Types

and when they can be deleted safely. For this reason, the API provides validity testing
methods your plug-in can use to determine whether or not an object previously obtained
using a Get method is still usable. IsValid typically is included in the name of a validity
testing method, for example PDAnnotIsValid. You can check if an object has an
associated validity testing method by looking up the object in the Objects section in the
Acrobat and PDF Library API Reference.

Data Types
The core API uses five types:
Scalar Types
Simple Types
Complex Types
Opaque Types
Cos Objects

Scalar Types
Scalar (non-pointer) types are based on underlying C language types, but have
platform-independent bit sizes. They are defined in the header file CoreExpT.h. All scalar
types are AS layer types.
For portability, enumerated types are defined using a type of known size such as
ASEnum16.
Table 1.2 lists and describes the scalar types.

TABLE 1.2 Scalar types

Size
Type (in bytes) Description
ASBool 2 boolean

ASUns8 1 unsigned char

ASUns16 2 unsigned short

ASUns32 4 unsigned long

ASInt8 1 char

ASInt16 2 signed short

ASInt32 4 signed long

Acrobat and PDF Library API Overview 27


Acrobat and PDF Library API Overview
1
Data Types

TABLE 1.2 Scalar types

ASInt64 8 signed long

ASEnum8 1 enum (127 values)

ASEnum16 2 enum (32767 values)

ASFixed 4 fixed point integer, 16 bits for


mantissa and 16 bits for
fractional part
ASSize_t 4 size of objects (as in size_t)

Named Numeric Types


Acrobat 6.0 introduced named cover types that are used in place of generic numeric types
in methods and data structures. This change was intended to support a future change from
16-bit to 32-bit values. For example:
ASArraySize
ASByteCount
AVDevCoord
AVDevSize
AVScreenCoord
Currently, the change is entirely cosmetic; that is, methods and data can be compiled
without error if they still use the generic types. However, future releases may conditionally
compile the named types (as 16-bit or 32-bit values) depending on the release version. It is
recommended that you update your code to use the new named types.
For complete details of the named numeric types, see the Acrobat and PDF Library API
Reference.

Simple Types
Simple types represent abstractions such as a rectangle or matrix. These objects have well-
known fields that are not expected to change.
Examples of simple types are:
ASFixedRect
ASFixedMatrix
AVRect32
NOTE: Two different coordinate systems are used for rectangles. See Understanding
Coordinate Systems on page 30 for details.

28 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Overview
1
Names Without ASAtoms

Complex Types
Complex types are structures that contain one or more fields. They are used in situations
such as the following:
To transfer a large number of parameters to or from a method. For example, the API
method PDFontGetMetrics returns font metrics by filling out a complex structure
(PDFontMetrics).
To define a data handler or server. For example, your plug-in must provide a complex
structure filled out with callback methods (AVAnnotHandlerRec)when it intends to
register an annotation handler.
Because a complex type may change over time (by adding new fields or obsoleting old
ones), the size of the type is specified either as the first field of the type or as a separate
parameter to a method. A core API method can examine this field to determine whether a
new callback method is available, or whether a new data field should be filled out.

Opaque Types
Many methods in the core API hide the concrete C-language representation of data
structures from plug-ins. Most of these methods take an object and perform an action on
that object. The objects are represented as opaque types.
Examples of opaque objects are PDDoc and AVPageView.

Cos Objects
A Cos object in the core API (type CosObj) refers to its corresponding Cos object in the
PDF document. Cos objects are represented as opaque 8-byte structures. They have
subtypes of boolean, integer, real, name, string, array, dict, and stream.

Names Without ASAtoms


ASAtoms are normally used to hold strings. However, ASAtoms cannot be deleted, and for
very large files and for Acrobat processes running over a long period of time, it is possible to
exceed the 16-bit limit on ASAtoms.
With Acrobat 7, developers are encouraged to use new Cos-level methods that address this
problems. Using the new APIs, you can dramatically reduce the use of ASAtoms in the Cos
layer by allocating and freeing strings. The new APIs are generally more efficient than the

Acrobat and PDF Library API Overview 29


Acrobat and PDF Library API Overview
1
Understanding Coordinate Systems

old APIs. These APIs, along with the methods they replace, are listed in the following table
and are described in detail in the Acrobat and PDF Library API Reference.

New Cos-Level Method to Replace


ASAtoms Old Method Replaced
CosNewNameFromString CosNewName
CosCopyNameStringValue ASAtomGetString
CosDictGetKey CosDictGet
CosDictKnownKey CosDictknown
CosDictPutKey CosDictPut
CosDictRemoveKey CosDictRemove
CosDictGetKeyString CosDictGet
CosDictKnownKeyString CosDictKnown
CosDictPutKeyString CosDictPut
CosDictRemoveKeyString CosDictRemove

For example, instead of using:


ASAtom nameAtom = CosNameValue(cosObj);
Use:
char * myString;
myString = CosCopyNameStringValue (cosObj, NULL)

Understanding Coordinate Systems


The core API defines two coordinate systems: user space and device space. In addition, some
methods make use of a platforms native coordinate system, which is known as machine
port space. This section describes each of these coordinate systems.

User Space
User space specifies coordinates for most objects accessed using PD layer methods. It is the
coordinate system used within PDF files. Figure 1.3 shows the user space coordinate
system. In the figure, as in PDF, the media box is the rectangle that represents that pages
size (for example, US letter, A4). The crop box is an optional rectangle that is present if the
page has been cropped (for example, using the Document -> Crop Pages menu item in
Acrobat).

30 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Overview
1
Understanding Coordinate Systems

FIGURE 1.3 User Space Coordinate System

Media Box

Crop Box

(0,0)

The default origin of the user space coordinate system is the lower left corner of a pages
media box. The value of the x-coordinate increases to the right, and the value of the
y-coordinate increases upward. Coordinates are represented as fixed point numbers, and
rectangles are of type ASFixedRect.

Device Space
Device space specifies coordinates in screen pixels. See Figure 1.4. Plug-ins use this
coordinate system when calling AV layer methods to specify the screen coordinates of
windows.
NOTE: Device space coordinates generally are not equal to points. One point is
approximately 1/72 of an inch. Pixels and points are only nearly equivalent when the
monitor has a resolution of 72 dpi and the zoom factor is 1.0.

Acrobat and PDF Library API Overview 31


Acrobat and PDF Library API Overview
1
Understanding Coordinate Systems

FIGURE 1.4 Device Space Coordinate System

Aperture

(0,0)

Crop Box

Media Box

Device space defines an aperture as that portion of the Acrobats window in which the PDF
file is drawn. The origin of the device space coordinate system is at the upper left corner of
the visible page on the screen. The value of the x-coordinate increases to the right, and the
value of the y-coordinate increases downward. Coordinates are represented as integers,
and rectangles are of type AVRect.
NOTE: The upper left corner of the visible page is determined by the intersection of a
pages PDF crop box and media box. As a result, the device space coordinate system
changes when the cropping on a page changes.

Translating between User Space and Device Space


Sometimes a plug-in must translate user space coordinates to device space, and vice versa.
Say, for example, you want your plug-in to draw a rectangle on top of an annotation. You
can get an annotations bounding rectangle with PDAnnotGetRect. This rectangle is in
user space, the coordinates of the PDF file, and is invariant of the view of the PDF file. You
can draw a rectangle with the AVPageViewDrawRect method, but because this method
is an AV layer method, it requires a rectangle in device space coordinates. The

32 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Overview
1
Understanding Coordinate Systems

AVPageViewRectToDevice method translates a rectangles coordinates from user


space to device space, so the following code would draw the rectangle:
ASFixedRect userRect;
AVRect deviceRect;

PDAnnotGetRect(anAnnot, &userRect);
AVPageViewRectToDevice(pageView, &userRect, &deviceRect);
AVPageViewDrawRect(pageView, &deviceRect);
If more than one page is displayed, as in the continuous display modes of Acrobat,
coordinates in user space may be ambiguous. The problem is that user space coordinates are
relative to a page, and more than one page is displayed. This raises the question of which
page AVPageViewRectToDevice would use. To specify the page, call the
AVPageViewSetPageNum method first. The code shown above now appears as:
ASFixedRect userRect;
AVRect deviceRect;

AVPageViewSetPageNum(pageView, annotPageNum);
PDAnnotGetRect(anAnnot, &userRect);
AVPageViewRectToDevice(pageView, &userRect, &deviceRect);
AVPageViewDrawRect(pageView, &deviceRect);

Machine Port Space


You would use Machine port space if, for example, your plug-in needs to draw on the screen
using QuickDraw (on the Macintosh platform) or GDI (on the Windows platform). Machine
port space is shown in Figure 1.5.
If an objects coordinates are specified in user space and a plug-in needs to draw the object
to the machine port, it must translate the points through the matrix obtained from
AVPageViewGetPageToDevMatrix. On Macintosh only, it must also subtract the
left field of the windows aperture from the x-coordinate and subtract the top field from
the y-coordinate. The plug-in can then draw using GDI or QuickDraw.
If device space changes, any acquired machine ports are not updated to track device space;
their coordinate systems are still set to the device space in effect when the ports were
acquired.

Acrobat and PDF Library API Overview 33


Acrobat and PDF Library API Overview
1
Using Rectangles and Quadrilaterals

FIGURE 1.5 Machine Port Space Coordinate System


(0,0)

Media Box

Crop Box

Using Rectangles and Quadrilaterals


Rectangles (rects) and quadrilaterals (quads) are used in the core API. Both are geometric
shapes with four rectilinear sides. A rectangle is specified by two corner points, and the
rectangles sides are always vertical and horizontal. A quad is specified by all four corner
points, and the sides can have any orientation.
A plug-in should use rectangles as frequently as possible, because it can specify them with
half as much data as a quad requires, and they are processed more efficiently. A plug-in
should use quads when necessary, though; for example, to specify the box containing a
rotated word.

Handling Exceptions
In general, methods do not provide return values but instead raise exceptions when errors
occur. You can write exception handlers to catch and handle exceptions at different points in
your plug-in. Acrobat contains a default handler to deal with otherwise uncaught
exceptions.
Chapter 13, Handling Errors describes exception handling in detail.

34 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Overview
1
Adding New Object Types

Adding New Object Types


Plug-ins can extend the range of objects that Acrobat understands. For example, they can
define new types of annotations and new tools. A plug-in generally adds new types by
passing to Acrobat a structure (known as a handler) containing a number of function
pointers. The number of function pointers and their purpose depend on what object a
plug-in is adding, but functions usually include those for creating, destroying, and drawing
the new object. Chapter 11, Handlers, describes each of the handlers a plug-in can add.

Storing Private Data in PDF Files


Plug-ins can store private data in PDF files, although private data must be stored in such a
way that the file can still be drawn by Acrobat. Adobe maintains a registry of private PDF
dictionary key names to reduce the possibility of a plug-ins key names conflicting with
names belonging to other plug-ins.
Private dictionary keys exist in three categories:
1. Specific keys that are proposed by third parties but are generally useful. Adobe
maintains a registry of these names.
2. Keys registered by third parties as well as keys whose prefix is registered that are
applicable only to a limited set of users. Adobe maintains a registry of these names and
prefixes. For more information on registering and using plug-in prefixes, see the Acrobat
SDK Plug-in Guide.
3. Keys that begin with a special prefix reserved by Adobe for private extensions. These
keys are intended for use in files that are never seen by other third parties, since these
keys may conflict with keys defined by others.
Contact the Adobe Solutions Network Web site to register private data types.

Data Type Changes in Acrobat 6


In Acrobat 6, there were extensive changes to the data types of existing APIs. Some of these
changes were to the fundamental data types, and some were new abstract types that
clarified the meaning and use of parameters.
16-to-32 Bit Changes
The most profound changes to the existing API was the migration of most 16-bit integer
data types to 32-bits for use with Acrobat 6. This included, for example, the changing of

Acrobat and PDF Library API Overview 35


Acrobat and PDF Library API Overview
1
Data Type Changes in Acrobat 6

many ASInt16s to AVDevCoords and other variables that are defined as 16- or 32-bit,
depending on the level of the SDK:
#if !defined(ACRO_SDK_LEVEL) || (ACRO_SDK_LEVEL < 0x00060000)
typedef ASInt16 AVSDKDependentInteger;
#else
typedef ASInt32 AVSDKDependentInteger;
AVSDKDependentInteger is then used to set the following variables, which were
retrofitted into the appropriate existing APIs, providing the compatibility layer.
AVDevSize Denotes a size in the page view's device space.
AVDevCoord Contains an x or y coordinate in the page view's device space.
AVWindowCoord Contains an x or y coordinate in the windows space, where (0, 0) is at
the top left and units are in pixels.
AVScreenCoord Contains an x or y coordinate in the screen space, where (0, 0) is at
the top left of the main monitor.
ASText Object Changes
Most pointers to character strings were replaced with the ASText object.
New Abstract Types
New abstract types were retrofitted into the API to clarify the meaning and use of
parameters. These are listed separately in the API Changes for version 6 section of this
document. See Appendix G, API Changes. These types are referred to as cosmetic types
since they can be compiled without error if the generic types are still used.

Support for Backward Compatibility


To support the changes to the data types in the API, mechanisms were provided to allow
backward compatibility.
ACRO_SDK_LEVEL Macro
The ACRO_SDK_LEVEL macro is set to the version of the API with which you want to
compile. This macro is primarily used in two new header files, AVExpTObsolete1.h and
AVExpTObsolete2.h. These files contain types used in former versions of Acrobat. By
defining ACRO_SDK_LEVEL to 0x00060000, you use the latest types and routines while
retaining the ability to compile existing plug-in code without changes.
AVCompat.cpp File
The AVCompat.cpp file is also used to provide backward compatibility by supporting the
passing of current structures and callbacks to older versions of Acrobat. AVCompat.cpp is
used to provide backward compatibility by converting new structures, callbacks, and calls
into old structures, callbacks, and calls and converting the results back to the new
structures.
NOTE: If you do not need to run on Acrobat 5 or earlier, there is no reason to add
AVCompat.cpp to your plug-in.

36 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Overview
1
APIs Specific to the PDF Library

Testing With the TEST_OLD_VERSION Macro


In PIMain.c, the macro TEST_OLD_VERSION can be set to test a plug-ins compatibility
with earlier versions of Acrobat. It is set to 0xFFFFFFFF by default, which is the value
required for shipping Acrobat 6 plug-ins. However, the macro can be set to previous
versions of Acrobat to simulate those execution environments. For example, it can be set to
0x00050000 to simulate Acrobat 5.0.
NOTE: While the simulation approximates earlier Acrobat execution environments, it is not
the same as the real thing. A plug-in should still be tested against the actual
products before shipping.

APIs Specific to the PDF Library


The PDF Library supports a small number of APIs that are specific to it. These APIs include
the following (see the Acrobat and PDF Library API Reference for detailed descriptions):

ASAtomGetCount
ASFileSysGetDefaultTempPath
ASFileSysSetDefaultTempPath
ASPurgeMemory
ASSetTempFileSys
AVExtensionMgrRegisterNotification
AVExtensionMgrUnregisterNotification
PDDocPrintPages
PDFLGetCoreHFT
PDFLGetFlags
PDFLGetInitCount
PDFLGetVersion
PDFLibraryRegisterNotification
PDFLibraryUnregisterNotification
PDFLInit
PDFLPrintDoc
PDFLTerm

Acrobat and PDF Library API Overview 37


Acrobat and PDF Library API Overview
1
APIs Specific to the PDF Library

PDFontDownloadContextCreate
PDFontDownloadContextDestroy
PDFontPSEmitGlyphsIncr
PDFontPSFlushIncrGlyphList
PDFontPSGetComponentFontList
PDFontStreamPS
PDFontWasExtracted
PDFontWasFauxed
PDPageDrawContentsPlacedToWindow
PDPageDrawContentsToMemory
PDPageEmitPSOrient
PDPageGetSize
PDPrefGetAntialiasLevel
PDPrefGetBlackPointCompensation
PDPrefGetGreekLevel
PDPrefGetSuppressICCSpaces
PDPrefGetUseOutputIntents
PDPrefSetAntialiasLevel
PDPrefSetBlackPointCompensation
PDPrefSetGreekLevel
PDPrefSetSuppressICCSpaces
PDPrefSetUseLocalFonts
PDPrefSetUseOutputIntents
PDPrefSetWorkingCMYK
PDPrefSetWorkingGray
PDPrefSetWorkingRGB

38 Acrobat and PDF Library API Overview


2 PDF Library and Plug-in
Applications

The Acrobat core API, the PDF Library, and the extended APIs allow plug-ins and PDF
Library applications to manipulate PDF file contents, to enhance and customize Acrobat
and Adobe Reader to perform specialized functions, or to better integrate with existing
environments. This chapter briefly describes some of the many possibilities and refers you
to the corresponding sections of this document. For more information on applications, see
Acrobat SDK Users Guide.
NOTE: Adobe may supply implementations of some of these applications with its products.

Controlling Acrobat Professional, Acrobat Standard, and Adobe


Reader
Plug-ins can control Acrobat and Adobe Reader almost as if it were the user. All menu
commands are available, plus additional functionality normally available from keyboard
and mouse operations. Acrobat can be instructed to run in the background or while it is
minimized as an icon.
For a discussion of menus, see
AVMenu on page 280
AVMenubar on page 282
AVMenuItem on page 283
For a discussion of tool buttons, see
AVTool on page 295
AVToolBar on page 295
AVToolButton on page 296

Drawing Into Another Window


Plug-ins can have Acrobat draw into an arbitrary window, allowing plug-ins to support PDF
file viewing within their own user interface.
NOTE: It is also possible to draw into an arbitrary window using the interapplication
communication (IAC) support present in Acrobat, as described in Acrobat IAC
Overview and Acrobat IAC Reference. If you are interested in drawing into your own
window, you should also read those documents to understand whether IAC or a
plug-in is more appropriate for your needs.

Acrobat and PDF Library API Overview 39


PDF Library and Plug-in Applications
2
Indexed Searching

When a plug-in redirects Acrobats or Adobe Readers rendering into another window, the
plug-in must handle mouse and keyboard events, make API calls for scrolling, change
pages, zoom, or otherwise alter the view of the PDF file.
For more information, see the PDPageDrawContentsToWindow method in PDPage
on page 341.

Indexed Searching
Indexed searching enables you to catalog, index, search, and highlight text in PDF files.
Regardless of document file format, simple sequential text searching is generally too time-
consuming for long documents, and completely inadequate for searching a collection of
documents.
Text retrieval systems overcome this problem by building a search index containing
information on the location of all words in each document in the collection. A search
system uses this index to determine which documentsand word locations within those
documentssatisfy a given query. The search system then allows a user to browse the
found documents, optionally displaying or highlighting the hits, or matching items.
The search and catalog extended APIs are often used for cataloging and searching. See
Chapter 4, Overview of the Acrobat Extended APIs, for more information.

Steps in the Acrobat Products Indexed Searching


The Acrobat core API enables plug-ins to extract the data necessary to build search indexes,
open documents in Acrobat, and highlight words on pages. Searching is not limited to
page text. Text in annotations, bookmarks, and document-level attributes like Title and
Subject can all be indexed and searched.
There are three steps to an indexed search of a PDF document. You can use one application
for all three, or a separate application for each step.
1. Adding document-level information (optional)
In this step, you add to PDF files document-level information such as title, subject,
author, and keywords. This Document Info allows users to locate specific documents
easily, much like the card catalog in a paper-based library. Use of document-level fields
to enhance searching is known as fielded search in many document retrieval systems.
Store document-level attributes in the Info dictionary in the PDF file format. Plug-ins can
use the PDDocGetInfo and PDDocSetInfo methods to read and modify document
info fields.
Acrobat products, version 2.0 and higher, provide several ways to add document info
fields to PDF files. The Distiller application and PDFWriter allow these fields to be set
while generating a PDF file, and Acrobat allows users to edit Document Info fields.

40 Acrobat and PDF Library API Overview


PDF Library and Plug-in Applications
2
Indexed Searching

2. Indexing
Indexing applications use the PDWordFinder object to extract text from PDF files and
build a search index in a table or file. Through PDWordFinder, plug-ins can obtain the
character or word offset of each word in a PDF file, and length of each word. A plug-in
can use the PDDocGetInfo method to obtain document-level attributes for it to
index.
3. Searching and displaying search results
Through a user interface or some other means, a search application:
Obtains a word or phrase to be found.
Uses the search index and other API functions to open documents in Acrobat, display
appropriate pages, and highlight targeted words.
Highlighting is limited to page text; text in an annotation or a bookmark cannot be
highlighted. An plug-in can, however, select and show any annotation or bookmark
in the document using the PDF files Document Info fields as search criteria.

Extracting Text
The core API does not specify or constrain indexing applications. Your plug-in can create
search indexes as desired. For example, some plug-ins add the search index filename to the
PDF files Info dictionary so that intra-document searching can be performed without the
user having to specify the location of the search index.
Text is extracted in the same order as it occurs in the pages display list. This often is not the
order in which a user would read the text. The application in which the original file was
created determines the order in which text appears in the PDF file; different applications
differ greatly.
NOTE: The order in which text appears in a file can affect phrase searches, proximity
searches, and the operation of next occurrence functions.
In addition, individual words may be split into two or more pieces because PDF creators
may emit kerned or differently-styled pieces of words at a different point in the page-
generation sequence. The core APIs word extraction algorithm attempts to reconstruct
words by looking at the position and spacing of individual characters, and even handles the
case in which words are hyphenated across lines.
In addition to the text of a word, plug-ins can also obtain the character and word offset
from the beginning of the page and the number of characters in the word. This information
is used to highlight the appropriate words in Acrobat during a search.
PDStyle on page 347, PDWord on page 352, and PDWordFinder on page 355 describe
the methods to obtain word, font, size, location and style information from a document.

Acrobat and PDF Library API Overview 41


PDF Library and Plug-in Applications
2
Modifying File Access

Modifying File Access


Plug-ins can provide their own file access procedures that read and write data when
requested by the Acrobat core API. Using this capability, a plug-in can enable PDF files to be
read from on-line systems, email, document management, or database programs.
In addition, plug-ins and PDF Library applications can allow other file formats to be
imported to, or exported from, PDF using custom file access procedures. For importing, the
random-access nature of PDF files makes it probable that the plug-in will have to write a
complete PDF file to a local disk and use the core API to open that file.
For a discussion, see
ASFileSys on page 241
File Specification Handlers on page 435

Creating New Annotation Types


Plug-ins can create their own annotation types, including any data they need. For example,
a custom annotation type might allow a user to draw (not just type) in an annotation,
provide support for multiple fonts or text styles, or support annotations that can only be
viewed by specific users.
For more information on annotations, see PDAnnot on page 307.
For information on adding a handler for a new annotation type, see Annotation Handlers
on page 430.

Accessing the Info Dictionary


In addition to retrieving and setting values for the four standard fields in the PDF Info
object, plug-ins and PDF Library applications can add, modify, query, and delete fields of
their own.
For more information, see the PDDocGetInfo and PDDocSetInfo methods in PDDoc
on page 313.

Adding Private Data To PDF Files


Plug-ins can add their own private data to PDF files, subject to the constraint that the data
added must not interfere with the viewing of the PDF file by a running version of Acrobat or
Adobe Reader that does not have the plug-in needed to interpret the private data.
For additional information, see Chapter 10, Cos Layer.

42 Acrobat and PDF Library API Overview


PDF Library and Plug-in Applications
2
Popular PDF Library Applications

Popular PDF Library Applications


The following table summarizes the most popular PDF Library applications.

Manipulation / Editing
Rendering and Viewing
Printing
Text extraction
Content Extraction (Non-textual)
Creation
Fonts
Security and Encryption
Metadata
Linearization and Optimization
Pre-press
Forms

Acrobat and PDF Library API Overview 43


PDF Library and Plug-in Applications
2
Popular PDF Library Applications

44 Acrobat and PDF Library API Overview


3 Acrobat and PDF Library API
Objects

This chapter lists and describes all Acrobat and PDF Library objects and the methods
associated with them. All setters and getters are listed; these are the methods used to
set and get member variables and data structures. Acrobat extended APIs share these
objects. Table 3.1, Acrobat and PDF Library API Objects, presents a summary of all Acrobat
and PDF Library objects, followed by a detailed description of each.

TABLE 3.1 Acrobat and PDF Library API Objects

AS Layer ASAtom ASFileSys ASUUID


ASCab ASPathName HFT
ASCallback ASPlatformPath HFTServer
ASDate ASStm MDFile
ASExtension ASText
ASFile ASTimeSpan
AV Layer AVActionHandler AVMenubar AVToolBar
AVAnnotHandler AVMenuItem AVToolButton
AVApp AVPageView AVUndo
AVCommand AVSweetPea AVWindow
AVDoc AVSys
AVMenu AVTool
Cos Layer CosArray CosFixed CosObj
CosBoolean CosInteger CosObjCollection
CosDict CosName CosStream
CosDoc CosNull CosString

Acrobat and PDF Library API Overview 45


Acrobat and PDF Library API Objects
3

TABLE 3.1 Acrobat and PDF Library API Objects

PD Layer PDAction PDLinkAnnot PDTextAnnot


PDAnnot PDNameTree PDTextSelect
PDBead PDNumTree PDThread
PDBookmark PDOCConfig PDThumb
PDCharProc PDOCContext PDTrans
PDDoc PDOCG PDViewDestination
PDFileSpec PDOCMD PDWord
PDFont PDPage PDWordFinder
PDForm PDPageLabel PDXObject
PDGraphic PDPath
PDImage PDStyle
PDInlineImage PDText
PDFEdit PDEBeginContainer PDEExtGState PDEShading
PDEBeginGroup PDEFont PDESoftMask
PDEClip PDEForm PDEText
PDEColorSpace PDEGroup PDETextItem
PDEContainer PDEImage PDEUnknown
PDEContent PDEImageFlate PDEXGroup
PDEDeviceNColors PDEImageJPX PDEXObject
PDEElement PDEObject PDSysEncoding
PDEEndContainer PDEPath PDSysFont
PDEEndGroup PDEPattern
PDEPlace
PDEPS
PDSEdit PDSAttrObj
PDSClassMap
PDSElement
PDSMC
PDSRoleMap
PDSTreeRoot

46 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
AS Layer

A S L ayer
Acrobat Support layer. Platform-independent objects and utility functions used
throughout the API.

ASAtom
A hashed token used in place of strings to optimize performance (it is much faster to
compare ASAtoms than strings). Many methods return ASAtoms.
Obtaining
ASAtomFromString
Attributes

Get Set
ASAtomGetString ASAtomFromString

Validity testing
ASAtomExistsForString

Acrobat and PDF Library API Overview 47


Acrobat and PDF Library API Objects
3
AS Layer

ASCab
ASCab objects (cabinets) can be used to store arbitrary key-value pairs. The keys are
always null-terminated strings containing only low-ASCII alphanumeric characters and
spaces (ASCII character 32). Key names cannot begin or end with a space.
Every time you place a non-scalar value inside a cabinet you are handing that value to the
ASCab implementation to managethat is, putting a value in a cabinet is always a hand-
off operation. For example, if you create an ASText object and add it as a value in an
ASCab, the ASText object is no longer managed by you; it is managed by the ASCab. The
ASCab will destroy the ASText object when its associated key is removed or the keys
value is over-written. Pointer values are a special case discussed in more detail below.
The routine naming convention is as follows:
Get routines return a value. These objects are owned by the ASCab and should not be
destroyed by the caller of Get.
GetCopy routines make a copy of the data; the GetCopy client owns the resulting
information and can modify it at will; he is also responsible for destroying it.
Detach routines work the same way as Get routines but the key is removed from the
ASCab without destroying the associated value that is passed back to the client of
Detach. The client is responsible for destroying the returned object.
Normally pointers are treated the same way as scalars; the ASCab passes the pointer value
back and forth but doesn't manage the data to which it points. This all changes if the
pointer has an associated destroyProc. If the destroyProc is set, the ASCab will reference
count the pointer to track how many times the pointer is referenced from any ASCab (for
example, the reference count will be bumped up whenever the pointer is copied via
ASCabCopy or added to another ASCab via ASCabPutPointer) and will destroy the
data associated with the pointer when the ref count goes to 0. The data is destroyed by
calling the destroyProc. Detaching a pointer removes one reference to the pointer without
ever destroying the information pointed to. ASCabDetachPointer returns a separate
value indicating whether the pointer can safely be destroyed by the client or is still referred
to by other key-value pairs inside any ASCabsthat is, whether the reference count went
to zero when the pointer was detached from the ASCab.
Any of the ASCab API's can take a compound name: a string consisting of multiple keys
separated by the colon (:) characterfor example, Grandparent:Parent:Child:Key. The
implementation will burrow down through such a compound string until it reaches the
most deeply nested cabinet. Also, any of the Put routines can take a NULL key name. If
the key name is NULL, the routine creates a new, numeric key name. If the cabinet is empty,
the first generated key name will be 0 and subsequent names will increase in ascending
order. This is useful when treating an ASCab as a bag of unnamed items, or when adding
an ordered list of items to an empty ASCab.
Obtaining:
ASCabNew
ASCabFromEntryList

48 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
AS Layer

ASCabCopy
Disposing:
ASCabDestroy
Enumeration:
ASCabEnum
ASConstCabEnum
Actions:
ASCabEqual
ASCabValueEqual
Attributes

Get Set
ASCabGetAtom ASCabPutAtom
ASCabGetBinary, ASCabPutBinary
ASCabGetBinaryCopy
ASCabGetBool ASCabPutBool
ASCabGetCab ASCabPutCab
ASCabGetDouble ASCabPutDouble
ASCabGetInt ASCabPutInt
ASCabGetPathNameCopy ASCabPutPathName
ASCabGetPointer ASCabPutPointer
ASCabGetPointerDestroyProc
ASCabGetPointerType
ASCabGetString, ASCabPutString
ASCabGetStringCopy
ASCabGetText ASCabPutText
ASCabGetType
ASCabGetUns ASCabPutUns
ASCabPutNull
ASCabKnown

Acrobat and PDF Library API Overview 49


Acrobat and PDF Library API Objects
3
AS Layer

Get Set
ASCabMakeEmpty
ASCabMunge
ASCabRemove
ASCabReadFromStream ASCabWriteToStream

50 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
AS Layer

ASCallback
Callbacks allow Acrobat or the PDF Library to call functions in an application or plug-in.
Obtaining
ASCallbackCreate
ASCallbackCreateNotification
ASCallbackCreateProto
ASCallbackCreateReplacement
Disposing
ASCallbackDestroy

Acrobat and PDF Library API Overview 51


Acrobat and PDF Library API Objects
3
AS Layer

ASDate
Date objects represent a particular date and time. All date objects are guaranteed to give
accurate representation of UTC time (not adjusted for leap seconds, as the addition of leap
seconds to the international calendar does not happen according to a well-defined rule).
Date objects are not guaranteed to represent local time accurately, because some
operating systems cannot always determine the prevailing daylight saving rule for the time
zone. However, the date object can be set to use the same rule as the operating system.
Obtaining
ASDateNew
ASDateDup
Disposing
ASDateDestroy
Attributes

Get Set
ASDateClear
ASDateCopy
ASDateGetLocalTime ASDateSetToCurrentLocalTime
ASDateGetTimeString ASDateSetTimeFromString
ASDateGetUTCTime ASDateSetToCurrentUTCTime
ASDateSetLocalTimeOffset
ASDateSetTimeFromRec

Actions
ASDateAddCalendarTimeSpan
ASDateAddTimeSpan
ASDateCalendarDiff
ASDateCompare
ASDateExactDiff
ASDateSubtractCalendarTimeSpan
ASDateSubtractTimeSpan

52 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
AS Layer

Declarations
ASCalendarTimeSpan
ASDateTimeFormat
ASTimeRec

Acrobat and PDF Library API Overview 53


Acrobat and PDF Library API Objects
3
AS Layer

ASExtension
An opaque pointer to an object that identifies a specific loaded client. An unique
ASExtension object is created for each client when it is loaded. If the client fails to
initialize, the ASExtension remains but is marked as inactive.
Obtaining
ASEnumExtensions
Attributes

Get Set
ASExtensionGetFileName
ASExtensionGetRegisteredName

54 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
AS Layer

ASFile
An opaque representation of an open file.
Obtaining
PDDocGetFile
ASFileSysOpenFile
ASFileFromMDFile
Attributes

Get Set
ASFileAcquirePathName
ASFileGetEOF ASFileSetEOF
ASFileGetFileSys
ASFileGetMDFile
ASFileGetOpenMode ASFileSetMode
ASFileGetPos ASFileSetPos
ASFileGetURL

Actions
ASFileClose
ASFileFlush
ASFileHardFlush
ASFileIsSame
ASFilePushData
ASFileRead
ASFileReopen
ASFileWrite
ASFileRegisterFileSys
ASFileUnregisterFileSys
Declarations
ASErrorCode
ASFileMode
ASFile Flags
ASFileMode Flags
ASFileStatus Flags

Acrobat and PDF Library API Overview 55


Acrobat and PDF Library API Objects
3
AS Layer

ASFileSys
A collection of functions that implement file system services, such as opening files, deleting
files, reading data from a file, and writing data to a file. Each ASFileSys provides these
services for one class of devices.
To create an ASFileSys, complete an ASFileSysRec structure.
Obtaining
ASGetDefaultFileSys
ASFileGetFileSys
ASFileGetFileSysByName
PDFileSpecGetFileSys
Attributes

Get Set
ASFileSysAcquireFileSysPath,
ASFileSysAcquireParent,
ASFileSysAcquirePlatformPath
ASFileSysCanPerformOpOnItem
ASFileSysCopyPath
ASFileSysCreatePathName
ASFileSysDIPathFromPath
ASFileSysPathFromDIPath
ASFileSysDisplayASTextFromPath,
ASFileSysDisplayStringFromPath
ASFileSysGetItemProps ASFileSysConvertCabToItemProps
ASFileSysGetItemPropsAsCab ASFileSysConvertCabToItemProps
ASFileSysConvertItemPropsToCab
ASFileSysGetNameFromPath,
ASFileSysGetNameFromPathAsASText
ASFileSysGetStorageFreeSpace
ASFileSysGetTempPathName
ASFileSysGetTypeAndCreator ASFileSysSetTypeAndCreator
ASFileSysURLFromPath

56 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
AS Layer

Get Set
ASFileSysFirstFolderItem, ASFileSysCreateFolder
ASFileSysNextFolderItem ASFileSysDestroyFolderIterator
ASFileSysRemoveFolder

Actions
ASFileRegisterFileSys
ASFileSysFlushVolume
ASFileSysOpenFile
ASFileSysPerformOpOnItem
ASFileSysReleasePath
ASFileSysRemoveFile
ASFileUnregisterFileSys
Declarations
ASFileStatus Flags
ASFileSysRec

Acrobat and PDF Library API Overview 57


Acrobat and PDF Library API Objects
3
AS Layer

ASPlatformPath
Description
An opaque object used to retrieve a platform-specific path object.
Obtaining
ASFileSysAcquirePlatformPath
Disposing
ASFileSysReleasePlatformPath
Attributes:

Get Set
ASPlatformPathGetCFURLRefRecPtr
ASPlatformPathGetCstringPtr
ASPlatformPathGetFSRefPtr
ASPlatformPathGetFSRefWithCFStringRefRecPtr
ASPlatformPathGetFSSpecPtr
ASPlatformPathGetPOSIXPathPtr

Declarations
CFURLRefRec_Ptr
Cstring_Ptr
FSRef_Ptr
FSRefWithCFStringRefRec_Ptr
FSSpec_Ptr
POSIXPath_Ptr

58 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
AS Layer

ASStm
A data stream that may be a buffer in memory, a file, or an arbitrary user-written procedure.
Typically used to extract data from a PDF file. When writing or extracting data streams, the
ASStm must be connected to a Cos stream.
Obtaining
ASFileStmRdOpen
ASFileStmWrOpen
ASMemStmRdOpen
ASProcStmRdOpenEx
ASProcStmWrOpen
CosStreamOpenStm
Disposing
ASStmClose
Actions
ASStmRead
ASStmWrite

Acrobat and PDF Library API Overview 59


Acrobat and PDF Library API Objects
3
AS Layer

ASText
An ASText object represents a Unicode string. ASText objects can also be used to
convert between Unicode and various platform-specific text encodings as well as
conversions between various Unicode formats (for example, UTF-16, UTF-8). Since it is
common for a Unicode string to be repeatedly converted to or from the same platform-
specific text encoding, ASText objects are optimized for this operationfor example,
they can cache both the Unicode and platform-specific text strings.
There are several ways of creating an ASText object depending on the type and format of
the original text data. The following terminology is used throughout this API to describe
the various text formats.
EncodedA multi-byte string terminated with a single 0 character and coupled with a
specific host encoding indicator. In the Macintosh OS, the text encoding is specified
using a script code. In the Windows OS, the text encoding is specified using a CHARSET
code. On Unix the only valid host encoding indicator is 0, which specifies text in the
platform's default Roman encoding. On all platforms Asian text is typically specified
using multi-byte strings.
ScriptTextA multi-byte string terminated with a single 0 character and coupled with
an ASScript code. This is merely another way of specifying the Encoded case; the
ASScript code is converted to a host encoding using ASScriptToHostEncoding.
UnicodeText specified using UTF-16 or UTF-8. In the UTF-16 case the bytes can be in
either big-endian format or the endian-ness that matches the platform and are always
terminated with a single ASUns16 0 value. In the UTF-8 case the text is always
terminated with a trailing 0 byte. Unicode refers to straight Unicode without the 0xFE
0xFF prefix or language and country codes that can be encoded inside a PDF
document.
PDTextA string of text pulled out of a PDF document. This will either be a big-endian
Unicode string pre-appended with the bytes 0xFE 0xFF or a string in
PDFDocEncoding. In the Unicode case, this string may have embedded language and
country identifiers. ASText objects strip language and country information out of the
PDText string and track them separately. See below for more details.
ASTexts can also be used to accomplish encoding and format conversions; you can
request a string in any of the formats specified above.
In all cases the ASText code attempts to preserve all characters. For example, if you
attempt to concatenate strings in separate host encodings the implementation may
convert both to Unicode and perform the concatenation in Unicode space.
When creating a new ASText object, or putting new data into an existing object, the
implementation will always copy the supplied data into the ASText object. The original
data is yours to do with as you will (and release if necessary).
The size of ASText data is always specified in bytesfor example, the len argument to
ASTextFromSizedUnicode specifies the number of bytes in the string, not the number
of Unicode characters.

60 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
AS Layer

Host encoding and Unicode strings are always terminated with a null character (which
consists of one null byte for host-encoded strings and two null bytes for Unicode strings).
You cannot create a string with an embedded NULL character even using the calls which
take an explicit length parameter.
The Getxxx calls return pointers to data held by the ASText object. You cannot free or
manipulate this data directly. The GetxxxCopy calls return data you can manipulate at will
and that you're responsible for freeing.
An ASText object can have language and country codes associated with it. A language
code is a 2-character ISO 639 language code. A country code is a 2-character ISO 3166
country code. In both cases the 2-character codes are packed into an ASUns16 valuethe
first character in bits 8-15, and the second character in bits 0-7. These language and
country codes can be encoded into a UTF-16 variant of PDText encoding using an escape
sequence; see Section 3.8 in the PDF Reference. The ASText calls will automatically parse
the language and country codes embedded inside UTF-16 PDText and will also author
appropriate escape sequences to embed the language and country codes (if present) when
generating UTF-16 PDText.
Obtaining
ASTextNew
ASTextCopy
ASTextDup
ASTextFromEncoded
ASTextFromInt32
ASTextFromPDText
ASTextFromScriptText
ASTextFromSizedEncoded
ASTextFromSizedPDText
ASTextFromSizedScriptText
ASTextFromSizedUnicode
ASTextFromUnicode
ASTextFromUns32
Disposing
ASTextDestroy
ASTextMakeEmpty
Actions
ASTextCat
ASTextCatMany
ASTextCmp

Acrobat and PDF Library API Overview 61


Acrobat and PDF Library API Objects
3
AS Layer

Attributes

Get Set
ASTextGetBestEncoding
ASTextGetBestScript
ASTextGetCountry ASTextSetCountry
ASTextGetEncoded, ASTextSetEncoded
ASTextGetEncodedCopy
ASTextGetLanguage ASTextSetLanguage
ASTextGetPDTextCopy ASTextSetPDText
ASTextGetScriptText, ASTextSetScriptText
ASTextGetScriptTextCopy
ASTextGetUnicode, ASTextSetUnicode
ASTextGetUnicodeCopy
ASTextIsEmpty
ASTextNormalizeEndOfLine
ASTextSetSizedEncoded
ASTextSetSizedPDText
ASTextSetSizedScriptText
ASTextSetSizedUnicode
ASTextReplace,
ASTextReplaceASCII,
ASTextReplaceBadChars

62 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
AS Layer

ASTimeSpan
Represents an exact time span, measured in seconds. The internal representation uses 64-
bit signed integers (to avoid the 2038 problem caused by 32-bit representation). Negative
timespans are allowed.
Obtaining
ASTimeSpanNew
ASTimeSpanDup
Disposing
ASTimeSpanDestroy
Attributes

Get Set
ASTimeSpanCopy
ASTimeSpanGetASInt32 ASTimeSpanSetFromASInt32
ASTimeSpanSet
ASTimeSpanSetFromString
ASTimeSpanNegate
ASCalendarTimeSpanAddWithBase
ASTimeSpanAdd
ASCalendarTimeSpanDiff
ASTimeSpanDiff

Actions
ASCalendarTimeSpanCompare
ASTimeSpanCompare

Acrobat and PDF Library API Overview 63


Acrobat and PDF Library API Objects
3
AS Layer

ASUUID
A universal unique identifier for the current user or the current session.
Obtaining
AVAppGetUUID
ASUUIDFromCString
ASUUIDGenFromHash
ASUUIDGenFromName
ASUUIDGenUnique
Actions
ASUUIDToCString
Declarations
AVAppUUIDType
ASUUID
ASUUIDMaxStringLen

64 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
AS Layer

HFT
A table of function pointers (actually callbacks) called a host function table. This is the
mechanism through which clients call methods in Acrobat or in other clients.
Obtaining
ASExtensionMgrGetHFT
HFTNew
HFTNewEx
Disposing
HFTDestroy
Attributes

Get Set
HFTGetReplacedEntry HFTReplaceEntry,
HFTReplaceEntryEx,
HFTUnreplaceEntry
HFTGetVersion

Validity testing
HFTIsValid
Declarations
HFTData
HFTEntry
HFTEntryReplaceable
HFT Values
ASVersion

Acrobat and PDF Library API Overview 65


Acrobat and PDF Library API Objects
3
AS Layer

HFTServer
Each HFT is serviced by an HFT server. The HFT server is responsible for handling requests
to obtain or destroy its HFT.
Obtaining
HFTServerNew
Disposing
HFTServerDestroy

66 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
AS Layer

MDFile
A file-system specific representation of an individual file. It uses the machines native
platform-specific data structure to represent a file. In the client API, it is primarily used by
Replacement FileSystem implementors. A replacement file system can choose its own
implementation of an MDFile that is mapped by Acrobat to an ASFile for use by clients
of the replacement file system. In Acrobat 5, MDFile was rename ASMDFile.
Obtaining
ASFileGetMDFile
Attributes

Get Set
ASFileFromMDFile

Acrobat and PDF Library API Overview 67


Acrobat and PDF Library API Objects
3
AV Layer

AV L aye r
Acrobat viewer layer. A set of objects whose methods allow clients to manipulate
components of the Acrobat viewer application itself, such as menus and menu items.

AVActionHandler
Carries out an action. When Acrobat executes an action, it looks for the action handler with
a type matching that of the action it is trying to execute. The Acrobat viewer invokes the
matching handler to perform the action. If no match is found, the Acrobat viewer ignores
the user action. Clients can add new action handlers by using
AVAppRegisterActionHandler.
Obtaining
AVAppRegisterActionHandler
AVAppGetActionHandlerByType
Enumerating
AVAppEnumActionHandlers
Attributes

Get Set
AVActionHandlerGetProcs
AVActionHandlerGetType
AVActionHandlerGetUIName

Declarations
AVActionHandlerProcs

68 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
AV Layer

AVAnnotHandler
Responsible for creating, displaying, selecting, and deleting a particular type of annotation.
There is one annotation handler for each annotation type. The source for built-in
annotation types may be just the Acrobat executable or the executable plus the default
Adobe plug-ins. An example of annotations that are built into the executable are link
annotations; examples of annotations added by Acrobats default plug-ins include note
annotations. See the PDF Reference for more information. Clients can add new annotation
handlers by using AVAppRegisterAnnotHandler.
Obtaining
AVAppGetAnnotHandlerByName
AVAppEnumAnnotHandlers
Enumerating
AVAppEnumAnnotHandlers
Attributes

Get Set
AVAnnotHandlerGetInfo AVAnnotHandlerDeleteInfo

Declarations
AVAnnotHandler

Acrobat and PDF Library API Overview 69


Acrobat and PDF Library API Objects
3
AV Layer

AVApp
The Acrobat application itself. From the application layer, you can control the appearance
of Acrobat, whether Acrobat appears, and the size of the application window. Your
application has access to the menubar and the toolbar through this object. The application
layer also provides access to the visual representation of a PDF file on the screen, that is, an
AVDoc.
Enumerating
AVAppEnumActionHandlers
AVAppEnumAnnotHandlers
AVAppEnumDocs
AVAppEnumSystemFonts
AVAppEnumTools
AVAppEnumTransHandlers
Attributes

Get Set
AVAppGetHowToPanelAutoShow AVAppRegisterHowToPanel,
AVAppSetHowToPanelAutoShow,
AVAppSetHowToPanelAutoShowText
AVAppCanQuit
AVAppGetActionHandlerByType AVAppRegisterActionHandler
AVAppGetActiveDoc
AVAppGetActiveTool AVAppSetActiveTool,
AVAppRegisterTool
AVAppGetAnnotHandlerByName AVAppRegisterAnnotHandler
AVAppRegisterForContextMenuAddition
AVAppRegisterForPageViewAdjustCursor,
AVAppUnregisterForPageViewAdjustCursor
AVAppRegisterForPageViewClicks,
AVAppUnregisterForPageViewClicks
AVAppRegisterForPageViewDrawing,
AVAppUnregisterForPageViewDrawing
AVAppRegisterIdleProc,
AVAppUnregisterIdleProc

70 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
AV Layer

Get Set
AVAppRegisterNotification,
AVAppUnregisterNotification
AVAppGetCancelProc
AVAppGetDefaultTool
AVAppGetDocProgressMonitor
AVAppGetLanguage
AVAppGetLastActiveTool
AVAppGetMenubar
AVAppGetName
AVAppGetNumDocs
AVAppGetPreference AVAppSetPreference
AVAppGetReportProc
AVAppGetToolBar
AVAppGetToolByName
AVAppGetTransHandlerByType
AVAppGetVersion
AVHasAuxDataHandler AVRegisterAuxDataHandler,
AVUnregisterAuxDataHandler

Actions
AVAppBeginModal
AVAppEndModal
AVAppModalWindowIsOpen
AVAppBeginFullScreen
AVAppDoingFullScreen
AVAppEndFullScreen
AVAppHandlePlatformEvent
AVAppHelpSearch
AVAppHelpShowContents
AVAppHelpShowIndex
AVAppOpenHelpFileWithParams
AVAppAutoShowHowToPanel

Acrobat and PDF Library API Overview 71


Acrobat and PDF Library API Objects
3
AV Layer

AVCommand
An AVCommand represents an action that the user can perform on the current document
or the current selection in the current document. An AVCommand can be added to a
command sequence and executed either interactively or via batch processing, using
AVCommandExecute. Commands can be cancelled with AVCommandCancel.
Obtaining:
AVCommandNew
Disposing:
AVCommandDestroy
Attributes

Get Set
AVCommandGetAVDoc
AVCommandGetCab AVCommandPutCab
AVCommandGetCancelProc
AVCommandGetConfig AVCommandSetConfig
AVCommandGetInputs AVCommandSetInputs
AVCommandGetName
AVCommandGetParams AVCommandSetParams
AVCommandGetPDDoc
AVCommandGetProgressMonitor
AVCommandGetProps
AVCommandGetReportProc
AVCommandGetStatus
AVCommandGetUIPolicy

Actions
AVCommandCancel
AVCommandExecute
AVCommandReset
AVCommandShowDialog
AVCommandWork

72 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
AV Layer

AVConversion
This is not a data structure, but a conceptual entity that collects methods and data
structures used to convert from and to PDF format.
Actions
AVConversionConvertFromPDFWithHandler
AVConversionConvertStreamFromPDFWithHandler
AVConversionConvertStreamFromStructNodeWithHandler
AVConversionConvertStreamToPDF
AVConversionConvertStreamToPDFWithHandler
AVConversionConvertToPDF
AVConversionConvertToPDFWithHandler
AVConversionEnumFromPDFConverters
AVConversionEnumToPDFConverters
Declarations
AVConversionClientData
AVConversionEnumProcData
AVConversionFlags
AVConversionFromPDFHandler
AVConversionMimeTypeString
AVConversionStatus
AVConversionToPDFHandler

Acrobat and PDF Library API Overview 73


Acrobat and PDF Library API Objects
3
AV Layer

AVDoc
A view of a PDF document in a window. There is one AVDoc per displayed document.
Unlike a PDDoc, an AVDoc has a window associated with it.
Obtaining:
AVAppGetActiveDoc
AVAppEnumDocs
AVDocOpenFromASFileWithParams
AVDocOpenFromASFileWithParamString
AVDocOpenFromFile
AVDocOpenFromASFileWithParams
AVDocOpenFromASFileWithParamString
AVDocOpenFromPDDoc
AVDocOpenFromPDDocWithParams
AVDocOpenFromPDDocWithParamString
AVPageViewGetAVDoc
AVUndoGetAVDoc
Disposing
AVDocClose
Enumerating
AVAppEnumDocs
AVDocEnumSelection
Attributes

Get Set
AVDocGetAVWindow
AVDocGetClientName AVDocSetClientName
AVDocGetPageText
AVDocGetPageText,
AVDocGetPageView,
AVDocGetNthPageView,
AVDocGetNumPageViews
AVDocGetPDDoc
AVDocClearSelection
AVDocDeleteSelection

74 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
AV Layer

Get Set
AVDocShowSelection
AVDocGetSelection AVDocSetSelection
AVDocGetSelectionServerByType
AVDocGetSelectionType
AVDocGetSplitterPosition AVDocSetSplitterPosition
AVDocGetTopUndo AVDocClearUndos
AVDocGetViewDef, AVDocSetViewDef,
AVDocGetViewDefEx AVDocSetViewDefEx
AVDocGetViewMode AVDocSetViewMode
AVDocIsExternal
AVDocRegisterSelectionServer
AVDocSetDead
AVDocIsReadOnly AVDocSetReadOnly

Actions
AVDocBeginUndoOperation
AVDocDoActionPropsDialog
AVDocDoCopyAs
AVDocDoPrint
AVDocDoSaveAs
AVDocDoSaveAsWithParams
AVDocDoSelectionProperties
AVDocEndUndoOperation
AVDocPerformAction
Declarations
AVDocOpenParams
AVDocPrintParams
AVDocSelectionServer
AVDocViewDef

Acrobat and PDF Library API Overview 75


Acrobat and PDF Library API Objects
3
AV Layer

AVGrafSelect
A graphics selection on a page in a PDF file. It is a rectangular region of a page that can be
copied to the clipboard as a sampled image.
Obtaining
AVDocGetSelection
AVGrafSelectCreate
Disposing
AVGrafSelectDestroy
Attributes

Get Set
AVGrafSelectGetBoundingRect

76 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
AV Layer

AVMenu
A menu in Acrobats menubar. Clients can create new menus, add menu items at any
location in any menu, and remove menu items. Deleting an AVMenu removes it from the
menubar (if it was attached) and deletes all the menu items it contains.
Obtaining
AVMenuAcquire
AVMenuNew
AVMenuItemAcquireSubmenu
AVMenuItemGetParentMenu
AVMenubarAcquireMenuByName
AVMenubarAcquireMenuByIndex
AVMenubarAcquireMenuByPredicate
Disposing
AVMenuRelease
AVMenuRemove
Attributes

Get Set
AVMenuAddMenuItem
AVMenuGetMenuItemIndex
AVMenuGetName
AVMenuGetNumMenuItems
AVMenuGetParentMenubar
AVMenuGetParentMenuItem
AVMenuGetTitle

Acrobat and PDF Library API Overview 77


Acrobat and PDF Library API Objects
3
AV Layer

AVMenubar
Acrobats menubar and a list of all menus. There is only one AVMenubar. Clients can add
new menus to or remove any menu from the menubar. The menubar can be hidden from
the users view.
Obtaining
AVAppGetMenubar
AVMenuGetParentMenubar
AVAppGetMenubar is the standard way to obtain the menubar.
Attributes:

Get Set
AVMenubarAddMenu
AVMenuRemove
AVMenubarAcquireMenuByIndex
AVMenubarAcquireMenuByName
AVMenubarAcquireMenuByPredicate
AVMenubarAcquireMenuItemByName
AVMenubarAcquireMenuItemByPredicate
AVMenubarGetMenuIndex
AVMenubarGetNumMenus
AVMenuItemRemove
AVMenubarHide
AVMenubarShow

78 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
AV Layer

AVMenuItem
A menu item under a menu in Acrobat. It has a number of attributes, including a name, a
keyboard shortcut, a procedure to execute when the menu item is selected, a procedure to
compute whether the menu item is enabled, a procedure to compute whether the menu
item is check marked, and whether it has a submenu.
Obtaining
AVMenuItemNew
AVMenuItemAcquire
AVMenubarAcquireMenuByName
AVMenubarAcquireMenuItemByPredicate
AVMenuAcquireMenuItemByIndex
AVMenuGetParentMenuItem
AVMenuDoPopUp
AVPageViewDoPopupMenu
Disposing
AVMenuItemRelease
AVMenuItemRemove
Attributes

Get Set
AVMenuGetMenuItemIndex
AVMenuItemAcquireSubmenu
AVMenuItemGetLongOnly
AVMenuItemGetName
AVMenuItemGetParentMenu
AVMenuItemGetShortcut
AVMenuItemGetTitle AVMenuItemSetTitle
AVMenuItemIsEnabled AVMenuItemSetComputeEnabledProc
AVMenuItemIsMarked AVMenuItemSetComputeMarkedProc
AVMenuItemIsVisible AVMenuItemSetComputeVisibleProc
AVMenuItemSetExecuteProc

Acrobat and PDF Library API Overview 79


Acrobat and PDF Library API Objects
3
AV Layer

AVPageView
The area of Acrobats window that displays the contents of a document page. Every AVDoc
has an AVPageView and vice versa. It contains references to the PDDoc and PDPage
objects for the document being displayed.
Obtaining
AVDocGetPageView
Attributes

Get Set
AVPageViewAppearanceGetAVMatrix
AVPageViewAcquireMachinePort AVPageViewReleaseMachinePort
AVPageViewGetActiveBead
AVPageViewGetAnnotRect
AVPageViewSetAnnotLocation
AVPageViewGetAperture
AVPageViewGetAVDoc
AVPageViewGetColor AVPageViewSetColor
AVPageViewShowControl
AVPageViewGetDevToPageMatrix,
AVPageViewGetPageToDevScaling
AVPageViewGetPageToDevMatrix
AVPageViewGetFirstVisiblePageNum,
AVPageViewGetLastVisiblePageNum
AVPageViewGetFocusAnnot AVPageViewSetFocusAnnot
AVPageViewGetLayoutMode AVPageViewSetLayoutMode
AVPageViewGetMousePosition,
AVPageViewGetMousePositionSnapped
AVPageViewGetNextView
AVPageViewGetPage
AVPageViewGetPageNum AVPageViewSetPageNum

80 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
AV Layer

Get Set
AVPageViewGetSelectedAnnotPageNum
AVPageViewGetThreadIndex
AVPageViewGetVisibleAnnotPage
AVPageViewGetZoom,
AVPageViewGetZoomType
AVPageViewDevicePointToPage,
AVPageViewDeviceRectToPage,
AVPageViewDeviceRectToPageRZ,
AVPageViewInfoToDevice
AVPageViewInfoToPoint
AVPageViewPointToDevice,
AVPageViewPointToInfo,
AVPageViewRectToDevice
AVPageViewInvalidateRect,
AVPageViewInvalidateText
AVPageViewIsAnnotAtPoint, AVPageViewSetAnnotLocation
AVPageViewIsAnnotOfTypeAtPoint,
AVPageViewIsFocusAnnot
AVPageViewIsBeadAtPoint
AVPageViewPageNumIsVisible
AVPageViewPointInText
AVPageViewUseDestInfo,
AVPageViewUseThisDestination
AVPageViewUpdateInfoPanel

Actions
AVPageViewDragRect
AVPageViewDragRectSnapped
AVPageViewDragRectSnappedEx
AVPageViewDrawCosObj
AVPageViewDrawNow
AVPageViewDrawRect
AVPageViewDrawRectOutline
AVPageViewGoBack

Acrobat and PDF Library API Overview 81


Acrobat and PDF Library API Objects
3
AV Layer

AVPageViewGoForward
AVPageViewGoTo
AVPageViewHighlightText
AVPageViewInsetRect
AVPageViewInvertQuad
AVPageViewInvertRect
AVPageViewInvertRectOutline
AVPageViewReadPageDown
AVPageViewReadPageUp
AVPageViewResumeOffscreenDrawing
AVPageViewScrollTo
AVPageViewScrollToRect
AVPageViewSnapPoint
AVPageViewSnapRect
AVPageViewStartReadingThread
AVPageViewSuspendOffscreenDrawing
AVPageViewToDestInfo
AVPageViewToViewDest
AVPageViewTrackText
AVPageViewZoomTo
Declarations
AVDestInfo
AVDragRectParams
AVDragType
AVInfoPanelUpdateType
AVPageViewControlID
AVRect
AVZoomType

82 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
AV Layer

AVSweetPea
The Sweet Pea methods are used to implement the Adobe Dialog Manager (ADM). See
Adobe Dialog Manager Reference.
Attributes

Get Set
AVSweetPeaGetBasicSuiteP
AVSweetPeaGetPluginRef
AVSweetPeaGetResourceAccess AVSweetPeaSetResourceAccess

Declarations
See Adobe Dialog Manager Reference.

Acrobat and PDF Library API Overview 83


Acrobat and PDF Library API Objects
3
AV Layer

AVSys
Provides various system-wide utilities, including setting the cursor shape and beeping.
Attributes

Get Set
AVSysGetCursor, AVSysSetCursor,
AVSysGetStandardCursor AVSysSetWaitCursor
AVSysGetIconFromFilename,
AVSysGetIconFromMimeType,
AVSysGetIconFromTypeAndCreator
AVSysGetModifiers
AVSysGetUsePenForInput
AVSysMouseIsStillDown

Actions
AVSysAllocTimeStringFromTimeRec
AVSysBeep

84 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
AV Layer

AVTool
Handles key presses and mouse clicks in the content region of an AVPageView. AVTools
do not handle mouse clicks in other parts of Acrobats window, such as in the bookmark
pane. At any time, there is one active tool.
Obtaining
AVAppGetActiveTool
AVAppGetLastActiveTool
AVAppGetDefaultTool
AVAppGetToolByName
AVAppEnumTools
Enumerating
AVAppEnumTools
Attributes

Get Set
AVToolGetType
AVToolIsPersistent

Declarations
AVTool

Acrobat and PDF Library API Overview 85


Acrobat and PDF Library API Objects
3
AV Layer

AVToolBar
Acrobats toolbar (the palette of buttons).
Obtaining
AVAppGetToolBar
AVToolBarNew
AVToolBarNewFlyout
AVToolButtonGetFlyout
Attributes

Get Set
AVToolBarGetButtonByName
AVToolBarGetFrame
AVToolBarGetNumButtons
AVToolBarIsRoomFor
AVToolBarAddButton
AVToolBarUpdateButtonStates
AVToolButtonDestroy
AVToolButtonRemove
AVToolButtonSetExternal

86 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
AV Layer

AVToolButton
A button in Acrobats toolbar. Like menu items, the procedure that executes when the
button is clicked can be set by a client. Although not required, there is generally a menu
item corresponding to each button, allowing users to select a function using either the
button or the menu item. Buttons are added to the toolbar by specifying which existing
button they appear before or after.
Obtaining
AVToolBarGetButtonByName
AVToolButtonNew
AVToolBarEnumButtons
Disposing
AVToolButtonDestroy
AVToolButtonRemove
Enumerating
AVToolBarEnumButtons
Attributes

Get Set
AVToolButtonGetFlyout AVToolButtonSetFlyout
AVToolButtonGetIcon AVToolButtonSetIcon
AVToolButtonGetLabelText AVToolButtonSetLabelText
AVToolButtonGetMenu AVToolButtonSetMenu
AVToolButtonIsEnabled AVToolButtonSetComputeEnabledProc
AVToolButtonIsMarked AVToolButtonSetComputeMarkedProc
AVToolButtonIsSeparator
AVToolButtonSetNotifyTooltipProc
AVToolButtonIsVisible AVToolButtonSetComputeVisibleProc
AVToolButtonSetExecuteProc
AVToolButtonSetExternal
AVToolButtonSetHelpText

Acrobat and PDF Library API Overview 87


Acrobat and PDF Library API Objects
3
AV Layer

Declarations
Tool Button Flags

88 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
AV Layer

AVUndo
Represents an undo record for a document. An undo record allows a client to associate
private data with a particular AVDoc for the purpose of undoing and redoing changes to
the document. The client provides private data that encapsulates the changes, and an
AVUndoHandler that contains callbacks which interpret the data when Undo and Redo
commands are issued.
Obtaining
AVUndoNew
AVDocBeginUndoOperation
Disposing
AVDocClearUndos
AVDocEndUndoOperation
Attributes

Get Set
AVUndoGetAVDoc
AVUndoGetData AVUndoSetData
AVUndoGetType

Declarations
AVUndoHandler
AVUndoHandlerData

Acrobat and PDF Library API Overview 89


Acrobat and PDF Library API Objects
3
AV Layer

AVWindow
Creates and manages windows. Clients should use AVWindows for their own dialogs,
floating palettes, and so forth, to ensure that those windows work well with Acrobat. For
example, under Windows they are hidden when Acrobat is turned into an icon. Once the
client creates an AVWindow, it is free to use platform-dependent code to put whatever it
wants in the window.
Obtaining
AVWindowNew
AVWindowNewFromPlatformThing
AVDocGetAVWindow
Disposing
AVWindowDestroy
AVWindowUserClose
Attributes

Get Set
AVWindowGetFrame AVWindowSetFrame
AVWindowGetInterior
AVWindowGetOwnerData AVWindowSetOwnerData
AVWindowGetPlatformThing
AVWindowGetTitle AVWindowSetTitle
AVWindowIsKey ,
AVWindowSetWantsKey,

AVWindowIsVisible
AVWindowInvalidateRect

Actions
AVWindowBecomeKey
AVWindowBringToFront
AVWindowDoModal
AVWindowDrawNow
AVWindowEndModal
AVWindowHide

90 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
AV Layer

AVWindowMaximize
AVWindowResignKey
AVWindowShow
Declarations
AVWindow Flags
AVWindowHandler
AVWindowLayer

Acrobat and PDF Library API Overview 91


Acrobat and PDF Library API Objects
3
Cos Layer

Co s L aye r
A set of objects that provide access to the building blocks used to construct documents. Its
methods allow applications to manipulate the low-level data in a PDF file, such as strings,
numbers, and dictionaries.

CosArray
A Cos-level representation of an array.
Obtaining
CosNewArray
Attributes

Get Set
CosArrayGet CosArrayPut
CosArrayLength
CosArrayInsert
CosArrayRemove
CosArrayRemoveNth

92 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
Cos Layer

CosBoolean
A Cos-level representation of a boolean value.
Obtaining
CosNewBoolean
Attributes

Get Set
CosBooleanValue

Acrobat and PDF Library API Overview 93


Acrobat and PDF Library API Objects
3
Cos Layer

CosDict
A Cos-level representation of a dictionary.
Obtaining
CosNewDict
CosDocGetInfoDict
CosStreamDict
Attributes

Get Set
CosDictGet CosDictPut
CosDictKnown
CosDictRemove

94 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
Cos Layer

CosDoc
A Cos-level representation of an entire PDF file.
Obtaining
CosDocCreate
CosDocOpenWithParams
CosObjGetDoc
PDDocGetCosDoc
Attributes

Get Set
CosDocGetID
CosDocGetInfoDict
CosDocGetObjByID
CosDocHasFullCompression
CosDocHasPartialCompression

CosDocSetDirty

Actions
CosDocClose
CosDocSaveToFile
CosDocSaveWithParams
CosSetMaxDocStorages
Declarations
CosDocOpenParams
CosDocOpenParams
CosDocSaveFlags
CosDocSaveParams

Acrobat and PDF Library API Overview 95


Acrobat and PDF Library API Objects
3
Cos Layer

CosFixed
A Cos-level representation of a fixed-point number.
Obtaining
CosNewFixed
Attributes

Get Set
CosFixedValue

96 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
Cos Layer

CosInteger
A Cos-level representation of an integer.
Obtaining
CosNewInteger
Attributes

Get Set
CosIntegerValue

Acrobat and PDF Library API Overview 97


Acrobat and PDF Library API Objects
3
Cos Layer

CosName
A Cos-level representation of a name.
Obtaining
CosNewName
Attributes

Get Set
CosNameValue

98 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
Cos Layer

CosNull
A Cos-level representation of a null PDF object.
Obtaining
CosNewNull

Acrobat and PDF Library API Overview 99


Acrobat and PDF Library API Objects
3
Cos Layer

CosObj
A general object in a PDF file, which may be of any Cos object type.
Obtaining
CosDocGetObjByID
PDActionGetCosObj
PDAnnotGetCosObj
PDBeadGetCosObj
PDBookmarkGetCosObj
PDCharProcGetCosObj
PDFileSpecGetCosObj
PDFontGetCosObj
PDFormGetXUIDCosObj
PDNameTreeGetCosObj
PDPageGetCosObj
PDPageGetCosResources
PDPageLabelGetCosObj
PDThreadGetCosObj
PDTransGetCosObj
PDViewDestGetCosObj
PDXObjectGetCosObj
Disposing
CosObjDestroy
Enumerating
CosObjEnum
Actions
CosObjEqual
Attributes

Get Set
CosDocObjIsWithinRange
CosObjGetCollection CosObjAddToCollection,
CosObjRemoveFromCollection
CosObjGetCompressibility, CosObjSetCompressibility
CosObjIsCompressed
CosObjGetDoc

100 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
Cos Layer

Get Set
CosObjGetGeneration
CosObjGetID
CosObjHash
CosObjIsIndirect

Actions
CosObjRefreshAfterLinearizedSave
Cos conversion
See Cos conversion for each object.
Declarations
CosType

Acrobat and PDF Library API Overview 101


Acrobat and PDF Library API Objects
3
Cos Layer

CosObjCollection
An opaque structure representing a set of Cos objects associated with a particular Cos
document. The initial value of a variable of type ObjCollection is undefined. Use
CosNewObjCollection to create a collection.
Any indirect object whose generation number is zero and which is not a stream may be
added to at most one CosObjCollection. When the file is saved, all the objects in a
given collection are stored together in the PDF file, in one or more object streams (see the
PDF Reference), which are normally compressed in order to reduce file size.
Collections allow grouping of objects that are likely to have a similar usage pattern. If one
of them is required (and therefore decompressed), they are likely to all be required, but it is
possible that none will be required. For example, there could be a collection that stores
bookmarks. If the user never opens the bookmarks panel in Acrobat, none of the objects
need to be decoded. If the user opens the bookmarks panel, it is likely they will all be
needed, and having them together in the PDF file reduces the amount of time needed to
load them all.
NOTE: If the document is saved with full compression, partial compression, or in linearized
format, any existing collections are ignored.
Obtaining
CosNewObjCollection
CosObjGetCollection
Enumerating
CosObjCollectionEnum
Attributes

Get Set
CosObjCollectionEqual
CosObjCollectionIsNull
CosObjCollectionSize

102 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
Cos Layer

CosStream
A Cos-level representation of a stream.
Obtaining
CosNewStream
CosStreamOpenStm
Attributes

Get Set
CosStreamDict
CosStreamLength
CosStreamPos

Declarations
CosStreamOpenMode

Acrobat and PDF Library API Overview 103


Acrobat and PDF Library API Objects
3
Cos Layer

CosString
A Cos-level representation of a string.
Obtaining
CosNewString
Attributes

Get Set
CosStringGetHexFlag CosStringSetHexFlag
CosCopyStringValue
CosStringValue
CosStringValueSafe

104 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PD Layer

P D L ayer
A group of objects that provide access to components of PDF documents such as pages,
annotations, and fonts. Its methods allow applications to manipulate document
components.

PDAction
Actions are what happens when a user clicks on a link or bookmark. In addition, Acrobat
allows a document to have an action that is executed automatically when the document is
opened. Applications can also support actions in custom annotation types they add.
Obtaining
PDActionNew
PDActionNewFromDest
PDActionNewFromFileSpec
PDLinkAnnotGetAction
PDBookmarkGetAction
PDDocGetOpenAction
PDActionCopy
PDActionPaste
Disposing
PDActionDestroy
PDActionDestroyClipboardData
Attributes

Get Set
PDActionCanCopy
PDActionCanPaste
PDActionEqual
PDActionGetDest
PDActionGetFileSpec
PDActionGetSubtype

Cos conversion
PDActionGetCosObj
PDActionFromCosObj

Acrobat and PDF Library API Overview 105


Acrobat and PDF Library API Objects
3
PD Layer

Validity testing
PDActionIsValid
Declarations
PDActionClipboardData

106 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PD Layer

PDAnnot
An annotation on a page in a PDF file. Acrobat has two built-in annotation types:
PDTextAnnot and PDLinkAnnot. Physical attributes of the annotation can be set and
queried. Plug-ins add movie and Widget (form field) annotations. Developers can define
new annotation subtypes by creating new annotation handlers.
Obtaining
AVPageViewIsAnnotAtPoint
PDAnnotFromCosObj
PDPageAddNewAnnot
PDPageCreateAnnot
PDPageGetAnnot
PDAnnotCopy
PDAnnotPaste
Disposing
PDPageRemoveAnnot
PDAnnotDestroyClipboardData
Attributes

Get Set
AVPageViewGetSelectedAnnotPageNum
AVPageViewSetAnnotLocation
PDAnnotCanCopy
PDAnnotCanPaste
PDAnnotEqual
PDAnnotGetColor PDAnnotSetColor
PDAnnotGetDate PDAnnotSetDate
PDAnnotGetFlags PDAnnotSetFlags
PDAnnotGetRect PDAnnotSetRect
PDAnnotGetSubtype
PDAnnotGetTitle PDAnnotSetTitle
PDAnnotGetOCMD PDAnnotSetOCMD
PDAnnotRemoveOCMD

Acrobat and PDF Library API Overview 107


Acrobat and PDF Library API Objects
3
PD Layer

Get Set
PDAnnotIsCurrentlyVisible

Cos conversion
PDAnnotGetCosObj
PDAnnotFromCosObj
Validity testing
PDAnnotIsValid
Declarations
PDAnnotArray
PDAnnotClipboardData
PDAnnot Flags
PDAnnotHandler
PDAnnotInfo

108 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PD Layer

PDBead
A single rectangle in an article thread. (Article threads are known simply as articles in
Acrobats user interface.) A bead remains valid as long as a thread is current and active.
Obtaining
AVPageViewGetActiveBead
AVPageViewIsBeadAtPoint
PDBeadNew
PDBeadGetNext
PDBeadGetPrev
PDThreadGetFirstBead
Disposing
PDBeadDestroy
Attributes

Get Set
PDBeadGetIndex
PDBeadGetNext
PDBeadGetPrev
PDBeadGetRect PDBeadSetRect
PDBeadGetThread
PDBeadIsValid
PDBeadSetPage

Cos conversion
PDBeadGetCosObj
PDBeadFromCosObj
Validity testing
PDBeadIsValid

Acrobat and PDF Library API Overview 109


Acrobat and PDF Library API Objects
3
PD Layer

PDBookmark
A bookmark on a page in a PDF file. Each bookmark has a title that appears on screen, and
an action that specifies what happens when a user clicks on the bookmark. Bookmarks can
either be created interactively by the user through Acrobats user interface or
programmatically generated. The typical action for a user-created bookmark is to move to
another location in the current document, although any action (see PDAction) can be
specified.
Obtaining
PDDocGetBookmarkRoot
PDBookmarkAddNewSibling
PDBookmarkAddNewChild
PDBookmarkFromCosObj
PDBookmarkGetByTitle
PDBookmarkGetParent
PDBookmarkGetFirstChild
PDBookmarkGetLastChild
PDBookmarkGetNext
PDBookmarkGetPrev
Disposing
PDBookmarkDestroy
PDBookmarkUnlink
Attributes

Get Set
PDBookmarkEqual
PDBookmarkGetAction PDBookmarkSetAction
PDBookmarkRemoveAction
PDBookmarkGetColor PDBookmarkSetColor
PDBookmarkGetCount
PDBookmarkGetFirstChild PDBookmarkAddChild
PDBookmarkAddNewChild
PDBookmarkGetFlags PDBookmarkSetFlags
PDBookmarkGetIndent

110 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PD Layer

Get Set
PDBookmarkGetLastChild PDBookmarkAddChild
PDBookmarkAddNewChild
PDBookmarkGetNext PDBookmarkAddNext
PDBookmarkAddNewSibling
PDBookmarkGetParent PDBookmarkAddSubtree
PDBookmarkGetPrev PDBookmarkAddPrev
PDBookmarkAddNewSibling
PDBookmarkGetTitle PDBookmarkSetTitle
PDBookmarkHasChildren
PDBookmarkIsOpen PDBookmarkSetOpen

Cos conversion
PDBookmarkGetCosObj
PDBookmarkFromCosObj
Validity testing
PDBookmarkIsValid

Acrobat and PDF Library API Overview 111


Acrobat and PDF Library API Objects
3
PD Layer

PDCharProc
A character procedure, a stream of graphic operators (see PDGraphic) that draw a
particular glyph of a Type 3 PostScript font.
Enumerating
PDCharProcEnum
PDCharProcEnumWithParams
PDFontEnumCharProcs
Cos conversion
PDCharProcGetCosObj

112 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PD Layer

PDDoc
The underlying PDF representation of a document. There is a correspondence between a
PDDoc and an ASFile; the PDDoc object is the hidden object behind every AVDoc. An
ASFile may have zero or more underlying files, so a PDF file does not always correspond
to a single disk file. For example, an ASFile may provide access to PDF data in a database.
Through PDDocs, your application can perform most of the Edit -> Pages menu items from
Acrobat (delete, replace, and so on). Thumbnails can be created and deleted through this
object. You can set and retrieve document information fields through this object as well.
The first page in a PDDoc is page 0.
Obtaining
AVDocGetPDDoc
PDDocFromCosDoc
PDDocOpen
PDDocOpenFromASFile
PDDocOpenWithParams
PDDocCreate
PDOCConfigGetPDDoc
PDPageGetDoc
PDFileSpecGetDoc
PDEnumDocs
Disposing
PDDocClose
PDDocRelease
Enumerating
PDDocEnumFonts
PDDocEnumLoadedFonts
PDDocEnumOCGs
PDDocEnumOCConfigs
PDEnumDocs
Attributes

Get Set
AVAuthOpen PDDocAuthorize
PDCryptAuthorizeFilterAccess PDDocSetNewCryptFilterData
PDDocSetNewCryptFilterMethod
PDDocSetNewDefaultFilters
PDDocAcquire

Acrobat and PDF Library API Overview 113


Acrobat and PDF Library API Objects
3
PD Layer

Get Set
PDDocAcquirePage PDDocCreatePage
PDDocDeletePages
PDDocImportNotes
PDDocMovePage
PDDocReplacePages
PDDocAuthorize
PDDocCreateThumbs
PDDocDeleteThumbs
PDDocExportNotes
PDDocGetCryptHandlerClientData PDDocSetNewCryptHandler
PDDocGetNewCryptHandler PDDocSetNewCryptHandlerEx
PDDocGetFile
PDDocGetFlags PDDocClearFlags
PDDocSetFlags
PDDocGetFullScreen PDDocSetFullScreen
PDDocGetID
PDDocGetInfo PDDocSetInfo
PDDocGetLabelForPageNum PDDocRemovePageLabel
PDDocGetNameTree PDDocRemoveNameTree
PDDocGetNumPages
PDDocGetOCConfig PDDocReplaceOCG
PDDocGetOCContext
PDDocGetOCGs
PDDocGetNumOCGs
PDDocHasOC
PDDocGetOpenAction PDDocSetOpenAction
PDDocRemoveOpenAction
PDDocGetPageLabel PDDocSetPageLabel
PDDocFindPageNumForLabel
PDDocGetPageObjByNum

114 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PD Layer

Get Set
PDDocGetPageMode PDDocSetPageMode
PDDocGetPermissions
PDDocGetSecurityData PDDocNewSecurityData
PDDocGetNewSecurityData PDDocSetNewSecurityData
PDDocGetNewSecurityInfo
PDDocGetStructTreeRoot PDDocRemoveStructTreeRoot
PDDocCreateStructTreeRoot
PDDocGetThread PDDocAddThread
PDDocGetThreadIndex PDDocRemoveThread
PDDocGetNumThreads
PDDocGetTrapped PDDocSetTrapped
PDDocGetWordFinder PDDocCreateWordFinder
PDDocCreateWordFinderUCS
PDWordFinderDestroy
PDDocGetXAPMetadata PDDocSetXAPMetadata
PDDocGetXAPMetadataProperty PDDocSetXAPMetadataProperty
PDDocGetVersion
PDDocFlattenOC

Cos Conversion
PDDocGetCosDoc
PDDocFromCosDoc
Actions
PDDocRequestEntireFile
PDDocRequestPages
PDDocSave
PDDocSaveWithParams
Declarations
PDDocCopyParams
PDDocFlags
PDDocInsertPagesParams
PDDocOCChangeType
PDDocOpenParams
PDDocPreSaveInfo

Acrobat and PDF Library API Overview 115


Acrobat and PDF Library API Objects
3
PD Layer

PDDocReadAhead Flags
PDDocSaveParams

116 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PD Layer

PDFileSpec
The PDF file specification object. It is used to specify a file in an action (see PDAction). A
file specification in a PDF file can take two forms:
A single platform-independent pathname.
A data structure containing one or more alternative ways to locate the file on different
platforms.
PDFileSpecs can be created from ASPathNames or from Cos objects.
Obtaining
PDActionGetFileSpec
PDFileSpecNewFromASPath
PDFileSpecFromCosObj
Attributes

Get Set
PDFileSpecAcquireASPath
PDFileSpecGetDIPath
PDFileSpecGetDoc
PDFileSpecGetFileSys
PDFileSpecGetFileSysName

Cos conversion
PDFileSpecGetCosObj
PDFileSpecFromCosObj
Validity testing
PDFileSpecIsValid
Declarations
PDFileSpecHandler

Acrobat and PDF Library API Overview 117


Acrobat and PDF Library API Objects
3
PD Layer

PDFont
A font that is used to draw text on a page. It corresponds to a Font Resource in a PDF file.
Applications can get a list of PDFonts used on a PDPage or a range of PDPages. More
than one PDPage may reference the same PDFont object.
A PDFont has a number of attributes whose values can be read or set, including an array of
widths, the character encoding, and the fonts resource name.
Obtaining
PDDocEnumFonts
PDDocEnumLoadedFonts
PDFontGetDescendant
PDStyleGetFont
Enumerating
PDDocEnumFonts
PDFontEnumCharProcs
Attributes

Get Set
PDFontAcquireEncodingArray PDFontEncodingArrayRelease
PDFontAcquireXlateTable PDFontXlateTableRelease
PDFontGetBBox
PDFontGetCharSet
PDFontGetCIDSystemInfo
PDFontGetCIDSystemSupplement
PDFontGetDescendant
PDFontGetEncodingIndex
PDFontGetEncodingName
PDFontGetFontMatrix
PDFontGetMetrics PDFontSetMetrics
PDFontGetName
PDFontGetSubtype
PDFontGetWidths

118 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PD Layer

Get Set
PDFontIsEmbedded

Cos conversion
PDFontGetCosObj

Acrobat and PDF Library API Overview 119


Acrobat and PDF Library API Objects
3
PD Layer

PDForm
A self-contained set of graphics operators (essentially a subroutine of PDF page-marking
operators) that is used when a particular graphic is drawn more than once in the document.
It corresponds to a Form resource. You can use any PDXObject method on a PDImage.
Enumerating
PDFormEnumPaintProc
PDFormEnumPaintProcWithParams
PDFormEnumResources
Attributes

Get Set
PDFormGetBBox
PDFormGetFormType
PDFormGetMatrix
PDFormGetXUIDCosObj

Cos Conversion
PDXObjectGetCosObj

120 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PD Layer

PDGraphic
All graphic objects that comprise page, charproc, and PDForm descriptions.
Attributes

Get Set
PDGraphicGetBBox
PDGraphicGetCurrentMatrix
PDGraphicGetState

Declarations
PDGraphicEnumMonitor
PDGraphicEnumParams
PDGraphicState

Acrobat and PDF Library API Overview 121


Acrobat and PDF Library API Objects
3
PD Layer

PDImage
A sampled image or image mask that corresponds to a PDF Image resource. You can use
any PDXObject method on a PDImage.
Attributes

Get Set
PDImageColorSpaceGetIndexLookup
PDImageGetAttrs

Cos Conversion
PDXObjectGetCosObj
Declarations
PDImageAttrs

122 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PD Layer

PDInlineImage
An image whose data is stored in the page descriptions contents streaminstead of being
stored as an image resource (see PDImage).
Attributes

Get Set
PDInlineImageColorSpaceGetIndexLookup
PDInlineImageGetAttrs
PDInlineImageGetData

Acrobat and PDF Library API Overview 123


Acrobat and PDF Library API Objects
3
PD Layer

PDLinkAnnot
A link annotation on a page in a PDF file. You can use any PDAnnot method on a
PDLinkAnnot. Applications can:
Get and set the bounding rectangle and color, using PDAnnot methods.
Get and set the action that occurs when the link is activated, and the links border, using
PDLinkAnnot methods.
Create new link annotations and delete existing ones, using the PDPage methods.
Obtaining:
Any of the PDAnnot calls, followed by CastToPDLinkAnnot. The annotation passed to
CastToPDLinkAnnot must be a link annotation: other annotation types are not
converted into link annotations.
Disposing
PDPageRemoveAnnot
Attributes

Get Set
PDLinkAnnotGetAction PDLinkAnnotSetAction
PDLinkAnnotGetBorder PDLinkAnnotSetBorder
AVPageViewGetSelectedAnnotPageNum
AVPageViewSetAnnotLocation
PDAnnotEqual
PDAnnotGetColor PDAnnotSetColor
PDAnnotGetDate PDAnnotSetDate
PDAnnotGetFlags PDAnnotSetFlags
PDAnnotGetRect PDAnnotSetRect
PDAnnotGetSubtype
PDAnnotGetTitle PDAnnotSetTitle

Cos conversion
PDAnnotGetCosObj
PDAnnotFromCosObj

124 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PD Layer

Validity testing
PDAnnotIsValid
Declarations
PDLinkAnnotBorder

Acrobat and PDF Library API Overview 125


Acrobat and PDF Library API Objects
3
PD Layer

PDNameTree
The dictionary used to store all of the Named Destinations in a PDF file. A name tree is used
to map Cos strings to Cos objects just as a Cos dictionary is used to map Cos names to Cos
objects. However, a name tree can have many more entries than a Cos dictionary can. You
create a PDNameTree and locate it where you think is appropriate (perhaps under a page,
but most often right under the catalog).
Name trees use Cos-style strings (not null-terminated C strings), which may use Unicode
encoding, and these may contain bytes with zeroes in them (high bytes of ASCII characters).
Obtaining
PDDocCreateNameTree
PDNameTreeNew
PDNameTreeFromCosObj
Enumerating
PDNameTreeEnum
Attributes

Get Set
PDDocGetNameTree
PDNameTreeEqual
PDNameTreeLookup
PDNameTreeGet PDNameTreePut
PDNameTreeRemove

Cos conversion
PDNameTreeGetCosObj
Validity testing
PDNameTreeIsValid

126 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PD Layer

PDNumTree
An object that points to the root node of a number tree inside a PDF file. A number tree is
used to map integers to arbitrary Cos objects just as a Cos dictionary is used to map Cos
names to Cos objects. However, a number tree can have many more entries than a Cos
dictionary can.
Obtaining
PDNumTreeNew
PDNumTreeFromCosObj
Enumerating
PDNumTreeEnum
Attributes

Get Set
PDNumTreeEqual
PDNumTreeGet PDNumTreePut
PDNumTreeRemove

Cos conversion
PDNumTreeGetCosObj
Validity testing
PDNumTreeIsValid

Acrobat and PDF Library API Overview 127


Acrobat and PDF Library API Objects
3
PD Layer

PDOCConfig
An optional-content configuration structure, used to maintain a set of visibility states and
other optional-content information in a PDF file for future use. A document has a default
configuration, saved in the D entry in the OCProperties dictionary, and can have a list of
other configurations, saved as an array in the Configs entry in the OCProperties dictionary.
Configurations are typically used to initialize the optional-content group (PDOCG) ON-OFF
states for an optional-content context (PDOCContext). The OCG order in the
configuration is the order in which the groups appear in the Layers panel of Acrobat 6.0.
The configuration can define a set of mutually exclusive OCGs, called a radio button group.
Obtaining
PDOCConfigCreate
PDDocGetOCConfig
Disposing
PDOCConfigDestroy
Enumerating
PDDocEnumOCConfigs
Attributes

Get Set
PDOCConfigGetAllRadioButtonGroups PDOCConfigMakeRadioButtonGroup
PDOCConfigGetRadioButtonGroupForOCG
PDOCConfigGetCreator PDOCConfigSetCreator
PDOCConfigGetInitState PDOCConfigSetInitState
PDOCConfigGetIntent PDOCConfigSetIntent
PDOCConfigGetName PDOCConfigSetName
PDOCConfigGetOCGOrder PDOCConfigSetOCGOrder
PDOCConfigGetPDDoc

Cos conversion
PDOCConfigGetCosObj
Declarations
PDOCConfigBaseState

128 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PD Layer

PDOCContext
An optional-content context in a document, within which document objects such as words
or annotations are visible or hidden. The context keeps track the ON-OFF states of all of the
optional-content groups (OCGs, represented by the PDOCG object) in a document. Content
is or is not visible with respect to the OCG states stored in a specific context. The context
does not correspond to any explicit PDF specification.
The PDDoc has a default context that it uses for on-screen drawing and that determines
the default state for any other drawing or content enumeration. The context has flags that
control whether to draw or enumerate content that is marked as optional
(PDOCDrawEnumType), and whether to draw content that is not marked as optional
(NonOCDrawing).
There can be more than one PDOCContext object, representing different combinations of
OCG states. You can change the states of OCGs within any context. You can build contexts
with your own combination of OCG states, and issue drawing or enumeration commands
using that context instead of the document's default context. For example, you can pass an
optional-content context to PDPageDrawContentsWithParams through the
PDDrawParams structure. You can save the resulting state information as part of the
configuration, but the context itself has no corresponding PDF form, and is not saved.
Obtaining
PDOCContextNew
PDOCContextNewWithInitialState
PDOCContextNewWithOCDisabled
PDOCContextInit
PDOCContextMakeCopy
PDOCContextMakeCopyWithAutoStateChanges
PDDocGetOCContext
Disposing
PDOCContextFree
Attributes

Get Set
PDOCContextContentIsVisible
PDOCContextFindAutoStateChanges PDOCContextApplyAutoStateChanges
PDOCContextClearAllUserOverrides
PDOCContextGetNonOCDrawing PDOCContextSetNonOCDrawing
PDOCContextGetOCDrawEnumType PDOCContextSetOCDrawEnumType

Acrobat and PDF Library API Overview 129


Acrobat and PDF Library API Objects
3
PD Layer

Get Set
PDOCContextGetOCGStates PDOCContextSetOCGStates
PDOCContextGetIntent PDOCContextSetIntent
PDOCContextGetPDDoc
PDOCContextPopOCMD PDOCContextPushOCMD
PDOCContextResetOCMDStack
PDOCContextXObjectIsVisible

Declarations
PDOCContextChangeType
PDOCContextInitPolicy
PDOCDrawEnumType

130 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PD Layer

PDOCG
An optional-content group. This corresponds to a PDF OCG dictionary representing a
collection of graphic objects that can be made visible or invisible. Any graphic content of
the PDF can be made optional, including page contents, XObjects, and annotations. The
specific content objects in the group have an OC entry in the PDF. The group itself is a
named object that you can manipulate in the Layers panel of Acrobat 6.0.
In the simplest case, the groups ON-OFF state makes the associated content visible or
hidden. The ON-OFF state of a group can be toggled for a particular context
(PDOCContext), and a set of states is kept in a configuration (PDOCConfig). The visibility
can depend on more than one group in an optional-content membership dictionary
(PDOCMD), and can also be affected by the contexts or configurations
PDOCDrawEnumType.
Obtaining
PDOCGCreate
PDOCGCreateFromCosObj
PDOCGGetFromCosObj
PDOCMDGetOCGs
PDDocGetOCGs
PDPageGetOCGs
Disposing
PDOCGDestroy
Enumerating
PDPageEnumOCGs
PDDocEnumOCGs
Attributes

Get Set
PDOCGGetCurrentState PDOCGSetCurrentState
PDOCGGetInitialState PDOCGSetInitialState
PDOCGRemoveInitialState
PDOCGGetIntent PDOCGSetIntent
PDOCGGetName PDOCGSetName
PDOCGGetPDDoc
PDOCGHasUsageInfo PDOCGSetUsageDictEntry
PDOCGGetUsageEntry

Acrobat and PDF Library API Overview 131


Acrobat and PDF Library API Objects
3
PD Layer

Get Set
PDOCGUsedInOCConfig
PDOCGUsedInOCContext
PDOCGGetUserOverride PDOCGSetUserOverride

Cos conversion
PDOCGGetCosObj
PDOCGGetFromCosObj

132 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PD Layer

PDOCMD
An optional-content membership dictionary (OCMD) that allows the visibility of optional
content to depend on the states in a set of optional-content groups (PDOCG). The object
corresponds to the PDF OCMD dictionary.
An OCMD collects a set of OCGs. It sets a visibility policy, so that content in the member
groups is visible only when all groups are ON or OFF, or when any of the groups is ON or
OFF. This makes it possible to set up complex dependencies among groups.
Obtaining
PDOCMDCreate
PDOCMDFindOrCreate
PDOCMDGetFromCosObj
PDAnnotGetOCMD
PDEElementGetOCMD
Attributes

Get Set
PDOCMDIsCurrentlyVisible PDOCMDsMakeContentVisible
PDOCMDsAreCurrentlyVisible
PDOCMDGetVisPolicy
PDOCMDGetOCGs
PDOCMDGetPDDoc

Cos conversion
PDOCMDGetCosObj
PDOCMDGetFromCosObj
Declarations
PDOCMDVisPolicy

Acrobat and PDF Library API Overview 133


Acrobat and PDF Library API Objects
3
PD Layer

PDPage
A single page in the PDF representation of a document. Just as PDF files are partially
composed of their pages, PDDocs are composed of PDPages. A page contains a series of
objects representing the objects drawn on the page (PDGraphic), a list of resources used
in drawing the page, annotations (PDAnnot), an optional thumbnail image of the page,
and the beads used in any articles that occur on the page. The first page in a PDDoc is page
0.
Obtaining
PDDocCreatePage
PDBeadAcquirePage
PDDocAcquirePage
AVPageViewGetPage
Disposing
PDDocDeletePages
PDPageRelease
Enumerating
PDPageEnumContents (Obsolete in Acrobat 4.0)
PDPageEnumOCGs
PDPageEnumResources
Attributes

Get Set
PDDocAcquirePage
PDPageAcquirePDEContent PDPageSetPDEContent
PDPageSetPDEContentCanRaise
PDPageGetAnnotIndex PDPageAddAnnot
PDPageGetAnnotSequence PDPageAddNewAnnot
PDPageCreateAnnot
PDPageRemoveAnnot
PDPageGetBBox
PDPageGetVisibleBBox
PDPageGetBox PDPageSetBox
PDPageGetCropBox PDPageSetCropBox
PDPageGetMediaBox PDPageSetMediaBox

134 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PD Layer

Get Set
PDPageGetCosResources PDPageAddCosResource
PDPageRemoveCosResource
PDPageDrawContentsToWindow PDPageAddCosContents
PDPageDrawContentsToWindowEx PDPageRemoveCosContents
PDPageDrawContentsWithParams
PDPageDrawContentsPlacedWithParams
PDPageGetDefaultMatrix
PDPageGetFlippedMatrix
PDPageGetDoc
PDPageGetDuration PDPageSetDuration
PDPageGetNumAnnots
PDPageGetNumber
PDPageGetOCGs
PDPageGetPalette
PDPageGetPDEContentFilters PDPageSetPDEContentFilters
PDPageGetPDEContentFlags PDPageSetPDEContentFlags
PDPageGetRotate PDPageSetRotate
PDPageGetTransition PDPageSetTransition
PDPageHasTransition
PDPageFlattenOC

Cos conversion
PDPageGetCosObj
Declarations
PDPageDrawFlags
PDPageMode
PDPageNumber
PDPageRange
PDPageStmToken

Acrobat and PDF Library API Overview 135


Acrobat and PDF Library API Objects
3
PD Layer

PDPageLabel
A label used to describe a page. This is used to allow for non-sequential page numbering or
the addition of arbitrary labels for a page (such as the inclusion of Roman numerals at the
beginning of a book). A PDPageLabel specifies the numbering style to use (for example,
upper- or lower-case Roman, decimal, and so forth), the starting number for the first page,
and an arbitrary prefix to be pre-appended to each number (for example, A- to generate
A-1, A-2, A-3, and so forth.)
Obtaining
PDDocGetPageLabel
PDDocGetLabelForPageNum
PDPageLabelFromCosObj
PDPageLabelNew
Disposing
PDDocRemovePageLabel
Attributes

Get Set
PDPageLabelEqual
PDDocSetPageLabel
PDDocRemovePageLabel
PDPageLabelGetStyle
PDPageLabelGetPrefix
PDPageLabelGetStart
PDDocFindPageNumForLabel

Cos conversion
PDPageLabelGetCosObj
Validity testing
PDPageLabelIsValid

136 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PD Layer

PDPath
A PDPath is a graphic object representing a path in a page description. Paths are arbitrary
shapes made of straight lines, rectangles, and cubic curves. Path objects can be stroked,
filled, and/or serve as a clipping path.
Enumerating
PDPathEnum
Attributes

Get Set
PDPathGetPaintOp

Declarations
PDPathEnumMonitor
PDPathPaintOp

Acrobat and PDF Library API Overview 137


Acrobat and PDF Library API Objects
3
PD Layer

PDStyle
Provides access to information about the fonts, font sizes, and colors used in a PDWord.
Obtaining
PDWordGetNthCharStyle
Attributes

Get Set
PDStyleGetColor
PDStyleGetFont
PDStyleGetFontSize

138 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PD Layer

PDText
A graphic object representing one or more character strings on a page in a PDF file. Like
paths, text can be stroked, filled, and/or serve as a clipping path.
Enumerating
PDTextEnum
Attributes

Get Set
PDTextGetState

Acrobat and PDF Library API Overview 139


Acrobat and PDF Library API Objects
3
PD Layer

PDTextAnnot
A PDF text annotation on a page in a PDF file. You can use any PDAnnot method on a
PDTextAnnot.
Applications can:
Get and set attributes including the rectangle, textual contents, and whether the
annotation is open.
Create new text annotations and delete or move existing ones using PDAnnot
methods.
Manipulate the behavior of text annotations by modifying the Text Annotation Handler.
Obtaining
Any of the PDAnnot calls, followed by CastToPDTextAnnot. The annotation passed
to CastToPDTextAnnot must be a text annotation, it will not convert other annotation
types into text annotations.
Disposing
PDPageRemoveAnnot
Attributes

Get Set
PDTextAnnotGetContents PDTextAnnotSetContents
PDTextAnnotIsOpen PDTextAnnotSetOpen
AVPageViewGetSelectedAnnotPageNum
AVPageViewSetAnnotLocation
PDAnnotEqual
PDAnnotGetColor PDAnnotSetColor
PDAnnotGetDate PDAnnotSetDate
PDAnnotGetFlags PDAnnotSetFlags
PDAnnotGetRect PDAnnotSetRect
PDAnnotGetSubtype
PDAnnotGetTitle PDAnnotSetTitle

140 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PD Layer

Cos conversion
PDAnnotGetCosObj
PDAnnotFromCosObj
Validity testing
PDAnnotIsValid

Acrobat and PDF Library API Overview 141


Acrobat and PDF Library API Objects
3
PD Layer

PDTextSelect
A selection of text on a single page, and may contain more than one disjoint group of
words. A text selection is specified by one or more ranges of text, with each range
containing the word numbers of the selected words. Each range specifies a start and end
word, where start is the first of a series of selected words and end is the first word not in
the series.
Obtaining
AVDocGetSelection
AVPageViewTrackText
PDDocCreateTextSelect
PDTextSelectCreatePageHilite
PDTextSelectCreatePageHiliteEx
PDTextSelectCreateWordHilite
PDTextSelectCreateWordHiliteEx
PDTextSelectCreateRanges
PDTextSelectCreateRangesEx
Disposing
PDTextSelectDestroy
Enumerating
PDTextSelectEnumQuads
PDTextSelectEnumText
Attributes

Get Set
PDTextSelectCreatePageHilite
PDTextSelectCreatePageHiliteEx
PDTextSelectCreateRanges
PDTextSelectCreateRangesEx
PDTextSelectCreateWordHilite
PDTextSelectCreateWordHiliteEx
PDTextSelectGetBoundingRect PDTextSelectGetBoundingRect
PDTextSelectGetPage
PDTextSelectGetRange
PDTextSelectGetRangeCount

142 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PD Layer

Declarations
PDTextSelectRange

Acrobat and PDF Library API Overview 143


Acrobat and PDF Library API Objects
3
PD Layer

PDThread
An article in Acrobats user interface, and contains an ordered sequence of rectangles that
bound the article. Each rectangle is called a bead. Threads can be created interactively by
the user, or programmatically.
Obtaining
PDDocGetThread
PDThreadNew
PDThreadFromCosObj
PDBeadGetThread
Disposing
PDDocRemoveThread
PDThreadDestroy
Attributes

Get Set
PDThreadGetFirstBead PDThreadSetFirstBead
PDThreadGetInfo PDThreadSetInfo
PDBeadInsert

Cos conversion
PDThreadGetCosObj
PDThreadFromCosObj
Validity testing
PDThreadIsValid

144 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PD Layer

PDThumb
A thumbnail preview image of a page.
Obtaining
PDDocCreateThumbs
Disposing
PDDocDeleteThumbs
Declarations
PDThumbCreationServer

Acrobat and PDF Library API Overview 145


Acrobat and PDF Library API Objects
3
PD Layer

PDTrans
A transition to a page. The Trans key in a Page dictionary specifies a Transition dictionary,
which describes the effect to use when going to a page and the amount of time the
transition should take.
Obtaining
PDPageGetTransition
PDTransFromCosObj
PDTransNew
PDTransNewFromCosDoc
PDTransNull
Attributes

Get Set
PDTransEqual
PDTransGetDuration
PDTransGetSubtype

Cos conversion
PDTransFromCosObj
PDTransGetCosObj
Validity testing
PDTransIsValid
Declarations
Transition Duration

146 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PD Layer

PDViewDestination
A particular view of a page in a document. It contains a reference to a page, a rectangle on
that page, and information specifying how to adjust the view to fit the windows size and
shape. It corresponds to a PDF Dest array and can be considered a special form of a
PDAction.
Obtaining
AVPageViewToViewDest
PDActionGetDest
PDViewDestCreate
PDViewDestFromCosObj
PDViewDestResolve
Disposing
PDViewDestDestroy
Attributes

Get Set
PDViewDestGetAttr

Cos Conversion
PDViewDestFromCosObj
PDViewDestGetCosObj
Validity testing
PDViewDestIsValid

Acrobat and PDF Library API Overview 147


Acrobat and PDF Library API Objects
3
PD Layer

PDWord
A word in a PDF file. Each word contains a sequence of characters in one or more styles (see
PDStyle).
Obtaining
PDWordFinderGetNthWord
PDWordFinderEnumWords
Enumerating
PDWordFinderEnumWords
Attributes

Get Set
PDWordGetAttr
PDWordGetCharacterTypes
PDWordGetCharDelta
PDWordGetCharOffset
PDWordGetCharOffsetEx
PDWordGetCharQuad
PDWordGetCharEncFlags
PDWordGetLength
PDWordGetNthCharStyle
PDWordGetNthQuad
PDWordGetNumQuads
PDWordGetNumHiliteChar
PDWordGetByteIdxFromHiliteChar
PDWordGetString
PDWordGetStyleTransition
PDWordIsCurrentlyVisible PDWordMakeVisible

Declarations
Word Attributes

148 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PD Layer

PDWordFinder
Extracts words from a PDF file, and enumerates the words on a single page or on all pages
in a document.
Obtaining
PDDocCreateWordFinderEx
PDDocCreateWordFinder
PDDocCreateWordFinderUCS
PDDocGetWordFinder
Disposing
PDWordFinderDestroy
Enumerating
PDWordFinderEnumWords
PDWordFinderEnumVisibleWords
Attributes

Get Set
PDWordFinderAcquireWordList PDWordFinderReleaseWordList
PDWordFinderGetLatestAlgVersion
PDWordFinderGetNthWord

Declarations
WordFinder Character Encoding Flags
WordFinder Sort Order Flags

Acrobat and PDF Library API Overview 149


Acrobat and PDF Library API Objects
3
PD Layer

PDXObject
A superclass used for PDF XObjects. Acrobat currently uses two XObject subclasses:
PDImage and PDForm. You can use any PDXObject method on these three objects.
Enumerating
PDXObjectEnumFilters
PDXObjectGetData
Attributes

Get Set
PDXObjectGetData
PDXObjectGetDataLength
PDXObjectGetSubtype

Cos Conversion
PDXObjectGetCosObj

150 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PDFEdit

P D F Ed i t
Provides easy access to PDF page contents. With PDFEdit, you can treat a pages contents as
a list of objectsrather than having to manipulate the content streams PDF marking
operators.
The PDFEdit API is meant to be used in conjunction with the Acrobat PDModel and Cos APIs
for manipulating PDF documents.
NOTE: The PDFEdit API is not available in Adobe Reader.

PDEBeginContainer
The PDFEdit representation of the opening bracket of a marked-content sequence.
Elements of this type must be paired with elements of type PDEEndContainer.
NOTE: The PDFEdit API is not available in Adobe Reader.
Subclass of
PDEElement
Obtaining
PDEBeginContainerCreate
Disposing
PDERelease
Attributes

Get Set
PDEBeginContainerGetDict PDEBeginContainerSetDict
PDEBeginContainerGetMCTag PDEBeginContainerSetMCTag

Acrobat and PDF Library API Overview 151


Acrobat and PDF Library API Objects
3
PDFEdit

PDEBeginGroup
A group of PDEElements on a page in a PDF file.
NOTE: The PDFEdit API is not available in Adobe Reader.
Subclass of
PDEElement
Obtaining
PDEBeginGroupCreate
Disposing
PDERelease

152 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PDFEdit

PDEClip
A list of PDEElements containing a list of PDEPaths and PDETexts that describe a clip
state. PDEClips can be created and built up with PDEClip methods. Any PDEElement
object can have PDEClip associated with it.
PDEClip objects can contain PDEContainers and PDEGroups to an arbitrary level of
nesting. This allows PDEContainers to be used to mark clip objects.
PDEGroups inside PDEClips that contain at least one PDEText and no PDEPaths
have a special meaning. All PDEText objects contained in such a PDEGroup are
considered to be part of the same BT/ET block. This means that the union of these
PDETexts makes up a single clipping pathas opposed to the intersection of the
PDETexts.
NOTE: The PDFEdit API is not available in Adobe Reader.
Obtaining
PDEClipCreate
PDEElementGetClip
Disposing
PDERelease
Enumerating
PDEClipFlattenedEnumElems
Attributes

Get Set
PDEClipGetElem
PDEClipGetNumElems
PDEClipAddElem
PDEClipRemoveElems

Acrobat and PDF Library API Overview 153


Acrobat and PDF Library API Objects
3
PDFEdit

PDEColorSpace
A reference to a color space used on a page in a PDF file. The color space is part of the
graphics state attributes of a PDEElement.
NOTE: The PDFEdit API is not available in Adobe Reader.
Obtaining
PDEColorSpaceCreate
PDEColorSpaceCreateFromName
PDEImageGetColorSpace
Disposing
PDERelease
Attributes

Get Set
PDEColorSpaceGetBase
PDEColorSpaceGetBaseNumComps
PDEColorSpaceGetCTable
PDEColorSpaceGetHiVal
PDEColorSpaceGetName
PDEColorSpaceGetNumComps

Cos conversion
PDEColorSpaceCreate
PDEColorSpaceGetCosObj
Declarations
PDEColorSpec
PDEColorValue

154 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PDFEdit

PDEContainer
A group of PDEElements on a page in a PDF file. In the PDF file, containers are delimited
by Marked Content BMC/EMC or BDC/EMC pairs. Every PDEContainer has a Marked
Content tag associated with it. In addition to grouping a set of elements, a BDC/EMC pair
specifies a property list to be associated with the grouping. Thus a PDEContainer
corresponding to a BDC/EMC pair also has a property list dictionary associated with it.
NOTE: The PDFEdit API is not available in Adobe Reader.
Subclass of
PDEElement
Obtaining
PDEContainerCreate
PDSMCGetPDEContainer
Disposing
PDERelease
Attributes

Get Set
PDEContainerGetContent PDEContainerSetContent
PDEContainerGetDict PDEContainerSetDict
PDEContainerGetMCTag PDEContainerSetMCTag

Acrobat and PDF Library API Overview 155


Acrobat and PDF Library API Objects
3
PDFEdit

PDEContent
Contains the modifiable contents of a PDPage. A PDEContent may be obtained from an
existing page or from a Form XObject or from a Type 3 CharProc. You can create an empty
PDEContent. A PDEContent contains PDEElements. In addition, a PDEContent may
have attributes such as Form matrix and setcachedevice parameters.
NOTE: The PDFEdit API is not available in Adobe Reader.
Obtaining
PDEContentCreate
PDEContainerGetContent
PDEContentCreateFromCosObj
PDEFormGetContent
PDPageAcquirePDEContent
Disposing
PDERelease
Attributes

Get Set
PDEContentGetAttrs
PDEContentGetElem
PDEContentGetNumElems
PDEContentGetResources
PDEContentAddElem
PDEContentRemoveElem
PDEContentFlattenOC

Cos conversion
PDEContentCreateFromCosObj
PDEContentToCosObj
Declarations
PDEContentAttrs
PDEContentFlags
PDEContentToCosObjFlags

156 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PDFEdit

PDEDeviceNColors
A color space with a variable number of device-dependent components. Usually used to
store multiple spot colors in a single color space.
NOTE: The PDFEdit API is not available in Adobe Reader.
Obtaining
PDEDeviceNColorsCreate
Attributes

Get Set
PDEDeviceNColorsGetColorValue

Acrobat and PDF Library API Overview 157


Acrobat and PDF Library API Objects
3
PDFEdit

PDEElement
The base class for elements of a page display list (PDEContent) and for clip objects. The
general PDEElement methods allow you to get and set general element properties.
NOTE: The PDFEdit API is not available in Adobe Reader.
Subclasses
PDEContainer
PDEForm
PDEGroup
PDEImage
PDEPath
PDEPlace
PDEPS
PDEShading
PDEText
PDEUnknown
PDEXObject
Obtaining
PDEClipGetElem
PDEContentGetElem
PDEElementCopy
Disposing
PDERelease
Attributes

Get Set
PDEElementGetBBox
PDEElementGetClip
PDEElementGetGState PDEElementSetGState
PDEElementGetMatrix PDEElementSetMatrix
PDEElementGetOCMD PDEElementRemoveOCMD
PDEElementSetOCMD
PDEElementIsAtPoint
PDEElementIsAtRect

158 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PDFEdit

Get Set
PDEElementIsCurrentlyVisible PDEElementMakeVisible
PDEElementGetAllVisibilities

Declarations
PDEElementCopyFlags
PDEEnumElementsFlags
PDEGraphicStateP
PDEGraphicStateWasSetFlags

Acrobat and PDF Library API Overview 159


Acrobat and PDF Library API Objects
3
PDFEdit

PDEEndContainer
The PDFEdit representation of the closing bracket of a marked-content sequence. Elements
of this type must be paired with elements of type PDEBeginContainer.
NOTE: The PDFEdit API is not available in Adobe Reader.
Subclass of
PDEElement
Obtaining
PDEEndContainerCreate
Disposing
PDERelease

160 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PDFEdit

PDEEndGroup
A group of PDEElements on a page in a PDF file.
NOTE: The PDFEdit API is not available in Adobe Reader.
Subclass of
PDEElement
Obtaining
PDEEndGroupCreate
Disposing
PDERelease

Acrobat and PDF Library API Overview 161


Acrobat and PDF Library API Objects
3
PDFEdit

PDEExtGState
A reference to an ExtGState resource used on a page in a PDF file. It specifies a
PDEElements extended graphics state, which is part of its graphics state.
NOTE: The PDFEdit API is not available in Adobe Reader.
Obtaining
PDEExtGStateCreate
Disposing
PDERelease
Attributes

Get Set
PDEExtGStateGetAIS PDEExtGStateSetAIS
PDEExtGStateGetBlendMode PDEExtGStateSetBlendMode
PDEExtGStateGetOpacityFill PDEExtGStateSetOpacityFill
PDEExtGStateGetOpacityStroke PDEExtGStateSetOpacityStroke
PDEExtGStateGetOPFill PDEExtGStateSetOPFill
PDEExtGStateGetOPM PDEExtGStateSetOPM
PDEExtGStateGetOPStroke PDEExtGStateSetOPStroke
PDEExtGStateGetSA PDEExtGStateSetSA
PDEExtGStateSetSoftMask
PDEExtGStateGetTK PDEExtGStateSetTK

Cos conversion
PDEExtGStateGetCosObj

162 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PDFEdit

PDEFont
A reference to a font used on a page in a PDF file. It may be equated with a font in the
system. A PDEFont is not the same as a PDFont; a PDFont is associated with a particular
document.
NOTE: The PDFEdit API is not available in Adobe Reader.
Obtaining
PDEFontCreate
PDEFontCreateFromCosObj
PDEFontCreateFromSysFont
PDEFontCreateFromSysFontEx
PDEFontCreateWithParams
PDETextGetFont
Disposing
PDERelease
Attributes

Get Set
PDEFontCreateWithParams
PDEFontEmbedNow
PDEFontEmbedNowDontSubset
PDEFontGetCreateNeedFlags
PDEFontGetNumCodeBytes
PDEFontGetOneByteEncoding
PDEFontGetSysEncoding PDEFontSetSysEncoding
PDEFontGetSysFont PDEFontSetSysFont
PDEFontGetWidths
PDEFontGetWidthsNow
PDEFontIsEmbedded
PDEFontIsMultiByte
PDEFontSubsetNow
PDEFontSumWidths

Acrobat and PDF Library API Overview 163


Acrobat and PDF Library API Objects
3
PDFEdit

Cos conversion
PDEFontCreateFromCosObj
PDEFontGetCosObj
Declarations
PDEFontAttrs
PDEFontCreateFlags
PDEFontInfoP

164 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PDFEdit

PDEForm
A PDEElement that corresponds to an instance of an XObject Form on a page (or other
containing stream such as another XObject Form or annotation form). The context
associated with this instance includes the actual CosObj stream that represents the
XObject Form and the initial conditions of the graphics state. The latter consists of the
transformation matrix, initial color values, and so forth. It is possible to have two
PDEForms that refer to the same XObject Form. The forms will exist at different places
on the same page, depending on the transformation matrix. They may also have different
colors or line stroking parameters. In the case of a transparency group, the opacity is
specified in the gstate.
Within a PDEForm, each PDEElement has its own gstate (or is a container, place, or
group object). These gstates are independent of the parent PDEForm gstate. PDEForm
elements within the PDEForm may have their own opacity.
A PDEContent may be obtained from a PDEForm to edit the forms display list.
NOTE: The PDFEdit API is not available in Adobe Reader.
Subclass of
PDEElement
Obtaining
PDEFormCreateFromCosObj
PDEFormCreateClone
Disposing
PDERelease
Attributes

Get Set
PDEFormGetContent PDEFormSetContent
PDEFormSetXGroup

Cos conversion
PDEFormCreateFromCosObj
PDEFormGetCosObj

Acrobat and PDF Library API Overview 165


Acrobat and PDF Library API Objects
3
PDFEdit

PDEGroup
An in-memory representation of objects in a PDEContent. It has no state and is not
represented in any way in a PDF content stream (that is, PDEContent).
When used in a PDEClip, this object is used to associate PDEText objects into a single
clipping object.
NOTE: The PDFEdit API is not available in Adobe Reader.
Obtaining
PDEGroupCreate
Attributes

Get Set
PDEGroupGetContent PDEGroupSetContent

166 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PDFEdit

PDEImage
A PDEElement that contains an Image XObject or in-line image. You can associate data
or a stream with an image.
NOTE: The PDFEdit API is not available in Adobe Reader.
Subclass of
PDEElement
Obtaining
PDEImageCreate
PDEImageCreateFromCosObj
Disposing
PDERelease
Attributes

Get Set
PDEImageDataIsEncoded
PDEImageGetAttrs
PDEImageGetColorSpace PDEImageSetColorSpace
PDEImageGetData PDEImageSetData
PDEImageGetDataLen
PDEImageGetDataStm PDEImageSetDataStm
PDEImageGetFilterArray
PDEImageGetMatteArray PDEImageSetMatteArray
PDEImageGetSMask PDEImageSetSMask
PDEImageIsCosObj

Cos conversion
PDEImageCreateFromCosObj
PDEImageGetCosObj
Declarations
PDEImageAttrFlags
PDEImageAttrs
PDEImageDataFlags

Acrobat and PDF Library API Overview 167


Acrobat and PDF Library API Objects
3
PDFEdit

PDEImageFlate
A PDEElement representing a flate (ZIP) graphic object.
NOTE: The PDFEdit API is not available in Adobe Reader.
Obtaining
PDEImageAcquireImageFlate
Disposing
PDERelease
Enumerating
PDEObjectDump
Attributes

Get Set
PDEImageFlateGetAttrs

Cos Conversion
PDEImageFlateGetCosObj

168 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PDFEdit

PDEImageJPX
A PDEElement representing a JPX graphic object.
NOTE: The PDFEdit API is not available in Adobe Reader.
Obtaining
PDEImageAcquireImageJPX
Disposing
PDERelease
Enumerating
PDEObjectDump
Attributes

Get Set
PDEImageJPXGetAttrs

Cos Conversion
PDEImageFlateGetCosObj

Acrobat and PDF Library API Overview 169


Acrobat and PDF Library API Objects
3
PDFEdit

PDEObject
The abstract super class of PDFEdit classes. You can find the type of any object with the
PDEObjectGetType method. You can then cast and apply that classs methods to the
object. In addition, you can cast any of the PDFEdit objects to a PDEObject and use it
anywhere a PDEObject is called for, such as in the PDEObject methods.
NOTE: The PDFEdit API is not available in Adobe Reader.
Obtaining
Various since all PDFEdit objects are PDEObjects.
Disposing
PDERelease
Enumerating
PDEObjectDump
Attributes

Get Set
PDEGetTag PDEAddTag
PDERemoveTag
PDEObjectGetType
PDEAcquire
PDERelease

Declarations
PDEType

170 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PDFEdit

PDEPath
A PDEElement that contains a path. Path objects can be stroked, filled, and/or serve as a
clipping path.
NOTE: The PDFEdit API is not available in Adobe Reader.
Subclass of
PDEElement
Obtaining
PDEPathCreate
Disposing
PDERelease
Attributes

Get Set
PDEPathGetData PDEPathSetData
PDEPathGetPaintOp PDEPathSetPaintOp
PDEPathAddSegment

Declarations
PDEPathElementType
PDEPathOpFlags

Acrobat and PDF Library API Overview 171


Acrobat and PDF Library API Objects
3
PDFEdit

PDEPattern
A reference to a Pattern resource used on a page in a PDF file.
NOTE: The PDFEdit API is not available in Adobe Reader.
Obtaining
PDEPatternCreate
Disposing
PDERelease
Cos conversion
PDEPatternGetCosObj

172 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PDFEdit

PDEPlace
A PDEElement that marks a place on a page in a PDF file. In a PDF file, a place is
represented by the MP or DP Marked Content operators.
Marked content is useful for adding structure information to a PDF file. For instance, a
drawing program may want to mark a point with information, such as the start of a path of
a certain type. Marked content provides a way to retain this information in the PDF file. A
DP operator functions the same as the MP operator and, in addition, allows a property list
dictionary to be associated with a place.
NOTE: The PDFEdit API is not available in Adobe Reader.
Subclass of
PDEElement
Obtaining
PDEPlaceCreate
Disposing
PDERelease
Attributes

Get Set
PDEPlaceGetDict PDEPlaceSetDict
PDEPlaceGetMCTag PDEPlaceSetMCTag

Acrobat and PDF Library API Overview 173


Acrobat and PDF Library API Objects
3
PDFEdit

PDEPS
Element representing in-line or XObject pass-through PostScript object. XObject
PostScripts are listed in page XObject resources.
NOTE: The PDFEdit API is not available in Adobe Reader.
Subclass of
PDEElement
Obtaining
PDEPSCreate
PDEPSCreateFromCosObj
Attributes

Get Set
PDEPSGetAttrs
PDEPSGetData PDEPSSetData
PDEPSGetDataStm PDEPSSetDataStm

Cos conversion
PDEPSCreateFromCosObj

174 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PDFEdit

PDEShading
A PDEElement that represents smooth shading.
NOTE: The PDFEdit API is not available in Adobe Reader.
Obtaining
PDEShadingCreateFromCosObj
Cos conversion
PDEShadingCreateFromCosObj
PDEShadingGetCosObj

Acrobat and PDF Library API Overview 175


Acrobat and PDF Library API Objects
3
PDFEdit

PDESoftMask
Object for creating and manipulating a soft mask in a PDF file.
NOTE: The PDFEdit API is not available in Adobe Reader.
Subclass of
PDEElement
Obtaining
PDESoftMaskCreate
PDESoftMaskCreateFromCosObj
PDESoftMaskCreateFromName
Disposing
PDERelease
Attributes

Get Set
PDESoftMaskAcquireForm
PDESoftMaskGetBackdropColor PDESoftMaskSetBackdropColor
PDESoftMaskGetCosObj
PDESoftMaskGetName
PDESoftMaskGetTransferFunction PDESoftMaskSetTransferFunction
PDESoftMaskSetXGroup

Cos conversion
PDESoftMaskGetCosObj
PDESoftMaskCreateFromCosObj

176 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PDFEdit

PDEText
A PDEElement representing text. It is a container for text as show strings or as individual
characters. Each sub-element may have different graphics state properties. However, the
same clip applies to all sub-elements of a PDEText. Also, the charpath of a PDEText
can be used to represent a clip.
NOTE: The PDFEdit API is not available in Adobe Reader.
Subclass of
PDEElement
Obtaining
PDETextCreate
Disposing
PDERelease
Attributes

Get Set
PDETextGetAdvance
PDETextGetAdvanceWidth
PDETextGetBBox
PDETextGetFont PDETextRunSetFont
PDETextGetGState PDETextRunSetGState
PDETextGetItem PDETextAddItem
PDETextRemoveItems
PDETextGetMatrix
PDETextGetNumBytes
PDETextGetNumRuns
PDETextGetQuad
PDETextGetRunForChar
PDETextGetStrokeMatrix PDETextRunSetStrokeMatrix
PDETextGetState PDETextRunSetState
PDETextGetText

Acrobat and PDF Library API Overview 177


Acrobat and PDF Library API Objects
3
PDFEdit

Get Set
PDETextGetTextMatrix PDETextRunSetTextMatrix
PDETextGetTextState PDETextRunSetTextState
PDETextRunGetCharOffset
PDETextRunGetNumChars
PDETextRunSetMatrix
PDETextRunSetState
PDETextRunSetMatrix
PDETextRunSetStrokeMatrix
PDETextIsAtPoint
PDETextAdd
PDETextIsAtPoint
PDETextReplaceChars
PDETextSplitRunAt

Declarations
PDEGraphicStateP
PDEGraphicStateWasSetFlags
PDETextFlags
PDETextRenderMode
PDETextState
PDETextStateWasSetFlags

178 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PDFEdit

PDETextItem
A PDEElement representing a text object.
NOTE: The PDFEdit API is not available in Adobe Reader.
Subclass of
PDEElement
Obtaining
PDETextItemCreate
PDETextGetItem
Attributes

Get Set
PDETextItemCopyText
PDETextItemGetFont PDETextItemSetFont
PDETextItemGetGState PDETextItemSetGState
PDETextItemGetTextLen
PDETextItemGetTextMatrix PDETextItemSetTextMatrix
PDETextItemGetTextState PDETextItemSetTextState
PDETextItemRemoveChars
PDETextItemReplaceChars
PDETextItemReplaceText

Acrobat and PDF Library API Overview 179


Acrobat and PDF Library API Objects
3
PDFEdit

PDEUnknown
A PDEElement representing an unknown element.
NOTE: The PDFEdit API is not available in Adobe Reader.
Subclass of
PDEElement
Attributes

Get Set
PDEUnknownGetOpName

180 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PDFEdit

PDEXGroup
A transparency (XGroup) resource.
NOTE: The PDFEdit API is not available in Adobe Reader.
Subclass of
PDEElement
Obtaining
PDEXGroupCreate
PDEXGroupCreateFromCosObj
Disposing
PDERelease
Attributes

Get Set
PDEXGroupAcquireColorSpace
PDEXGroupGetCosObj
PDEXGroupGetIsolated PDEXGroupSetIsolated
PDEXGroupGetKnockout PDEXGroupSetKnockout
PDEXGroupSetColorSpace

Cos conversion
PDEXGroupGetCosObj
PDEXGroupCreateFromCosObj

Acrobat and PDF Library API Overview 181


Acrobat and PDF Library API Objects
3
PDFEdit

PDEXObject
A PDEElement representing an arbitrary XObject.
NOTE: The PDFEdit API is not available in Adobe Reader.
Subclass of
PDEElement
Obtaining
PDEXObjectCreate
Disposing
PDERelease
Cos conversion
PDEXObjectGetCosObj

182 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PDFEdit

PDSysEncoding
A PDEElement that provides system encoding for a PDF file.
NOTE: The PDFEdit API is not available in Adobe Reader.
Subclass of
PDEElement
Obtaining
PDSysEncodingCreateFromBaseName
PDSysEncodingCreateFromCMapName
PDSysEncodingCreateFromCodePage
PDEFontGetSysEncoding
Disposing
PDERelease
Attributes

Get Set
PDSysEncodingGetWMode

Acrobat and PDF Library API Overview 183


Acrobat and PDF Library API Objects
3
PDFEdit

PDSysFont
A reference to a font installed in the host system. PDSysFont methods allow you to list
the fonts available in the host system and to find a font in the system that matches a
PDEFont, if it is present.
NOTE: The PDFEdit API is not available in Adobe Reader.
Obtaining
PDEnumSysFonts
PDFindSysFont
PDFindSysFontEx
PDFindSysFontForPDEFont
PDEFontGetSysFont
Enumerating
PDEnumSysFonts
Attributes

Get Set
PDSysFontAcquirePlatformData PDSysFontReleasePlatformData
PDSysFontGetAttrs
PDSysFontGetCIDSystemInfo
PDSysFontGetCreateFlags
PDSysFontGetEncoding
PDSysFontGetInfo
PDSysFontGetName
PDSysFontGetType0Widths
PDSysFontGetWidths
PDSysFontGetWidthsEx
PDEmbedSysFontForPDEFont

Declarations
PDSysFontMatchFlags

184 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PDSEdit

P D S Ed i t
The creation and manipulation of logical structure in PDF documents.
NOTE: The write functions in the PDSEdit API are not available in Adobe Reader.

PDSAttrObj
Represents PDF logical structure attribute objects, which are dictionaries containing
application-specific data that can be attached to PDSElements.
NOTE: The write functions in the PDSEdit API are not available in Adobe Reader.
Obtaining
PDSAttrObjCreate
PDSAttrObjCreateFromStream
PDSClassMapGetAttrObj
PDSElementGetAttrObj
Disposing
PDSElementRemoveAttrObj
PDSElementRemoveAllAttrObjs
Attributes

Get Set
PDSAttrObjGetCosObj
PDSAttrObjGetOwner

Acrobat and PDF Library API Overview 185


Acrobat and PDF Library API Objects
3
PDSEdit

PDSClassMap
Associates class identifiers, which are names, with objects of type PDSAttrObj. Structural
elements maintain a list of names identifying classes to which they belong. The associated
attributes are thus shared by all structural elements belonging to a given class. There is one
class map per document, associated with the PDSTreeRoot.
NOTE: The write functions in the PDSEdit API are not available in Adobe Reader.
Obtaining
PDSTreeRootCreateClassMap
PDSTreeRootGetClassMap
Disposing
PDSTreeRootRemoveClassMap
Attributes

Get Set
PDSClassMapAddAttrObj
PDSClassMapRemoveAttrObj
PDSClassMapGetAttrObj
PDSClassMapGetNumAttrObjs

186 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PDSEdit

PDSElement
Represents PDF structural elements, which are nodes in a tree giving a PDF documents
logical structure.
NOTE: The write functions in the PDSEdit API are not available in Adobe Reader.
Obtaining
PDSElementCreate
PDSElementGetParent
PDSMCGetInfo
PDSOBJGetParent
PDSTreeRootGetElementFromID
Attributes

Get Set
PDSElementAddAttrObj
PDSElementRemoveAttrObj
PDSElementRemoveAllAttrObjs
PDSElementAddClass
PDSElementRemoveClass
PDSElementRemoveAllClasses
PDSElementGetActualText PDSElementSetActualText
PDSElementGetAlt PDSElementSetAlt
PDSElementGetAttrObj
PDSElementGetNumAttrObjs
PDSElementGetClass
PDSElementGetNumClasses
PDSElementGetCosObj
PDSElementGetFirstPage
PDSElementGetID PDSElementClearID
PDSElementSetID

Acrobat and PDF Library API Overview 187


Acrobat and PDF Library API Objects
3
PDSEdit

Get Set
PDSElementGetKid PDSElementInsertKid
PDSElementGetKidEx PDSElementInsertMCAsKid
PDSElementGetKidWithMCInfo PDSElementInsertOBJAsKid
PDSElementGetNumKids PDSElementInsertStmMCAsKid
PDSElementGetParent PDSElementReplaceKid
PDSElementRemoveKid
PDSElementRemoveKidOBJ
PDSElementRemoveKidMC
PDSElementReplaceKidMC
PDSElementGetLanguage PDSElementSetLanguage
PDSElementGetRevision PDSElementIncrementRevision
PDSElementGetTitle PDSElementSetTitle
PDSElementGetType PDSElementSetType

188 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PDSEdit

PDSMC
Represents marked contentportions of the graphic content of a PDF document that may
be included in the documents logical structure hierarchy. This type is identical with the
PDFEdit layer type PDEContainer.
NOTE: The write functions in the PDSEdit API are not available in Adobe Reader.
Attributes

Get Set
PDSMCGetInfo
PDSMCGetParent
PDSMCIDGetParent
PDSMCGetPDEContainer

Declarations
PDSMCInfo

Acrobat and PDF Library API Overview 189


Acrobat and PDF Library API Objects
3
PDSEdit

PDSRoleMap
Represents mappings of structural element types present in a PDF document to standard
element types having similar uses. There is one PDSClassMap per document, associated
with the PDSTreeRoot.
NOTE: The write functions in the PDSEdit API are not available in Adobe Reader.
Obtaining
PDSRoleMapCopy
PDSTreeRootCreateRoleMap
PDSTreeRootGetRoleMap
Disposing
PDSTreeRootRemoveRoleMap
Attributes

Get Set
PDSRoleMapCopy
PDSRoleMapGetDirectMap
PDSRoleMapDoesMap PDSRoleMapMap
PDSRoleMapUnMapDst
PDSRoleMapUnMapSrc

190 Acrobat and PDF Library API Overview


Acrobat and PDF Library API Objects
3
PDSEdit

PDSTreeRoot
The root of the structure tree, which is a central repository for information related to a PDF
documents logical structure. There is at most one PDSTreeRoot in each document.
NOTE: The write functions in the PDSEdit API are not available in Adobe Reader.
Obtaining
PDDocCreateStructTreeRoot
PDDocGetStructTreeRoot
Disposing
PDDocRemoveStructTreeRoot
Attributes

Get Set
PDSTreeRootGetClassMap PDSTreeRootRemoveClassMap
PDSTreeRootGetElementFromID
PDSTreeRootGetKid PDSTreeRootInsertKid
PDSTreeRootRemoveKid
PDSTreeRootGetNumKids
PDSTreeRootGetRoleMap PDSTreeRootRemoveRoleMap
PDSTreeRootReplaceKid
PDSTreeRootReplaceStreamRef

Acrobat and PDF Library API Overview 191


Acrobat and PDF Library API Objects
3
PDSEdit

192 Acrobat and PDF Library API Overview


4 Overview of the Acrobat Extended
APIs

Some of Acrobats default plug-ins expose their APIs for use by third parties. These are
Acrobats extended APIs. They are described in this chapter. The AcroColor extended API is
the only extended API that is not in a plug-in: it is part of the Acrobat core, but is considered
an extended API because it does not cleanly fit into the layered structure of the core. The
actual APIs themselves are documented in the Acrobat and PDF Library API Reference. An
overview is provided here. The extended APIs are the following:
Search Extended API
Catalog Extended API
PDF Consultant (Scrubber) and Accessibility Checker Extended API
Digital Signature (DigSig) Extended API
Forms Extended API
Weblink Extended API
Spelling Extended API
AcroColor Extended API

Search Extended API


The Adobe Acrobat Search plug-in allows users to perform text searches in PDF
documents. It adds menus, menu items, toolbar button, and a Search panel to the Acrobat
viewer.
The Search plug-in exports a Host Function Table (HFT) containing several methods that
can be used by other plug-ins.
The HFTs name is Search, and its version number is 0. To use the Search plug-ins HFT, a
plug-in must include the header file SrchClls.h. The plug-in must also import the HFT
using ASExtensionMgrGetHFT and assign the HFT returned by this call to a plug-in-
defined global variable named gSearchHFT.
Acrobat 6.0 and later has two versions of the Search plug-in, Search (new in Acrobat 6.0)
and Search5 (also available in Acrobat 5.0).
The Search plug-in uses a search engine licensed from Lextek International. Lextek can
be contacted at http://www.lextek.com.
The Search5 plug-in uses a search engine licensed from Verity, Inc. Verity can be
contacted at http://www.verity.com.
You can do the following with either version of the Search plug-in:
Create or delete indexes

Acrobat and PDF Library API Overview 193


Overview of the Acrobat Extended APIs
4
Search Extended API

Ask what indexes are available


Send queries to an existing index
You cannot use either version of the Search plug-in to directly obtain the results of a search,
for manipulation or for display in an application other than Adobe Acrobat.
Search supports interapplication communication (IAC) in the form of Apple events on the
Macintosh and DDE messages under the Windows operating system. These Apple events
and DDE messages allow remote clients to submit search queries and manipulate a list of
indexes (the list of indexes is referred to as the shelf ).

Search DDE
This technical note describes the Search HFT. The IAC APIs supported by the Acrobat Search
plug-in are described in the Acrobat IAC Overview and the Acrobat IAC Reference.

Search APIs
The Search APIs include:

SearchAddIndex
SearchAddIndexEx
SearchCountIndexList
SearchExecuteQuery
SearchExecuteQueryEx
SearchGetIndexByPath
SearchGetIndexByPathEx
SearchGetIndexFlags
SearchGetIndexList
SearchGetIndexPath
SearchGetIndexPathEx
SearchGetIndexFileSys
SearchGetIndexTitle
SearchGetIndexTitleEx
SearchGetNthIndex
SearchIsLegacySearchAvailable

194 Acrobat and PDF Library API Overview


Overview of the Acrobat Extended APIs
4
Catalog Extended API

SearchRemoveIndex
SearchSetIndexFlags

Catalog Extended API


Acrobat Catalog is a plug-in that allows you to create a full-text index of a set of PDF
documents. A full-text index is a searchable database of all the text in the documents. After
building an index, you can use the Search command to search the entire library quickly.
Searches of full-text indexes created using Catalog are faster and more convenient than
using the Find command.
The Catalog plug-in has an HFT consisting of several methods that plug-in developers can
import and use. In addition, Catalog supports DDE, and broadcasts several Windows
messages.
NOTE: In Acrobat 4.0, Catalog was a separate application. Since Acrobat 5.0, it has been
part of the Acrobat application. For information on using Catalog and setting its
preferences, refer to Complete Acrobat 7.0 Help from Acrobats Help menu.

Catalog DDE
This technical note describes the Catalog HFT. The IAC APIs supported by the Acrobat
Catalog plug-in are described in the Acrobat IAC Overview and the Acrobat IAC Reference.

Catalog APIs
The Catalog APIs include:

CatalogActivate
CatalogBuildIndex
CatalogGiveStatus
CatalogLoadIndex
CatalogPurgeIndex

PDF Consultant (Scrubber) and Accessibility Checker Extended API


Acrobat comes with a plug-in called the PDF Consultant and Accessibility Checker. This
plug-in walks through PDF documents, visiting each object and determining its type and

Acrobat and PDF Library API Overview 195


Overview of the Acrobat Extended APIs
4
PDF Consultant (Scrubber) and Accessibility Checker Extended API

other statistics. It can make certain modifications or repairs to the PDF document. The
objects that the Consultant visits can range from simple, primitive types such as CosStrings
to higher-level objects such as Images. Users call the Consultant to run on a particular PDF
document, choose which tests or repairs to run, then view the results and/or select repair
options.
The Consultant visits the objects in a PDF document according to instructional flags you
pass to it. After the Consultant has visited an object, the object may be different. The
Consultant reclassifies modified objects before moving on to the next object.
As the Consultant traverses a PDF document, gathering objects of interest, it can perform
the following functions:
walk a given hierarchy
keep track of cycles
ensure that objects are only visited once, if desired
recognize object types
keep a traversal stack list

Acrobat Agents
The Consultant accomplishes its task by using Agents, which are pieces of code you design
to gather the statistics and recommend to the Consultant the necessary repairs of the
document. Separate Agents handle each area of analysis and repair. The Agents inform the
Consultant of the particular types of objects in which they are interested by registering
with the Consultant. When the Consultant has one or more Agents registered, it hands each
object of the requested type(s) in the current document to each of the Agents that
requested that type. The Consultant gives objects to each Agent in turn, depending on the
order in which they registered.
The Consultant must intelligently determine the type of each object it comes across (both
direct and indirect), so it can pass appropriate objects to the Agents, or replace or remove
ones that it has been instructed to handle itself. The Consultant communicates directly
with Agents, keeping lists of which Agents are interested in which objects, and obtaining
instructions from the Agent as to an objects visitation status.
Agents can perform their own repairs and modifications to the PDF document, and can
return a corrected object to serve as a replacement for the object the Consultant originally
passed to it. Agents can also modify the Cos graph themselves (including adding or
removing Cos objects or modifiying the contents such as keys or array elements).
The Consultant keeps a list of each object (starting with the object which began the
traversal) that it visits on its way to any given object. Agents must be careful not to make
any modifications that would affect any of the objects in this list, which is referred to as the
traversal stack. For this reason, Agents can specify a post-processing callback that the
Consultant calls once it has finished traversing the entire document. See Important Issues
For Consultant Development for more detailed information on this point.

196 Acrobat and PDF Library API Overview


Overview of the Acrobat Extended APIs
4
PDF Consultant (Scrubber) and Accessibility Checker Extended API

Reclassifying and Revisiting


If an Agent or the Consultant itself modifies an object, the Consultant reclassifies that
object, possibly changing its type.
Agents also pass to the Consultant the visitation flags that determine how object types
should be visited. Limiting the traversal is important, as PDF documents are graphs,
arbitrarily complex, and often there are many ways to visit a single object. If the Consultant
has reclassified an object, it may also change the way that object is revisited. You must keep
this in mind as you develop your Agents.
Agent Architecture
Your Agent code will primarily consist of a structure, as defined in the ConsExpt.h
header file. Acrobat provides a C++ wrapper class to facilitate writing agents; you can
derive an agent class from this base class. See Creating Your Agent Class for an example
agent from which you can generalize.

How the Consultant Works


The Consultant completes a full, non-recursive traversal of the Cos graph that comprises a
PDF document, keeping track of cycles as it goes. Note that there is no guarantee that
objects will be visited in any particular order, only that the Consultant will visit all objects
(except isolated objects such as the DocInfo object or previously orphaned objects) at least
once, provided no Agents modify the graph such that graph paths are removed or
redirected.
Removing or Modifying Objects
If an Agent removes, replaces or modifies an object, the Consultant will pass to other
Agents the modified objects (if they are encountered). For example, Dict A refers to Dict
B.The first Agent replaces all references to Dict B with references to Dict C,so when later
agents receive Dict A from the Consultant, they will see the references to Dict C.
Reclassifying Objects
In general, the Consultant reclassifies an object after an Agent is finished performing
operations on it. It is possible that, in the process of modifying the object, the Agent may
actually have changed the type of the object. This could mean that Agents originally
interested in the object might no longer wish to see it. So the Consultant must reclassify an
object after each Agent has finished with it. Since the default behavior in "revisit upon
reclassification" mode is to revisit objects when they are reclassified, new objects added in
this mode will actually be visited again if they are reclassified as the traversal continues.
Determining the higher-level type (the PDFObjType, as the Consultant code calls it) of a
given Cos object is not always easy. The Consultant not only looks at construction of
objects (what keys are present in the object) but also at how the object was reached
(through what particular object type and via what keys). Objects that are interpreted
differently depending on how they are traversed can be properly identified. For example, if
the Consultant is looking at an object containing "/Type /Annot" and "/Subtype /Widget" it
is clear that the object is a Widget Annotation; however, when traversed via the AcroForms

Acrobat and PDF Library API Overview 197


Overview of the Acrobat Extended APIs
4
PDF Consultant (Scrubber) and Accessibility Checker Extended API

section, that same object is actually a form field. It is because of such possible dualities that
the Consultant can operate in a "revisit upon reclassify" mode that would visit the above
object twice: once as a Widget Annotation and again as a form field.
Consultant Itinerary
The Consultant process works like this (See the Acrobat and PDF Library API Reference for
details on how to write the actual code to do these steps.):
1. You create a Consultant.
2. You create an Agent.
3. Register your Agent with the Consultant, with information as to which object types are
of interest.
4. The user calls the Consultant to work on a particular PDF document.
5. The Consultant creates a traversal stack to keep track of where it is in walking through
the PDF document.
6. The Consultant begins traversing the PDF document. If Agents have instructed the
Consultant to modify or remove the object, it does so, returning the appropriate
replacement.
7. The Consultant pushes the object onto the traversal stack and sends a message to the
Agent that the object was found.
8. The Agent sends messages to the Consultant about what to do to objects: replace them,
remove them, revisit them later or not.
9. When the entire PDF document has been traversed, the Consultant calls the Agent back
to perform any postprocessing repairs it might want to do.
10.Consultant unregisters all Agents.
11.Remove the Agent object.
12.Remove the Consultant object.

Important Issues For Consultant Development


First, you must decide if you actually do want to use the Consultant. The Consultant walks
through an entire PDF document. If you only need to modify a small number of objects,
and you know how to locate those objects, it makes more sense to write the object-finding
code yourself.
If you do decide to use the Consultant, there are a number of issues that are important to
keep in mind when you are developing your Agent. You should make your decisions about
all of these issues before you write your code, so you will know exactly what to expect.
Some of these issues lead to errors that are difficult to debug, so it is best to understand
them all while creating your plug-in.

198 Acrobat and PDF Library API Overview


Overview of the Acrobat Extended APIs
4
PDF Consultant (Scrubber) and Accessibility Checker Extended API

Agents must not modify objects on the traversal stack while the Consultant is still
walking through the document, otherwise infinite loops and other problems can occur.
Decide which piece of code is actually going to do the workthe Consultant or the
Agentin order to optimize your plug-in.
The order in which Agents interact with the Consultant is very important, as Agents can
modify objects that other Agents want to see.
Maintaining the Traversal Stack
The Consultant keeps track of the objects it has visited in the PDF document in the traversal
stack. If an Agent were to modify an object such that it affected the traversal stack, the
entire process would be derailed.The Consultant might no longer know if it had visited an
object, which could cause infinite loops, multiple, unnecessary visitations, or objects that
remain unvisited. It is extremely important that the integrity of the traversal stack remain
undamaged. You must design your Agent carefully so as to avoid this problem. You can use
the postprocessing step of your Agent to handle many repair tasks, thereby avoiding
dealing with objects still on the traversal stack.
Deciding Who Does The Work
If the Consultant performs object modifications it does so as it goes through its traversal.
Modifications that might affect the objects type or properties would alter the traversal
stack and corrupt the traversal process. For these kinds of modifications, set up an Agent to
perform the tasks in the postprocessing step.
For instance, suppose an Agent wants to remove annotations while there are form widgets
present in the document. There are a few ways the Agent can remove the annotions while
the Consultant is working, but they all have problems:
Calling the Agent for all annotations and removing them at the Cos level does not clean
up the forms tree if there are Widget Annots in the document.
Calling the Agent for all Annots and using PDPageAnnotRemove modifies the page
object, which might still be in the traversal stack.
The best solution in this case is to enumerate all of the Annot objects by having the
Consultant look for Annot objects and keep a list of them, then let the Agent call
PDPageAnnotRemove on them in the postprocessing step.
Avoiding Agent Collisions
When running multiple Agents on a document, the order in which you register your Agents
is the order in which the Consultant will hand them objects. If your earlier Agents modify
objects, they may change the objects in such a way that they are missing important
information or are of a different type than they were originally. For example, one Agent
might consider it correct to remove a given field of an object, while another would
complain that the field was not present and would want to add it. If the first Agent modified
an object with respect to its type, subsequent Agents would no longer think they were
interested in it, and their processing would not take place. You must group your Agents so
that you do not run multiple Agents with conflicting goals at the same time.

Acrobat and PDF Library API Overview 199


Overview of the Acrobat Extended APIs
4
PDF Consultant (Scrubber) and Accessibility Checker Extended API

A rarer problem could occur with self-referential objects. For example, if Dict A contains a
reference to itself and the first Agent replaces Dict A with Dict B (which would still contain a
reference to Dict A), another Agent cannot work with Dict B until the internal reference is
changed. But if you are running the Agents concurrently, there will be a collision. This
would be a case best handled by the Consultant.
Avoiding Visitation Collisions
Objects that have multiple classifications can be reached from multiple paths. In such cases
you might allow the Consultant to revisit such objects if, and only if, they have been
reclassified on a new path. However, you must take care not to allow revisitation under
other circumstances, or the Consultant could miss objects, which would defeat the reason
for using a mode that considers object classification.

Importing the Consultant HFTs Into a Plugin


The Consultant exports its functions via an HFT. The variable name your plugin uses for the
HFT must be of type HFT and named gConsultantHFT. Your SDK provides a macro,
InitPDFConsultantHFT, in ConsHFT.h , for easy initialization of the HFT variable; see
Example: Importing Consultant HFTs.
The Consultants HFT allows you to create Consultants. (See Creating and Destroying
Consultants for more details.) The Consultant exports an HFT that deals with the general
operation of the Consultant, including the creation and deletion of Consultant objects and
Agent registration. Naturally, you must load the Consultant plugin before the HFTs
plugins can import it. Importing the Consultants HFT is the same as importing any other
plugins HFT. Refer to the Acrobat SDK Plug-in Guide.
To get access to the HFT, you must include ConsHFT.h for the core Consultant API. In a
plugin, the importReplaceAndRegisterCallback should contain the code that
imports the HFT; see the following example.
Example: Importing Consultant HFTs

HFT gConsultantHFT= (HFT)NULL;

ACCB1 ASBool ACCB2 DumpAllObjectsAgentImportHFTs( void )


{
ASBool bRetVal = false;
/* Import the Consultant's main HFT */
gConsultantHFT = Init_PDFConsultantHFT; /* Macro in ConsHFT.h */
if(gConsultantHFT != (HFT)NULL)
bRetVal = true;
else
// Put in error message about the absence of the Consultant HFT...
return bRetVal;
};

200 Acrobat and PDF Library API Overview


Overview of the Acrobat Extended APIs
4
PDF Consultant (Scrubber) and Accessibility Checker Extended API

HFT Functions
The Consultant defines the following functions for HFT usage:
ConsultantCreate
ConsultantDestroy
ConsultantTraverseFrom
ConsultantRegisterAgent
ConsultantSetStart
ConsultantNextObj
ConsultantGetPercentDone
ConsultantGetNumDirectVisited
ConsultantGetNumIndirectVisited
ConsultantSuspend
ConsultantResume
ConsStackGetCount
ConsStackIndexGetObj
ConsStackIndexGetTypeCount
ConsStackIndexGetTypeAt
ConsStackIndexIsDict
ConsStackIndexIsArray
ConsStackIndexGetDictKey
ConsStackIndexGetArrayIndex
PDFObjTypeGetSuperclass
ConsultantGetNumUniqueIndirectsVisited

Creating and Destroying Consultants


The Consultants HFT allows you create a Consultant for your own use. Once you have
finished writing your Agent class, you are ready to register it with the Consultant and
begin processing documents. You should keep your Agent separate from the Consultant
objectthat is, do not make the Consultant object a member of your Agent class. Use a
plugin as the owner for both the Consultant and your Agent object.
As there is some memory overhead in creating a Consultant, create a Consultant object
only when it is needed, not before. If your target application is a plugin, the most logical
place to perform all operations is in the menu item execute procedure. Whether or not it
makes sense to destroy the Consultant object after each execution of the menu item
depends on your project.
The Consultant HFT provides the functions ConsultantCreate and
ConsultantDestroy, for creating and destroying Consultant objects. It also provides
the Consultant data type, an opaque type for passing handles to Consultant objects.
ConsultantCreate returns variables of that type and requires them as parameters to all
other HFT functions having the prefix Consultant.
After each run the Consultant unregisters all the Agents that were registered with it;
however the memory for the Consultant object itself remains, and the object must be
explicitly destroyed to free it. Depending on the duties you assign your Consultant, you
may want to destroy it after each execution of the menu item that launches it, or you may

Acrobat and PDF Library API Overview 201


Overview of the Acrobat Extended APIs
4
PDF Consultant (Scrubber) and Accessibility Checker Extended API

wish to keep it running. See Example: Registering An Agent With A Consultant for an
illustration of creating and destroying a Consultant object.

Registering Agents With The Consultant


Although it is not an error condition for the Consultant to be run on a document when
there are no Agents registered, in order to perform any operations on or analysis of the
document you must first register your Agent with the Consultant, using the method
ConsultantRegisterAgent.
Once the Agent is registered with the Consultant, it remains registered until a call to
ConsultantTraverseFrom is completed. You must re-register Agents before each
successive call to ConsultantTraverseFrom.
When you register an agent, you supply a rule (one of the RegAgentFlag values) for
revisitation of objects as the Consultant runs through the document from the starting
object.
The following example demonstrates registering and running the Consultant.
Example: Registering An Agent With A Consultant

ACCB1 void ACCB2 DumpAllObjectsAgentExecute( void* pvData )


{
AVCursor hCurrentCursor = AVSysGetCursor();
AVCursor hWaitCursor = AVSysGetStandardCursor( WAIT_CURSOR );

AVSysSetCursor( hWaitCursor );

/* Declare volatile Consultant since its inside a DURING block */


Consultant volatile hConsultant = (Consultant)NULL;

DURING
AVDoc hAVDoc = AVAppGetActiveDoc();
miAssert( hAVDoc != ( AVDoc )NULL );

if( hAVDoc != ( AVDoc )NULL )


{
/* Create a Consultant object */
hConsultant = ConsultantCreate(
DumpAllObjectsAgentPercentDone );
miAssert( hConsultant != ( Consultant )NULL );

if( hConsultant != ( Consultant )NULL )


{
/* Get the current document root */
PDDoc hPDDoc = AVDocGetPDDoc( hAVDoc );
/* Create our Agent and register it */
gDumpAllObjectsAgent = new DumpAllObjectsAgent( hPDDoc );

if((gDumpAllObjectsAgent == (DumpAllObjectsAgent*)NULL)

202 Acrobat and PDF Library API Overview


Overview of the Acrobat Extended APIs
4
PDF Consultant (Scrubber) and Accessibility Checker Extended API

|| (gDumpAllObjectsAgent->IsValid() == false))
{
ASRaise( GenError( genErrNoMemory ) );
}
else
{
ConsultantRegisterAgent(hConsultant,
*gDumpAllObjectsAgent,
REG_REVISITRECLASS_ALL );
/* Start the Consultant */
ConsultantTraverseFrom(hConsultant,
CosDocGetRoot(PDDocGetCosDoc(hPDDoc)),PT_CATALOG);
}
}
}
HANDLER
... Destroy Consultant...Free Memory...
END_HANDLER
if( hConsultant != ( Consultant )NULL )
ConsultantDestroy( hConsultant );
if( gDumpAllObjectsAgent != ( DumpAllObjectsAgent* )NULL )
{
delete gDumpAllObjectsAgent;
gDumpAllObjectsAgent = ( DumpAllObjectsAgent* )NULL;
}
AVSysSetCursor( hCurrentCursor );

Starting The Consultant


The ConsultantTraverseFrom function instructs the Consultant to begin traversing a
document, starting at a particular Cos object. The Cos object should be the Catalog of a
currently open document. (Later expansions of the API may allow you to specify the object
type from which to begin, but currently it must begin at the Catalog.)
ConsultantTraverseFrom has no return value and instead raises an Acrobat
exception on error.
The Consultant API also supplies methods for suspending a traversal,
(ConsultantSuspend) and resuming it (ConsultantResume).
Using the Traversal Stack
This example demonstrates how to use the traversal stack manipulation functions.
Example: Using The Consultant Traversal Stack

char* GetTraversalString(ConsStack stack, char *traversalString,


ASUns32 strLen)
{
ASUns32 Index, NumItems, CurStrLen;
char StringUns32[16];
traversalString[0] = '\0';
CurStrLen = strlen(traversalString);

Acrobat and PDF Library API Overview 203


Overview of the Acrobat Extended APIs
4
PDF Consultant (Scrubber) and Accessibility Checker Extended API

/* Get the number of items in the current traversal */


NumItems = ConsStackGetCount(stack);
for(Index = 0; (Index < NumItems) && (CurStrLen < strLen); Index++)
{
if((CurStrLen += strlen(TRAVERSAL_SEP)) < strLen)
strcat(traversalString, TRAVERSAL_SEP);
/* Add the parent key, if this stack entry has one */
if(ConsStackIndexIsDict(stack, Index))
{
char* strParentKey =
ASAtomGetString(ConsStackIndexGetDictKey(stack, Index));
if((CurStrLen += strlen(strParentKey)) < strLen)
strcat(traversalString, strParentKey);
}
/* Add the parent index, if this stack entry has one */
else if(ConsStackIndexIsArray(stack, Index))
{
sprintf(StringUns32, "%u",
ConsStackIndexGetArrayIndex(stack, Index));
if((CurStrLen += (strlen(StringUns32) + 2)) < strLen)
{
strcat(traversalString, "[");
strcat(traversalString, StringUns32);
strcat(traversalString, "]");
}
}
}
return traversalString;
}

Consultant Object Type Identification


One of the main features the PDF Consultant and Accessibility Checker framework gives
you is the use of its identification engine. This engine can look at Cos objects in a PDF file
and, based on properties of the objects and of the objects' parents, assign "PDF Object
Type" identifiers to them. Though on a very basic level each Cos object has a simple Cos
type and attributes, in the scheme of the document as a whole each object serves a
particular purpose. The PDF Object Type assigned to each object represents that object's
role in the PDF Document. Some PDF Object Types represent higher-level, conceptually-
familiar objects like PT_PAGE (which indicates that the object is a page in the document),
while others (like PT_AADICTIONARY) are a bit more obscure, particularly to those who
are not familiar with the PDF Document Format. PDF Object Types are represented using
the enumerated type PDFObjType, which is defined in ConsObTp.h. A good way to see all
of the various PDF Object Types that the Consultant can identify is to look at the constants
defined in that file.
Some object types (in particular many simpler objects such as strings and numbers) are not
assigned a particular type. In general the Consultant can identify those objects that are of

204 Acrobat and PDF Library API Overview


Overview of the Acrobat Extended APIs
4
PDF Consultant (Scrubber) and Accessibility Checker Extended API

most use to you. If the Consultant cannot identify a particular object, for one reason or
another, it assigns the identity of PT_UNKNOWN to the object. Just because the Consultant
assigns this value to an object does not mean the object is foreign or malformed (although
it can potentially mean that), it may simply mean that the object type is not particularly
significant in the realm of the PDF Document Format, and thus the Consultant does not
know about it.
Object Type Subclassing
To allow for greater Agent flexibility, the Consultant understands PDF Object Type
subclasses and superclasses. Certain PDF Object Types are members of more generic
classes of PDF Object Type. Agents can often make use of this information, so the
Consultant assigns object types that are actually arrays of types.
The Consultant assigns to an object the most specific classification as well as the more
generic classes of which the object is a member. Agent structures include a field called
"WantSubclasses" that indicates whether or not the Agent wants be called for all the
interesting objects subclasses as well as their directly interesting types.
For example, the PDF Object Type PT_ANNOTATION has a number of more specific
subclasses such as PT_LINKANNOTATION, PT_LINEANNOTATION, and so on. If an
Agent requests only objects of type PT_ANNOTATION, and its WantSubclasses member is
false, it may not be called back for very many objects. If the WantSubclasses member is true,
then the Consultant will call the Agent back for objects of all specific types of annotations
as well as those classified only as PT_ANNOTATION. This also means that when an Agent
retrieves the type of an object, it must specify which type it wants. The types in the array
that is the classification of the object always go from the most specific (at index 0) to the
least specific (the last index in the array).

Creating Your Agent Class


A minimal Agent class needs only to define the functions defined as virtual in the
ConsultantAgentObject class declared in ConsExpt.h. The following example
shows this minimal definition.

Acrobat and PDF Library API Overview 205


Overview of the Acrobat Extended APIs
4
PDF Consultant (Scrubber) and Accessibility Checker Extended API

Example: Minimal Agent Class Definition

#include "ConsExpt.h"
class DumpAllObjectsAgent : public ConsultantAgentObj
{
protected:
// ----------------- Data Members --------------------
FILE* m_DumpFile;

const static PDFObjType s_hAgentObjects[ ];


const static ASUns32 s_iNumAgentObjects;

public:
// --------------- Constructor / Destructor ------------------------
DumpAllObjectsAgent( PDDoc hPDDoc );
virtual ~DumpAllObjectsAgent( void );

// --------------------- Required Methods ---------------------------


virtual void ConsAgentPostProcess( void );
virtual ASInt32 ObjFound(CosObj Obj, const PDFObjType*
pObjTypeHierarchy,
const ASUns32 SizeObjHierarchy,
TraversalStack Stack,CosObj* pObjToReturn );
};

Agent Constructors
In order to write an Agent class derived from the ConsultantAgentObj baseclass, you
must call the base constructor in the derived class construction list. The base constructor
requires a constant array of so-called objects of interest (of type PDFObjType) as well as
the length of the array (as ASUns32) to be passed as parameters. It is up to you as to where
and how the array of types is stored; however the storage must persist, as the base class
saves only a pointer to the data. This has important implications for authoring agents; the
derived class cannot initialize the data in its own constructor since the base constructor will
be called first.
The following example shows an example constructor. In the example Agent the array of
types and array length are static data members of the Agent class. In larger-scale systems
it is better to create a host object for the Agent that will be responsible for determining
the proper objects to include in the array and passing them on to the Agent constructor.
The list of object types is passed on to the Consultant when
ConsultantRegisterAgent is called.

206 Acrobat and PDF Library API Overview


Overview of the Acrobat Extended APIs
4
PDF Consultant (Scrubber) and Accessibility Checker Extended API

Example: An Agent Constructor

/* Define static const data to be passed to parent class constructor */


const ASUns32 DumpAllObjectsAgent::s_iNumAgentObjects = 1;
const PDFObjType
DumpAllObjectsAgent::s_hAgentObjects[DumpAllObjectsAgent::s_iNumAgentObj
ects] = { DT_ALL };
/* Derived Agent Class Constructor */
DumpAllObjectsAgent::DumpAllObjectsAgent( PDDoc hPDDoc ) :
ConsultantAgentObj( &s_hAgentObjects[ 0 ], s_iNumAgentObjects )
{
Open Temporary File and Initialize Data Members ...}
}

Recognizing Objects of Interest


Agents register with the Consultant a list of objects in which they are interested. When the
Consultant classifies an objects as any of the types the Agent registered with, the
Consultant calls the ObjFound callback function, a virtual function in the
ConsultantAgentObj base class.
The parameters the Consultant passes to this function allow the function to set up a
return value with information about the current object, its parents, and the state of the
Consultant traversal stack.
The return value from the callback is an OR of bit flags that instruct the Consultant as to
handling the current object.
See ConsAgentObjFoundCallback for details of the syntax.
The Agent in Example: An Agent Constructor simply gathers information about each
object encountered and outputs it to a file. It does not need to have the Consultant make
any modifications to the document. Therefore, in the definition of the ObjFound callback
function, the return value is always OD_NOCHANGE and the object returned in
pObjToReturn is simply the same object that was found. In many cases it makes the
most sense for an Agent to make all document modifications itself, without the
Consultants replace and remove facilities. In these cases you must take special care not to
modify objects that are currently on the Consultants traversal stack.
The DumpAllObjects plug-in demonstrates that PDFConsultant agents can access any
Cos object from any point in the document. The plug-in writes information about certain
Cos objects to an output file, called AllObjects.txt.
The ObjFound callback function of the DumpAllObjects agent writes to a file the Cos
object traversal path that it took to reach a specific Cos object. The function calls
GetTraversalString, which describes, with respect to other objects, where a given
object lives in the document. For example, the following shows the format of a traversal
path of a text annotation:
18 0 obj PT_TEXTANNOTATION | PT_ANNOTATION | ->AcroForm->Fields->[0]->
P->Annots->[1]

Acrobat and PDF Library API Overview 207


Overview of the Acrobat Extended APIs
4
PDF Consultant (Scrubber) and Accessibility Checker Extended API

The traversal path illustrates the "hierarchy" of types that the PDF Consultant and
Accessibility Checker assigns to some objects (for example, a PT_TEXTANNOTATION is
also listed as PT_ANNOTATION).
The Consultant will look at all Cos objects. To simplify the output, the DumpAllObjects
agent only involves the most useful Cos objectsCosString, CosDict, CosArray,
and CosStream.
The Post Processing Stage
The second and final required function definition in any ConsultantAgentObj derived
class is the PostProcess callback. This function is called when the Consultant has
finished its traversal and is preparing to unregister agents to prepare for the next possible
run. This callback takes no parameters and returns no values (see
ConsAgentPostProcessCallback). There are also no restrictions on what types of
operations the Agent can perform on the document in this function.
The PostProcess callback function is the place to perform any operations that might
otherwise damage Consultants traversal by modifying objects up the Consultants current
traversal stack.
The PostProcess callback function should also perform any cleanup that cannot be
done in the Agent destructor. The example Agent in Example: Minimal Agent Class
Definition does not need to do any complicated processing, but simply indicates the end of
the output log for this run.

Consultant APIs
The Consultant APIs include:

ConsultantCreate
ConsultantDestroy
ConsultantRegisterAgent
ConsultantResume
ConsultantSetStart
ConsultantSuspend
ConsultantTraverseFrom
PDFObjTypeGetSuperclass
ConsStackGetCount
ConsStackIndexGetArrayIndex
ConsStackIndexGetDictKey

208 Acrobat and PDF Library API Overview


Overview of the Acrobat Extended APIs
4
Digital Signature (DigSig) Extended API

ConsStackIndexGetObj
ConsStackIndexGetTypeAt
ConsStackIndexGetTypeCount
ConsStackIndexIsArray
ConsStackIndexIsDict
ConsultantGetNumDirectVisited
ConsultantGetNumIndirectVisited
ConsultantGetNumUniqueIndirectsVisited
ConsultantGetPercentDone
ConsultantNextObj

Digital Signature (DigSig) Extended API


Digital signatures allow a person to attest to something about a document by signing their
name to it. An Acrobat signature in a document is bound to that document in such a way
that altering the signed document or moving the signature to a different document
invalidates the signature.
A single document may be signed more than once, and changes may occur between
signings. Acrobats Digital Signatures links each signature with a particular state of the
document. All changes append the PDF changes to the fully-preserved base PDF
document. The ability to do serial signatures of protected documents is unique to Acrobat,
and draws heavily on the PDF file design for an appended save.
Adobe Acrobat implements digital signatures using plug-ins that can handle both generic
functions common to all digital signatures, and also specific kinds of signatures (signing
methods), such as public-private key (PPK), handwriting, retinal scans, fingerprints, and so
forth.

Acrobat and PDF Library API Overview 209


Overview of the Acrobat Extended APIs
4
Digital Signature (DigSig) Extended API

Plug-in Relationships
The following figure illustrates the security plug-in relationships.

Adobe Acrobat
Acrobat API PDCrypt

LegalPDF DigSig (plug-in)


Scrubber Agent
(plug-in) DigSigHFT

PubSec
PubSecHFT

MSCAPI and ADSI 3rd party


Self-Sign Acrobat Address Book
interface PubSec
(PPKLite Handler) (AAB Handler)
(PPKMS Handler) handlers

Microsoft OS User
PKCS#12 Contact
File File
CSP CSP CSP ...

The PubSec Layer


The PubSec layer, introduced in Acrobat 6.0, is an interface for Acrobat public-key security
handlers. PubSec forms a high-level interface to the digital signature facility; the PubSec
code uses DigSig for digital signature operations, but provides many additional benefits.
Developers are encouraged to use the PubSec HFT rather then DigSig HFT.
PubSec provides functions to:
Count and close encrypted documents.
Validate a specific signature field.
Access and create digests for data buffers.
Import and export certificate data, and manage the certificates in the Acrobat Address
Book (AAB).
Manage signature appearances (DSAP files).

210 Acrobat and PDF Library API Overview


Overview of the Acrobat Extended APIs
4
Digital Signature (DigSig) Extended API

Register and unregister handlers. Handlers can register as PubSec handlers to provide
the following cryptographic services:
Do private-key signing and signature validation
Act as a cryptographic source for decrypting using private keys
Act as a directory source for certificate-based identity authentication
Handlers can call back into the PubSec HFT for various services. Most calls to PubSec pass
an opaque state object called a PSEngine. You specify a default engine upon registering the
handler, and the default engine can make use of the security UI dialogs provided by PubSec
and DigSig.
To register a handler with PubSec:
1. Implement the callbacks you need to provide customized functionality. Many of the
callbacks for PubSec can be specified as NULL, in which case PubSec provides default
behavior. It is recommended that you use the default behavior when possible.
2. Fill in the handler structure with pointers to your callback implementations
(PubSecHandler).
3. Register the handler with PubSec (PSRegisterHandler).

Digital Signature Components


Digital signatures contain two parts:
The signature field dictionary: the PDF dictionary structure that stores information
about the signature
The signature annotation with its associated appearance (including the background,
and layout of name, time, and so on). A blind digital signature does not have an
associated appearance.
Acrobats Digital Signature plug-in creates these two parts when the user chooses to sign a
document. Your plug-ins do not have to handle deleting the signature, as the DigSig plug-
in does that transparently.

Digital Signature Scenarios


Acrobat supports three digital signature scenarios. Acrobats Digital Signature plug-in
handles the first case, and allows other plug-ins to further handle the second and the third
cases.
1. If the user creates a signature field and does not specify a default signing method,
DigSig handles that case with no communication to your plug-ins:
DigSig creates the signature field dictionary.
DigSig creates the signature annotation dictionary.
DigSig creates the (blank) signature appearance dictionary.

Acrobat and PDF Library API Overview 211


Overview of the Acrobat Extended APIs
4
Digital Signature (DigSig) Extended API

2. The Forms plug-in also creates Signature fields. If the user creates a signature field and
specifies a default method, Forms calls DigSig to fill in default values:
DigSig creates the signature field dictionary, the signature annotation dictionary, and
the (blank) signature appearance dictionary.
DigSig calls the DSDefaultValueProc callback that your plugin provides. This
callback must create the default signature value dictionary and create the /DV key in
the signature field dictionary to point to it.
3. If the user asks to sign a specific signature field using the plug-in, DigSig calls callbacks
into your plug-in in four-step sequence. Your plug-in must register these callbacks
during the plug-in initialization phase. The four callbacks required for this scenario are:
dsNewSigData
dsCommitSign
dsFinshSign
dsFreeSigData.

Initializing a Plug-in to Work With the Digital Signature Plug-in


When Acrobat launches, all plug-ins go through a three-step initialization process that
allows plug-ins to establish communication among themselves without being dependent
on the order of loading. For plug-ins that interact with Acrobats Digital Signature plug-in
(DigSig), use the following intialization sequence:
1. Export Host Function Tables (HFTs). DigSig exports its HFT under the name DigSigHFT.
2. Import HFTs. To work with DigSig, your plug-in must import the DigSig HFT.
3. Perform initialization. To work with DigSig, your plug-in must create a
DigSigHandlerRec structure, assign the relevant methods, and then call
DigSigRegisterFilter to register the structure.
Handling Document Open and Close Operations
When the user opens a document, DigSig calls your plug-ins to notify them of the new
document by calling DSDocOpenProc; you might allocate some storage or choose to
automatically validate any of their respective signatures in the document.
Auto-validation may produce significant delays if it must read all of a large document from
a CD-ROM or over a network, or if it must access a signature registry or authority over a
network. Therefor, Adobe software only accesses signatures at user request.
When the user closes a document, DigSig calls DSDocCloseProc.

Understanding the Process


The steps in this section are suggestions that describe the interactions of a digital signature
plug-in. (The SignDoc sample plug-in provided with this SDK is a more complete
example.)

212 Acrobat and PDF Library API Overview


Overview of the Acrobat Extended APIs
4
Digital Signature (DigSig) Extended API

Dialogs and Signature Gathering


1. DigSig calls your dsNewSigDataProc, a callback that begins the process.
Your plug-in interacts with the user, and allows the user to cancel if they want to do so.
Your plug-in acquires the signature itself in a method-specific way. All information is
saved in memory, without altering the document itself. This allows a later backout.
If dsNewSigData does not cancel, DigSig prepares the document for saving: It first
calls dsUnValidateSig on every signature in the document to put any
overprinting/underprinting in canonical form. It then counts how many pages and
fields have changed since any prior signature and records this.
For a first signature, DigSig does the SaveAs dialog, allowing the user to select
filename, optimization, and encryption. The user may cancel. Other than fatal errors,
such as out-of-disk-space, this is the last chance to stop the process.
Saving a Document
1. DigSig calls Xxxx.DSCommitSignProc to update the document with the actual
signature.
Your DSCommitSignProc callback must:
create the signature dictionary, possibly using information in the signature field /DV
dictionary, perhaps using the /ByteRange and /Contents keys.
point /V in the signature field dictionary to this. Then create the /AP /N value in the
signature annotation dictionary, using a method-specific visible representation of the
signature, including a symbol signifying unvalidated signature.
optionally allocate dynamic storage for a marked array, an array of marked COS
objects that it cares about.
return a marked array that includes at least the /ByteRange and /Contents value
objects.
2. DigSig inserts the /Changes array from step 1.
3. DigSig saves the PDF document to a file. For each Cos object in the marked array, DigSig
records the objects byte offset and length in the file as written. The saved file may have
objects encrypted by the Acrobat standard encryption handler, if the user so chooses.
4. The very first time a document is signed, DigSig may rename the file and may invoke the
Optimizer, Linearizer, and Garbage Collector. Upon return from the save, all COS objects
are invalid, including those in the marked array.
All PD-level objects except the PDDoc are invalid. Signing methods must not depend
on saving any such state between dsCommitSign and dsFinishSign. In
particular, the byte offsets and lengths in the marked array are valid upon entry to
doSign, but the Cos objects are not. The order of entries is unchanged, however,
these Cos objects will be rewritten by DigSig as CosNull before calling
dsFinishSign.

Acrobat and PDF Library API Overview 213


Overview of the Acrobat Extended APIs
4
Digital Signature (DigSig) Extended API

Finishing the Process


1. DigSig calls dsFinishSign, passing back in the marked array.
Your DSFinishSignProc must:
Calculate the /ByteRange that it desires, using the byte offsets and lengths in the
marked array.
Overwrite the marked /ByteRange value in the saved file, using the
DigSigOverwriteIntArray or DigSigOverwriteBytes callback.
Overwrite any other marked Cos objects it wants to.
Calculate any document digest that it desires, using the DigSigFileGetEOF,
DigSigFileSetPos, and DigSigFileRead callbacks; or it may use the
DigSigMD5ByteRange callback.
Obscure or encrypt this digest in a method-specific way.
Overwrite the marked /Contents value in the saved file, using
DigSigOverwriteHexstring or DigSigOverwriteBytes.
Optionally delete dynamic storage for the marked array the plug-in returns.
2. DigSig calls dsFreeSigData, which may free up any remaining storage.
Revalidating Signatures
If the user reopens the file, the signatures must be revalidated. If the user asks to validate
one or more signature fields, DigSig sequences through them one at a time:
1. DigSig calls validateSign. Your DSValidateSignProc must:
Recalculate any document digest that it desires, using the DigSigFileGetEOF,
DigSigFileSetPos, and DigSigFileRead callbacks; or it may use the
DigSigMD5ByteRange callback.
Compar this result to the stored one, and do any other method-specific checks it
desires.
Optionally do a validation against some stored (network) registry.
Update the /AP /N value in the signature annotation dictionary to show
doublechecked/pass/fail symbol.
Return doublechecked/pass/fail.
The user may open more than one document at a time, and may switch between open
documents at will.
Additional Available Callbacks
The user may ask to show a signature panel containing summary information for each
signature in an open document. If multiple documents are open, there may be multiple
panels, or a single panel may be repainted as the user switches between documents. DigSig
manages updating the panel(s), but may call the respective method plug-in for each
signature to get information to display on the panel. For each signature, the signature
panel has two levels of detail:
1. CLOSED displays a doublechecked/pass/fail/unknown/blank icon and a line
of text for each signature field in the document. The default text is the name of the

214 Acrobat and PDF Library API Overview


Overview of the Acrobat Extended APIs
4
Digital Signature (DigSig) Extended API

person signing and the date and time of signing, displayed in a language-independent
way.
2. DigSig calls dsGetValidState to choose which icon to show.
3. OPEN displays an icon and line of text for each signature, then indented lines of further
text, currently consisting of the name of the signer, date and time of signing, location of
signing, reason for signing, and signing method.
4. DigSig calls dsGetValidState to choose which icon to show.
Your plug-in may update the signature panel for a document asynchronously (it might be
doing validation as a background or idle-loop task). To do this, use the
DigSigUpdatePanel callback.
Additional DigSig Plug-in Support
Whenever a signature is created or verified, the plug-in may optionally alter the appearance
of the signature in the document, for the purpose of displaying or printing. For example, it
could change an overprinted question mark on an unverified signature to an underprinted
logo for a verified signature. To help with this, DigSig provides an HFT callback
DigSigGetStdXObj that returns an XObject for a blank appearance, a question mark,
or a cross. These are suitable as targets of the Do operator in a signatures appearance
stream.
To avoid saving a signature to a file with an appearance of valid (rather than unvalidated),
just before each file save, DigSig loops through all the signature fields and calls the specific
methods dsUnValidateSig entry. This routine restores the signatures appearance to
the unvalidated state.
The AcroForms Widget Annothandler calls into DigSig using four entries. These calls all
reflect user actions taken in the document view, not the Signatures panel view.
When the user selects an annotation by tabbing to it or by clicking it with the mouse, and
that annotation is for a signature field, AcroForms calls DigSigDraw. If the annotation is
selected, then bIsSelected is true.
When the user tabs to a signature annotation and activates it by hitting the spacebar or
enter key, this is equivalent to a left mouse click.
AcroForms calls DigSigKeyDown. The parameters parallel those of
AVAnnotHandlerDoKeyDownProc.
When the user left-clicks inside a signature annotation, AcroForms calls DigSigClick.
The parameters parallel those of DoClickProcType.
When the user right-clicks inside a signature annotation, AcroForms calls
DigSigRightClick.
Rollback Support
There is a constraint on the values in the /ByteRange array. This constraint allows DigSig to
implement rollback to prior signatures:

Acrobat and PDF Library API Overview 215


Overview of the Acrobat Extended APIs
4
Digital Signature (DigSig) Extended API

The largest offset + length value in the /ByteRange array for a given signature must be
equal to the length of the PDF file containing that signature; that is, it must equal offset + 1
of the "F" in the %%EOF at the end of the file.
In addition, the following constraints also apply:
All offsets must be in the range 0..2147483647
All lengths must be in the range 1..2147483647
Offset[n+1] must be strictly greater than offset[n] + length[n]

DigSigsUse of Core API Objects


The Digital Signatures Plug-in makes extensive use of the Acrobat Core API objects listed in
this chapter. For information , see the Acrobat and Pdf Library API Reference.
ASAtom
A hashed token used in place of strings to optimize performance (it is much faster to
compare ASAtoms than strings).
ASCab
A container object.
ASFile
An opaque representation of an open file.
ASText
A text object.
AVPageView
The area of the Acrobat viewers window that displays the contents of a document page.
Every AVDoc has an AVPageView and vice versa. It contains references to the PDDoc and
PDPage objects for the document being displayed.
CosDoc
A Cos level representation of an entire PDF file.
CosObj
A general object in a PDF file, which may be of any Cos object type.
PDAnnot
An annotation on a page in a PDF file. Acrobat viewers have two built-in annotation types:
PDTextAnnot and PDLinkAnnot. Physical attributes of the annotation can be set and
queried. Plug-ins add movie and Widget (form field) annotations. Developers can define
new annotation subtypes by creating new annotation handlers.

216 Acrobat and PDF Library API Overview


Overview of the Acrobat Extended APIs
4
Digital Signature (DigSig) Extended API

PDDoc
The underlying PDF representation of a document. There is a correspondence between a
PDDoc and an ASFile; the PDDoc object is the hidden object behind every AVDoc. An
ASFile may have zero or more underlying files, so a PDF file does not always correspond
to a single disk file. For example, an ASFile may provide access to PDF data in a database.
Through PDDocs, your application can perform most of the Edit -> Pages menu items from
Acrobat (delete, replace, and so on). Thumbnails can be created and deleted through this
object. You can set and retrieve document information fields through this object as well.
The first page in a PDDoc is page 0.

PubSec and DigSig APIs


The PubSec and DigSig APIs include:

PSCertIssuedUnderTestCP
PSCloseEncryptedDocs
PSCountEncryptedDocs
PSDataBufferDigest
PSDataBufferEnum
PSExportDataExchange
PSImportDataExchange
PSRegisterHandler
PSSigValidatePDDocSigField
PSUnregisterHandler
AABFindCertsByName
AABGetCertChain
AABGetCertTrust
AABGetTrustedCerts
AABIsCertPresent
DSAPFileAcquire
DSAPFileCanDeleteNthEntry
DSAPFileCopyNthEntry

Acrobat and PDF Library API Overview 217


Overview of the Acrobat Extended APIs
4
Digital Signature (DigSig) Extended API

DSAPFileEditNthEntry
DSAPFileGetCount
DSAPFileGetNewNthName
DSAPFileRelease
DSAPFileRemoveNthEntry
DSAPFileSave
DigSigAddedSig
DigSigAddedSigEx
DSAPCreateCompositeTextXObj
DigSigAPCreateLayeredStream
DigSigAPCreateLayeredStreamEx
DigSigAPXObjectFromLogo
DigSigAPXObjectFromXObjList
DigSigByteToHex
DigSigClearSig
DigSigClearSigRefDict
DigSigClick
DigSigCommitSigRefDict
DigSigComparePages
DigSigComparePagesEx
DigSigCompareWords
DigSigCompareWordsAndFontsRecent
DigSigCompareWordsEx
DigSigCompareWordsRecent
DigSigCosObjOverwrite
DigSigCreateStdXObj
DigSigDeletedSig

218 Acrobat and PDF Library API Overview


Overview of the Acrobat Extended APIs
4
Digital Signature (DigSig) Extended API

DigSigDeletedSigEx
DigSigDocModifiedAfterSig
DigSigDoProperties
DigSigDraw
DigSigEnumSignatures
DigSigFileGetEOF
DigSigFileRead
DigSigFileSetPos
DigSigFinishSigRefDict
DigSigGetDocAuthorSignature
DigSigGetDocMDPSetting
DigSigGetStdXObj
DigSigGetUbiquitySignature
DigSigGetUniqueTitle
DigSigHexToByte
DigSigIsDocSigned
DigSigIsSigSigned
DigSigKeyDown
DigSigMD5ByteRange
DigSigNewSigRefDict
DigSigOverwriteBytes
DigSigOverwriteHexstring
DigSigOverwriteIntArray
DigSigRegisterFilter
DigSigRegisterObserver
DigSigRightClick
DigSigRollbackToSig

Acrobat and PDF Library API Overview 219


Overview of the Acrobat Extended APIs
4
Forms Extended API

DigSigSignDoc
DigSigUnregisterFilter
DigSigUnregisterObserver
DigSigUpdatePanel
DigSigVerifySig
DigSigVerifySigRefDict

Forms Extended API


The Acrobat Forms plug-in exports its own Host Function Table (HFT), whose methods can
be used by other plug-ins. To use the Acrobat Forms plug-ins HFT, a plug-in must:
include the header file FormsHFT.h (which includes AF_ExpT.h and AF_Sel.h).
import the HFT using ASExtensionMgrGetHFT. A convenient way to do this is to use
the Init_AcroFormHFT macro defined in FORMSHFT.H.
#define Init_AcroFormHFT
ASExtensionMgrGetHFT(ASAtomFromString(AcroFormHFT_NAME),
AcroFormHFT_LATEST_VERSION)
assign the HFT returned by this call to a plug-in-defined global variable named
gAcroFormHFT.
Data may be imported and exported into Acrobat Forms in Forms Data Format (FDF). FDF is
used to submit form data to a server, as well as to receive the response and incorporate it
into a form. FDF is based on PDF and uses the same syntax and set of basic object types as
PDF. It also has the same file structure, except that the cross-reference table is optional. See
the PDF Reference for more information.

OLE for Forms


This technical note describes the Forms HFT. The IAC APIs supported by the Acrobat Forms
plug-in are described in the Acrobat IAC Overview and the Acrobat IAC Reference.

Forms APIs
The Forms APIs include:

AFDrawText
AFExecuteThisScript

220 Acrobat and PDF Library API Overview


Overview of the Acrobat Extended APIs
4
Forms Extended API

AFImportAppearance
AFLayoutBorder
AFLayoutCreateStream
AFLayoutDelete
AFLayoutNew
AFLayoutText
AFPDDocEnumPDFields
AFPDDocGetPDFieldFromName
AFPDDocLoadPDFields
AFPDFieldFromCosObj
AFPDFieldGetCosObj
AFPDFieldGetDefaultTextAppearance
AFPDFieldGetFlags
AFPDFieldGetName
AFPDFieldGetValue
AFPDFieldIsAnnot
AFPDFieldIsTerminal
AFPDFieldIsValid
AFPDFieldReset
AFPDFieldSetDefaultTextAppearance
AFPDFieldSetOptions
AFPDFieldSetValue
AFPDFormFromPage
AFPDWidgetGetAreaColors
AFPDWidgetGetBorder
AFPDWidgetGetRotation
AFPDWidgetSetAreaColors

Acrobat and PDF Library API Overview 221


Overview of the Acrobat Extended APIs
4
Weblink Extended API

AFPDWidgetSetBorder
AssembleFormAndImportFDF
ExportAsFDF
ExportAsFDFEx
ExportAsFDFWithParams
ExportAsHtml
ExportAsHtmlEx
ImportAnFDF
IsPDDocAcroForm
ResetForm

Weblink Extended API


A link in a PDF document that references a URL is referred to as a Weblink.
The Adobe Acrobat Weblink plug-in adds the capability of linking to documents on the
World Wide Web. It allows other plug-ins to access its functionality by means of a Host
Function Table (HFT) API.
This document describes the Weblink APIs. It also provides information on Adobes
Standard Weblink Driver, which performs low-level, platform-specific functions with a Web
browser on behalf of Weblink.
The Acrobat Weblink plug-in exports its own Host Function Table (HFT), whose methods
can be used by other plug-ins. The HFTs name is defined in the WLHFTNAME macro, and its
version number is WEB_LINK_HFT_LATEST_VERSION.
To use the Weblink plug-ins HFT, a plug-in must include the header file WeblinkHFT.h.
The plug-in must also import the HFT using ASExtensionMgrGetHFT and assign the
HFT returned by this call to a plug-in-defined global variable named gWLHFT. The easiest
way to do this is to use the Init_gWLHFT macro defined in the header files.

Weblink Services
The Weblink plug-in provides the following services:
Maintenance of links (editing and storage of URLs associated with links, and so on)
Manipulation of links (appropriate cursor changes and dynamic display of URL
destinations)
Selection of the external Web browser

222 Acrobat and PDF Library API Overview


Overview of the Acrobat Extended APIs
4
Weblink Extended API

Driver manipulation
Basic progress status services (progress monitor, wait cursor, and so on)

Weblink Driver
The Weblink plug-in includes a standard driver, known as Adobes Standard Web Driver. It
allows support for transport mechanisms or Web browsers to be added at a later time.
The Standard Driver uses Apple events and DDE messages to communicate with a Web
browser. It supports a protocol that consists of a suite of verbssome going to and some
coming fromthe Web browser. These verb definitions are provided so that Web browsers
can implement this protocol to be compatible with the Adobe Standard Web Driver. Each
verb is specified in terms of the platform-specific implementation: Apple events for the
Macintosh and DDE for Windows. The Standard Drivers use of each verb is also described.
Browsers that wish to use their own protocol may do so by writing a custom driver.
The Weblink plug-in communications software in the Weblink driver is independent of the
Acrobat mechanism for handling links (the PDF implementation of URLs). This separation
improves portability by isolating the highly platform-specific Interapplication
Communication messages. Even on a given platform, there is no standard among Web
browsers for handling interapplication communication, and the actual transport
mechanism may vary over time. By separating out the transport code, the Weblink plug-in
remains portable across platforms, across different vendors implementations of Web
browsers, and across different versions of Web browsers from the same vendor.

Writing a Custom Driver


A driver is an Acrobat core plug-in, written like any other plug-in. A driver must register
itself with the Weblink plug-in during the import, replace, and register phase of the plug-in
initialization process by calling RegisterWebDriver. You pass this method a
WebDriverVector structure containing a version number and six pointers to functions
that your driver provides to handle Web-browser-specific tasks.
A driver is responsible for the following:
Connection with external services (either directly or through an external application)
Communication with external services
Association of a base URL with a given document
Identification of external browsers that are compatible with the driver
Sequence of Actions
In a typical session, the following actions might occur.

Acrobat and PDF Library API Overview 223


Overview of the Acrobat Extended APIs
4
Weblink Extended API

1. The user launches Acrobat.


a) The Weblink plug-in publishes a Host Function Table (HFT) during the
exportHFTsCallback phase of initialization.
b) During the importReplaceAndRegisterCallback phase, all drivers in turn
call RegisterWebDriver in the Weblink plug-ins HFT to register themselves as
available.
c) During the initCallback phase, the Weblink plug-in, if possible, selects an
appropriate driver and notifies it that it is the active driver.
2. The user opens a PDF document with Weblinks and clicks a Weblink.
a) The Weblink plug-in extracts the URL from the link and passes it to the driver.
b) The driver packages the URL into an Interapplication Communication (IAC) message
and sends it to an external Web browser (launching the Web browser application, if
necessary).
c) The external Web browser brings itself to the foreground unless the URLs MIME type
is application/pdf.
3. The Web browser retrieves the document and packages an IAC message.
a) The driver accepts the IAC message from the browser and opens the PDF document
using AVDocOpenFromFile. The driver should associate the URL with the document.
b) To resolve relative links, Weblink prepends either a base URL with the document, or if
there is no base URL, the appropriate portion of the URL of the document the link is in.
For mapped linkslinks with the isMap attributeit appends a ? followed by the
mouse locations x- and y-coordinates.

Weblink APIs
The Weblink APIs include:

BeginWebProgress
EndWebProgress
GetAppSpecifier
RegisterWebDriver
UpdateWebProgress
WebProgressDidCancel
WLCreateOrDeleteWebLinks
WWWOpenURL
WWWOpenURLWithParams

224 Acrobat and PDF Library API Overview


Overview of the Acrobat Extended APIs
4
Spelling Extended API

Spelling Extended API


Acrobat provides a Spelling plug-in, which exports a Host Function Table (HFT)
implementing a spell-check API for use by plug-in developers. The Spelling API has not
changed between Acrobat 5.0 and Acrobat 6.0.

Using the Spelling HFT


To use the Spelling HFT, a plug-in must include the header file SpellerHFT.h, which
includes Speller_Sel.h.
The following is a typical sequence of calls made by a plug-in using the Spelling HFT.
During its importReplaceAndRegister callback, the plug-in should:
Import the HFT, using ASExtensionMgrGetHFT, and assign the HFT returned by this
call to a plug-in-defined global variable named gSpellerHFT. The easiest way to do
this is to use the Init_SpellerHFT macro defined in SpellerHFT.h.
Allocate and initialize one SpellCheckParam block for each spelling domain the
client will add, if any.
Add zero or more domains using the SpellAddDomain call.
For example, Acrobats Forms and Comments plug-ins register domains with Spelling.
Spelling calls back into Forms and Comments to get the text for each form field or
comment when the user invokes the Spell Check dialog.
During execution, the plug-in should:
Respond to the following callbacks for each domain:
SCEnableProc is called by Spelling to ask if this domain has anything that needs to
be checked
SCGetTextProc is called to get a text buffer to be checked.
SCCompletionProc is called after the user has modified the text buffer.
The client may call other Spelling HFT services during execution even if it did not add a
domain.
During its unloadCallback, the plug-in should:
Remove all spelling domains added during initialization using the
SpellRemoveDomain call.
Free all memory associated with SpellCheckParam block(s) (scInBuffer,
scOutBuffer, and scClientData).
Free the SpellCheckParam block(s).

Acrobat and PDF Library API Overview 225


Overview of the Acrobat Extended APIs
4
Spelling Extended API

Text Parameters
Several of the Spelling API methods (SpellCheck, SpellCheckText, and
SpellCheckWord) take input strings as parameters, and several methods return strings
as output parameters.
Input strings are either big-endian Unicode strings with the bytes 0xFE 0xFF prepended,
or strings with PDFDocEncoding. In either case a string is expected to have the
appropriate null-termination. If a string is UCS-2 it may have embedded language and
country information.
Output text is in big-endian UCS-2 format with the bytes 0xFE 0xFF prepended. This
string can be converted to a host encoded string by using ASTextFromPDText and
ASTextGetEncodedCopy. For example:
char **altArray = NULL;
ASInt32 altCount = 0;
ASBool status = SpellCheckWord(acd, cWord, NULL, 0, &altArray,
&altCount);
if (altCount) {
ASText ast = ASTextFromPDText(altArray[1]);
char* altWord = ASTextGetEncodedCopy(ast,
(ASHostEncoding) PDGetHostEncoding() );
}

Spelling APIs
The Spelling APIs include:

SpellAddDictionary
SpellAddDomain
SpellAddWord
SpellCheck
SpellCheckRTF
SpellCheckText
SpellCheckWord
SpellCountKnownWords
SpellCustomDictionaryClose
SpellCustomDictionaryCreate
SpellCustomDictionaryDelete
SpellCustomDictionaryExport

226 Acrobat and PDF Library API Overview


Overview of the Acrobat Extended APIs
4
AcroColor Extended API

SpellCustomDictionaryOpen
SpellDictionaryNames
SpellDomainNames
SpellGetDocDictionaryOrder
SpellGetDocLanguageOrder
SpellGetNextWord
SpellIgnoreAll
SpellLanguages
SpellRemoveDictionary
SpellRemoveDomain
SpellRemoveWord
SpellSetDocDictionaryOrder
SpellSetDocLanguageOrder
SpellUserDictionaryOrder
SpellUserLanguageOrder
SpellUserWords

AcroColor Extended API


AcroColor is an HFT that allows you to access the AcroColor engine (ACE), which controls
color profile management for Adobe Acrobat. Plug-ins can import the AcroColor HFT to use
the color management methods.
While not, strictly speaking, an extended API (since the API is not exposed from a plug-in)
the AcroColor API is included here with the extended APIs since it doesnt fit into the
layered structure of the Acrobat core API. The AcroColor APIs, unlike the other extended
APIs, can be used by the PDF Library.
The AcroColor HFT encapsulates color management into a set of convenient objects and
functions. The objects represent basic color-management entities:
The color management engine, or ACE, which is used by the underlying software to
control a color management session.

Acrobat and PDF Library API Overview 227


Overview of the Acrobat Extended APIs
4
AcroColor Extended API

Device-specific ICC color profiles, which provide specific mapping between standard
color specifications and specific values for particular output devices that produce those
colors. Additional support objects include profile lists.
Color spaces for the different kinds of color production (such as Grayscale, RGB, CMYK).
Additional support objects include calibrated color spaces for standard color
specifications.
Tranformations between profiles or color spaces.
Color settings, as listed under Edit->Preferences->Color Management-> Settings in the
Acrobat UI. Color settings files contain, for instance, references to color profiles, and
apply across Adobe products. Additional support objects include a string object and
preset lists of settings.
You can create an ICC color profile from available data (ACMakeBufferProfile), or use
profiles that are installed on the system (ACGetWorkingSpaceProfile), or stored in
color settings files (ACGetSettingsProfile).
You can extract information directly from profiles, such as a string to use in the UI
(ACProfileDescription). However, the most important thing you do with color
profiles is use them to make transformations (ACMakeColorTransform). You can then
apply it (ACApplyTransform) to transform a set of image data from one profile to
another, so that it appears with the same colors on a different display device.
AcroColor objects are reference-counted. Each object type has an unreference method
(such as ACUnReferenceProfile). Whenever you create one of these objects, you are
responsible for using the corresponding unreference method to release it when you are
finished with it.

228 Acrobat and PDF Library API Overview


Overview of the Acrobat Extended APIs
4
AcroColor Extended API

The following figure illustrates the objects and their relationships.


PresetList
MakePresetList
String Get Count
Set
MakeString ting PresetListItemFile
sSt
StringASCII ring PresetFileToName
StringLocalized UnReferencePresetList
UnReferenceString
ACE StringUnicode
Settings
EngineCount
o file LoadSettings
EngineInfo r MakeSettings
SetEngine g sP GetSettingsUnsigned32
ttin UnReferenceSettings
M
on Se
et
ito G
rP
M
ak

ro
file
eP
r
of
ile
Li
st

ProfileFromDescription
ProfileFromCode Profile MakeColorTransform Transform
ProfileList
*ColorSpace ApplyTransform
*Count *Data
*ItemDescription UnReferenceTransform
Description
*ItemCode ProfilesMatch
al Gra B

UnReferenceProfileList
eC al G

*SIze
La y
ak C lR
M ake eCa

GetWorkingSpaceProfile
b

MakeBufferProfile
M ak
M

UnReferenceProfile

CalRGB
CalGray
CalLab

AcroColor APIs
The AcroColor APIs include:

ACApplyTransform
ACEngineCount
ACEngineInfo
ACGetSettingsProfile
ACGetSettingsString
ACGetSettingsUnsigned32
ACGetWorkingSpaceProfile
ACLoadSettings
ACMakeBufferProfile

Acrobat and PDF Library API Overview 229


Overview of the Acrobat Extended APIs
4
AcroColor Extended API

ACMakeCalGray
ACMakeCalLab
ACMakeCalRGB
ACMakeColorTransform
ACMakePresetList
ACMakeProfileList
ACMakeSettings
ACMakeString
ACMonitorProfile
ACPresetFileToName
ACPresetListCount
ACPresetListItemFile
ACProfileColorSpace
ACProfileData
ACProfileDescription
ACProfileFromCode
ACProfileFromDescription
ACProfileListCount
ACProfileListItemCode
ACProfileListItemDescription
ACProfileSize
ACProfilesMatch
ACSetEngine
ACStringASCII
ACStringLocalized
ACStringUnicode
ACUnReferencePresetList

230 Acrobat and PDF Library API Overview


Overview of the Acrobat Extended APIs
4
AcroColor Extended API

ACUnReferenceProfile
ACUnReferenceProfileList
ACUnReferenceSettings
ACUnReferenceString
ACUnReferenceTransform

Acrobat and PDF Library API Overview 231


Overview of the Acrobat Extended APIs
4
AcroColor Extended API

232 Acrobat and PDF Library API Overview


5 Acrobat Support (AS) Layer

The Acrobat Support (AS) layer of the core API provides a variety of utility methods,
including platform-independent memory allocation and fixed-point math utilities. In
addition, it allows plug-ins to replace low-level file system routines used by Acrobat
(including read, write, reopen, remove file, rename file, and other directory operations). This
enables Acrobat to be used with other file systems, such as on-line systems.
Several AS methods return error codes rather than raising exceptions on errors. This is
because these methods are called at a low level where exception handling would be
inconvenient and expensive.
This chapter summarizes the AS objects and methods supported by the Acrobat core API.
See the Acrobat and PDF Library API Reference for a detailed description of all methods.
This chapter also describes a set of platform-specific methods.

ASAtom
ASAtoms are hashed tokens that Acrobat uses in place of strings to optimize performance
(it is much faster to compare ASAtoms than strings). ASAtom methods convert between
strings and ASAtoms. ASAtom methods include:

ASAtomFromString Converts a string to an ASAtom.

ASAtomGetString Gets a string, given an ASAtom.

ASAtomExistsForString Tests whether an ASAtom exists for the specified string.

NOTE: With Acrobat 7, developers are encouraged to use new Cos-level methods that
address several problems with ASAtoms. Using the new APIs, you can dramatically
reduce the use of ASAtoms in the Cos layer by allocating and freeing strings. For
more information, see Names Without ASAtoms on page 29.

ASCab
ASCab objects (cabinets) can be used to store arbitrary key-value pairs. The keys are always
null-terminated strings containing only low-ASCII alphanumeric characters. An ASCab
owns all the non-scalar data inside it That is, when a plug-in places a value inside a cabinet,
the ASCab now manages the value and frees it when the key is destroyed. If, for example, a
plug-in creates an ASText object and adds it as a value to an ASCab, that ASText object

Acrobat and PDF Library API Overview 233


Acrobat Support (AS) Layer
5
ASCab

is no longer owned by the plug-in: it is owned by the ASCab. The ASCab destroys the
ASText object when the objects associated key is removed or its value is overwritten.
ASCabs are used to store data used by numerous Acrobat APIs, including AVCommand,
AVConversion, and batch security features.

ASCab Method Naming


The ASCab naming conventions indicate how the ASCab methods work. The conventions
are as follows:
Get methods return a value. These objects are owned by the ASCab and should not be
altered or destroyed by the caller of Get.
GetCopy methods make a copy of the data; the GetCopy caller owns the resulting
information and can do whatever it wants with it.
Detach methods work the same way as Get methods, but the key is removed from the
ASCab without destroying the associated value, which is passed back to the caller of
Detach.
Any of the ASCab methods can take a compound name or string consisting of multiple
keys, each of which is separated by a colon (:) character. This format is:
Grandparent:Parent:Child:Key
Acrobat burrows down through such a compound string until it reaches the most deeply
nested cabinet.

Handling Pointers
Normally, pointers are treated like scalars (for example, integers) in an ASCab: the ASCab
passes the pointer value back and forth but does not own the data pointed to.
If, however, the pointer has an associated destroyProc, this is no longer the case. When
the destroyProc is set, the ASCab reference counts pointers to track how many times
the pointer is being referenced from any ASCab. For example, the reference count is
incremented whenever the pointer is copied via ASCabCopy. Detaching a pointer
removes one reference to the pointer but does not destroy the associated data. The data is
destroyed by a call to the destroyProc when the reference count is 0.
ASCabDetachPointer returns a separate value indicating whether the pointer can
safely be destroyed or if it still is being referenced by other key/value pairs inside ASCabs.

ASCab Methods
ASCab methods include:

ASCabCopy Copies all key-value pairs from one cabinet into


another.

234 Acrobat and PDF Library API Overview


Acrobat Support (AS) Layer
5
ASCab

ASCabDestroy Destroys a cabinet and all its key-value pairs.

ASCabDetachBinary Retrieves the binary object stored under a key in a


cabinet and removes the key from the cabinet.
ASCabDetachCab Retrieves the ASCab object stored under a key in
a cabinet and removes the key from the cabinet.
ASCabDetachPathName Retrieves the ASPathName object stored under
a key in a cabinet and removes the key from the
cabinet.
ASCabDetachPointerRaw Retrieves a pointer stored under a key in a cabinet
and removes the key from the cabinet.
ASCabDetachString Retrieves a string stored under a key in a cabinet
and removes the key from the cabinet.
ASCabDetachText Retrieves the ASText object stored under a key
in the cabinet and removes the key from the
cabinet.
ASCabDup Creates a new ASCab object and populates it
with copies of the key-value pairs in another
cabinet.
ASCabEnum Enumerates all the keys in a cabinet.

ASCabEqual Compares two cabinets and verifies that they


have a matching set of keys.
ASCabFromEntryList Builds a cabinet based on a constant array of
ASCabDescriptor records.
ASCabGetAtom Returns an ASAtom value stored under a key in a
cabinet.
ASCabGetBinary Returns a binary object stored under a key in a
cabinet.
ASCabGetBinaryCopy Returns a copy of a binary object stored under a
key in a cabinet.
ASCabGetBool Returns the ASBool value stored under a key in a
cabinet.
ASCabGetCab Returns the ASCab object stored under a key in a
cabinet.
ASCabGetDouble Returns a double value stored under a key in a
cabinet.

Acrobat and PDF Library API Overview 235


Acrobat Support (AS) Layer
5
ASCab

ASCabGetInt Returns an ASInt32 value stored under a key in


a cabinet.
ASCabGetInt64 Returns an ASInt64 value stored under a key in
a cabinet.
ASCabGetPathNameCopy Returns a copy of an ASPathName object stored
under a key in a cabinet.
ASCabGetPointerDestroyProc Obtains a resource de-allocation callback
associated with a pointer stored under a key in a
cabinet.
ASCabGetPointerRaw Returns a pointer value stored under a key in a
cabinet.
ASCabGetPointerType Returns a string representation of the data type
referenced by a pointer stored under a key in a
cabinet.
ASCabGetString Returns a string stored under a key in a cabinet.

ASCabGetStringCopy Returns a copy of a string stored under a key in a


cabinet.
ASCabGetText Returns an ASText object stored under a key in a
cabinet.
ASCabGetType Returns the type of the value stored under a key
in a cabinet.
ASCabGetUns Returns an ASUns32 value stored under a key in
a cabinet.
ASCabGetUns64 Returns an ASUns64 value stored under a key in
a cabinet.
ASCabKnown Returns true if a key is present in a cabinet.

ASCabMakeEmpty Removes all keys from a cabinet and destroys all


values they point to.
ASCabMunge Munges the keys and the corresponding values in
a cabinet based on the keys in a cabinet and the
munge action.
ASCabNew Creates a new, empty cabinet.

ASCabNumEntries Returns the number of key-value pairs in a


cabinet.
ASCabPutAtom Stores an ASAtom value in a cabinet under a key.

236 Acrobat and PDF Library API Overview


Acrobat Support (AS) Layer
5
ASCallback

ASCabPutBinary Stores a binary object in a cabinet under a key.

ASCabPutBool Stores an ASBool value in a cabinet under a key.

ASCabPutCab Stores an ASCab object in a cabinet under a key.

ASCabPutDouble Stores a double value in a cabinet under a key.

ASCabPutInt Stores an ASInt32 value in a cabinet under a


key.
ASCabPutInt64 Stores an ASInt64 value in a cabinet under a
key.
ASCabPutNull Stores a value with a type of kASValueNull in a
cabinet under a key.
ASCabPutPathName Stores an ASPathName object in a cabinet under
a key.
ASCabPutPointerRaw Stores a pointer in a cabinet under a key.

ASCabPutString Stores a string in a cabinet under a key.

ASCabPutText Stores an ASText object in a cabinet under a key.

ASCabPutUns Stores an ASUns32 value under a key in a


cabinet.
ASCabPutUns64 Stores an ASUns64 value in a cabinet under a
key.
ASCabReadFromStream Reads a previously written cabinet from a stream

ASCabRemove Removes a key from a cabinet, destroying the


associated value.
ASCabRename Renames a key within a cabinet while preserving
the value associated with it.
ASCabValueEqual Compares two cabinet values and returns true if
and only if they are equal.
ASCabWriteToStream Writes a cabinet out to a stream.

ASCallback
Callbacks allows Acrobat to call functions in a plug-in. The core API provides macros to
create and destroy callbacks. These include ASCallbackCreateProto,
ASCallbackCreateReplacement, and ASCallbackCreateNotification

Acrobat and PDF Library API Overview 237


Acrobat Support (AS) Layer
5
ASDate

(defined in PICommon.h) and ASCallbackDestroy. These macros (which eventually


call the macro ASCallbackCreate) allow compilers to perform type checking,
eliminating an extremely common source of bugs.
NOTE: For these macros to perform type checking, you must #define DEBUG 1 before
compiling. Remember to #define DEBUG 0 before compiling a shipping version
of your plug-in.
It is sometimes necessary for a plug-in to call ASCallbackCreate directly; for example,
when it is passing function pointers without typedefs to the Macintosh toolbox routines.

ASDate
Date objects represent a particular date and time. All date objects are guaranteed to give
accurate representation of UTC time (not adjusted for leap seconds, as the addition of leap
seconds to the international calendar does not happen according to a well-defined rule).
The related ASTimeSpan object represents an exact time span, measured in seconds.
Methods allow you to set, clear, compare, add, and subtract dates and times in various
formats. The ASDate methods include the following:

ASDateAddCalendarTimeSpan Adds a calendar time span to a date.

ASDateAddTimeSpan Adds a time span (an exact number of seconds)


to a date.
ASDateCalendarDiff Calculates the difference between two
ASDate objects and stores the result in the
provided ASCalendarTimeSpan object.
ASDateClear Reinitializes an ASDate object to the newly-
allocated state, as returned by ASDateNew.
ASDateCompare Tests whether one date is earlier or later than
another.
ASDateCopy Copies date and time data from one ASDate
object to another.
ASDateDestroy Releases and destroys an ASDate object.

ASDateDup Creates a new ASDate object containing the


same data as an existing ASDate object.
ASDateExactDiff Calculates the exact difference in seconds
between two ASDate objects and stores the
result in the provided ASTimeSpan object.

238 Acrobat and PDF Library API Overview


Acrobat Support (AS) Layer
5
ASExtension

ASDateGetLocalTime Creates a time record that represents the local


time represented by the ASDate object.
ASDateGetTimeString Creates a time string from an ASDate object
according to a specified format.
ASDateGetUTCTime Creates a time record that represents the UTC
time represented by the ASDate object.
ASDateNew Creates an ASDate object.

ASDateSetLocalTimeOffset Sets an ASDate objects local time offset


according to the operating system's current
time zone information.
ASDateSetTimeFromRec Initializes an ASDate object from a time
record.
ASDateSetTimeFromString Initializes an ASDate object from a time string.

ASDateSetToCurrentLocalTime Sets an ASDate object to the current local


time, using the time zone information from the
operating system.
ASDateSetToCurrentUTCTime Sets an ASDate object to the current UTC time
with no time zone information.
ASDateSubtractCalendarTimeSpan Subtracts a calendar time span from a date.
ASDateSubtractTimeSpan Subtracts a time span (an exact number of
seconds) from a date.

ASExtension
An ASExtension represents a specific plug-in. A unique ASExtension object is created
for each plug-in when it is loaded. If the plug-in fails to initialize, the ASExtension
remains, but is marked as dead. The ASEnumExtensions method allows you to iterate
over all plug-in objects.

ASFile
The ASFile interface encapsulates Acrobats access to file services. It provides a common
interface for Acrobat, applications, and plug-ins to access file system services on different
platforms, and enables you to provide your own file storage implementations.
ASFile is related to the ASFileSys object, the ASPlatformPath object, and the
ASPathName structure.

Acrobat and PDF Library API Overview 239


Acrobat Support (AS) Layer
5
ASFile

An ASFile is an opaque representation of an open file. It is similar to an ASStm, although


it is a lower-level abstraction. An ASFile knows its ASPathName and ASFileSys.
Acrobat creates one ASFile for each open file, and layers one or more ASStm objects on
each ASFile. Logically, an ASFile is analogous to a file as used in the standard
UNIX/POSIX low-level file I/O functions open, close, read, write, and so forth (located
in <fcntl.h>), and an ASStm is analogous to a buffered file stream as used in standard C
file I/O functions fopen, fread, fwrite, and so forth (located in <stdio.h>). ASFile
methods include the following:

ASFileAcquirePathName Acquires a files path name

ASFileCanSetEOF Checks if ASFileSetEOF can be done for this


file with a specified new file size.
ASFileClearOutstandingMReads Clears all outstanding mreads for the given file.

ASFileClose Closes the specified file.


ASFileFlush Flushes any buffered data to a file.

ASFileFromMDFile Gets the ASFile associated with the specified


ASMDFile and ASFileSys.
ASFileGetEOF Gets the current size of a file.

ASFileGetEOF64 Gets the current size of a file.

ASFileGetFileSys Gets the file system on which a file resides

ASFileGetFileSysByName Gets the file system that was registered with the
specified name.
ASFileGetMDFile Given an ASFile, returns the file system and
the ASMDFile identification in that file
system.
ASFileGetOpenMode Returns a value corresponding to one or more
ASFileMode used to access/create the file,
ASFileGetPos Gets the current seek position in a file.

ASFileGetPos64 Gets the current seek position in a file.

ASFileGetURL Returns the URL associated with file.

ASFileHardFlush Causes a hard flush on a file.

ASFileHasOutstandingMReads Determines whether there are any outstanding


multibyte range requests for a file.
ASFileIsSame Performs a comparison between file and path
to determine if they represent the same file.

240 Acrobat and PDF Library API Overview


Acrobat Support (AS) Layer
5
ASFileSys

ASFileMReadRequest Initiates a byte range request for a given file, if


the file is in the browser.
ASFilePushData Sends data from a file system implementation
to an ASFile.
ASFileRead Reads data from a file.

ASFileRegisterFileSys Allows an implementor to provide a file system


for use by external clients.
ASFileReopen Attempts to reopen a file using the specified
read/write mode.
ASFileSetEOF Changes the size of a file.

ASFileSetEOF64 Changes the size of a file

ASFileSetMode Gets and/or sets the mode flags for a file.

ASFileSetPos Seeks to the specified position in a file.

ASFileSetPos64 Seeks to the specified position in a file.

ASFileStmRdOpen Creates a read-only ASStm from a file.

ASFileStmWrOpen Creates a writable ASStm from a file.

ASFileUnregisterFileSys Allows a file system to be unregistered.

ASFileWrite Writes data to a file, beginning at the current


seek position.

ASFileSys
An ASFileSys is a collection of functions that implement file system services, such as
opening files, deleting files, reading data from a file, and writing data to a file. Each
ASFileSys provides these services for one class of devices. Acrobat has a built-in
ASFileSys that services the platforms native file system. The Acrobat on Windows
includes an additional ASFileSys that services the OLE2 IStorage/IStream interfaces.
Plug-ins may create additional ASFileSys objects to service other file systems. For
example, a plug-in could implement an ASFileSys to access PDF files stored in a
document database or to access PDF files across a serial link.
An ASFileSysRec structure contains pointers to callback procedures used by the
ASFileSys and ASFile methods. See , File Systems on page 438 for more information
on implementing an ASFileSys. The primary service of an ASFileSys is to provide
clients with a readable and/or writable file object (ASFile) corresponding to a particular

Acrobat and PDF Library API Overview 241


Acrobat Support (AS) Layer
5
ASFileSys

named location (ASPathName ) on a particular type of device. An ASPathName is specific


to a given ASFileSys.
To allow Acrobat, another application, or a plug-in to open a file in your file system, your file
system must implement the pathFromDIPath method, which is used by
ASFileSysDIPathFromPath. This method converts a pathname specified in Acrobats
device-independent pathname representation to a file system-specific ASPathName, or
named location for a particular type of device. The ASPathName uses the ASFileSys
structure pointers for callback, and is specific to a given ASFileSys.
The device-independent representation is as defined in Section 3.10 in the PDF Reference.
Example device-independent paths are:
/volumename/segment/segment/filename
segment/filename
../../segment/filename
To allow Acrobat, another application, or a plug-in to create new open file actions for your
file system, your file system must implement the diPathFromPath method, which is
used by ASFileSysDIPathFromPath. This method converts a pathname specified in
your file systems ASPathName representation to Acrobats device-independent path
name representation.
NOTE: In some circumstances, the device-independent path name may be insufficient to
uniquely identify a particular file in your file system. For example, on the Macintosh
platform, it is possible to mount two different drives with the same name, and
potentially have the same path name to two different files, each on one of the
drives. If files cannot be uniquely identified by path name, you may also need to
register a PDFileSpecHandler for your file system. See , PDFileSpec on
page 322 for discussion of PDFileSpecHandlers.
To determine whether two ASFileSys instances are equal, your plug-in should compare
their ASFileSys pointers. It cannot, however, compare two ASPathNames directly to
determine whether or not they are equal; instead, it should convert them to device-
independent pathnames using ASFileSysDIPathFromPath, and compare the
resulting device-independent pathname strings. There are a few cases where comparing
device-independent pathnames may result in incorrectly believing two path names specify
the same file when they do not. For example, it is possible to have two identical path names
that specify files on different Macintosh disks.
The ASFileSys methods include:

ASFileSysAcquireFileSysPath Converts an ASPathName from one file


system to another.
ASFileSysAcquireParent Returns the parent folder of the file system
object associated with a pathname.

242 Acrobat and PDF Library API Overview


Acrobat Support (AS) Layer
5
ASFileSys

ASFileSysAcquirePlatformPath Returns a platform-specific filesystem rep-


resentation of the specified path, according
to the specified type, wrapped in an allo-
cated ASPlatformPath object.
ASFileSysCanPerformOpOnItem Tests whether a given operation can be
performed on a particular file.
ASFileSysConvertCabToItemProps Converts a set of item properties from the
ASCab format to the
ASFileSysItemPropsRec format.
ASFileSysConvertItemPropsToCab Converts a set of item properties from the
ASFileSysItemPropsRec format to
the ASCab format.
ASFileSysCopyPath Generates and copies the specified
ASPathName (but does not copy the file
specified by the pathname).
ASFileSysCreateFolder Creates an empty folder at the specified
pathname.
ASFileSysCreatePathName Creates an ASPathName based on the
input type and file specification.
ASFileSysDestroyFolderIterator Releases the resources associated with a
folder iterator.
ASFileSysDIPathFromPath Converts a platform-independent
pathname to a platform-dependent
pathname.
ASFileSysDIPathFromPathEx Converts a filename, specified as an
ASPathName, to a device-independent
pathname, returned as an ASText object.
ASFileSysDisplayASTextFromPath Returns a user-friendly representation of a
path as a text object.
ASFileSysDisplayStringFromPath Returns a user-friendly representation of a
path. It is the callers responsibility to
release the memory associated with the
returned string using ASfree.

Acrobat and PDF Library API Overview 243


Acrobat Support (AS) Layer
5
ASFileSys

ASFileSysFirstFolderItem Creates an iterator which can be used to


enumerate all objects inside the specified
folder, and also returns the properties of
the first item found in the folder.
ASFileSysFlushVolume Flushes the volume on which the specified
file resides.
ASFileSysGetFilePosLimit Returns the maximum file position that can
be processed by this file system.
ASFileSysGetItemProps Populates an ASFileSysItemProps
record with a full description of the file sys-
tem object associated with a pathname.
ASFileSysGetItemPropsAsCab Gets a full description of the file system
object associated with pathName, return-
ing the item properties in the ASCab for-
mat.
ASFileSysGetNameFromPath Extracts the filename (including extension)
from path.
ASFileSysGetNameFromPathAsASText Extracts the filename (including extension)
from path as an ASText object.
ASFileSysGetNameFromPathForDisplay Returns the representation of an item as it
would be shown in Windows Explorer or
the Mac Finder.
ASFileSysGetStorageFreeSpace Gets the amount of free space on the
volume containing a pathname.
ASFileSysGetTempPathName Gets the amount of free space on the
volume containing a pathname.
ASFileSysGetTypeAndCreator Gets the type and creator of the file
specified by the path.
ASFileSysNextFolderItem Continues the iteration process associated
with the ASFolderIterator object.
ASFileSysOpenFile Attempts to open a file in the specified file
system, in the specified read/write/create
mode.

244 Acrobat and PDF Library API Overview


Acrobat Support (AS) Layer
5
ASPlatformPath

ASFileSysOpenFile64 Attempts to open a file in the specified file


system, in the specified read/write/create
mode.
ASFileSysPathFromDIPath Converts a device-independent pathname
to an ASPathName.
ASFileSysPathFromDIPathEx Converts a device-independent pathname
in an ASText object to an ASPathName.
ASFileSysPerformOpOnItem Performs a specified operation on a
particular file.
ASFileSysReleasePath Decrements the internal reference count
for pathname and disposes of the path-
name (but not the file itself ) if the reference
count is zero.
ASFileSysReleasePlatformPath Releases the specified platform path object.

ASFileSysRemoveFile Attempts to delete the file referred to by a


pathname.
ASFileSysRemoveFolder Deletes the folder at the specified
pathname only if it is empty.
ASFileSysSetTypeAndCreator Sets the type and creator of a file.

ASFileSysURLFromPath Returns the URL corresponding to a


pathname.
ASGetDefaultFileSys Gets a platforms default file system.

ASPathFromPlatformPath Converts a platform-specific pathname to


an ASPathName.
NOTE: Do not use this method on the
Macintosh platform. Instead, call
ASFileSysCreatePathName.

ASPlatformPath
An opaque object used to retrieve a platform-specific path object. This object was added in
Acrobat 6.0 to improve device-independent path referencing.

Acrobat and PDF Library API Overview 245


Acrobat Support (AS) Layer
5
ASPlatformPath

The ASPlatformPath methods include:

ASPlatformPathGetCFURLRefRecPtr Gets a platform path object in the


form of a CFURLRef for Mac OS, if the
ASPlatformPath object was
acquired with this type in the plat-
formPathType parameter of
ASFileSysAcquirePlatform-
Path..
ASPlatformPathGetCstringPtr Gets a platform path object in the
form of a C string for Microsoft Win-
dows or UNIX, if the ASPlatform-
Path object was acquired with this
type in the platformPathType
parameter of ASFileSysAcquire-
PlatformPath.
ASPlatformPathGetFSRefPtr Gets a platform path object in the
form of an FSRef for Mac OS, if the
ASPlatformPath object was
acquired with this type in the plat-
formPathType parameter of
ASFileSysAcquirePlatform-
Path..
ASPlatformPathGetFSRefWithCFString Gets a platform path object in the
RefRecPtr form of an FSRef and CFStrin-
gRef for Mac OS, if the ASPlat-
formPath object was acquired with
this type in the platformPathType
parameter of ASFileSysAcquire-
PlatformPath.

246 Acrobat and PDF Library API Overview


Acrobat Support (AS) Layer
5
ASStm

ASPlatformPathGetFSSpecPtr Gets a platform path object in the


form of an FSSpec for Mac OS, if the
ASPlatformPath object was
acquired with this type in the plat-
formPathType parameter of
ASFileSysAcquirePlatform-
Path.
ASPlatformPathGetPOSIXPathPtr Gets a platform path object in the
form of a POSIX path C string, if the
ASPlatformPath object was
acquired with this type in the plat-
formPathType parameter of
ASFileSysAcquirePlatform-
Path..

ASStm
An ASStm is a data stream that may be a buffer in memory, a file, or an arbitrary user-
written procedure. You typically would use an ASStm to extract data from a PDF file. When
writing or extracting data streams, the ASStm must be connected to a Cos stream (see ,
CosStream on page 427).
ASStm methods allow you to open and close streams, and to read and write data. They
include:

ASFileStmRdOpen Creates a read-only ASStm from a file.


ASFileStmWrOpen Creates a writable ASStm from a file.
ASStmClose Closes the specified stream.
ASStmFlush Flushes any buffered data to the specified stream.
ASStmRead Reads data from stm into memory.
ASStmWrite Writes data from a memory buffer into an ASStm.

Acrobat and PDF Library API Overview 247


Acrobat Support (AS) Layer
5
ASText

ASText
An ASText object holds encoded text. In Acrobat, encoded text can be specified in one of
two ways:
As a null-terminated string of multi-byte text coupled with a host encoding. The host
encoding is platform-specific:
On the Macintosh, host encoding is specified as a script code.
On Windows, host encoding is a CHARSET code.
As an ASUns16 string of Unicode text terminated by an ASUns16 0 (two 0 bytes). The
string can be in either BigEndian or HostEndian format.
Each of the formats described in the following table can be mapped to one of the two cases
outlined above.

Format Description
Encoded A multi-byte string terminated with a single null character and coupled with
a specific host encoding indicator.
ScriptText A multi-byte string terminated with a single null character and coupled with
an ASScript code. (An ASScript is an enumeration of writing scripts.)
This is merely another way of specifying the Encoded case; the ASScript
code is converted to a host encoding using ASScriptToHostEncoding.
Unicode A series of ASUns16 values containing Unicode values in big-endian
format, terminated with a single ASUns16 0. Unicode refers to straight
Unicode without the 0xFE 0xFF prefix or language and country codes that
can be encoded inside a PDF document.
PDText A string of text pulled out of a PDF document. This is either a big-endian
Unicode string pre-pended with the bytes 0xFE 0xFF or a string in PDF
document encoding. In the Unicode case, this also may include language
and country identifiers. ASText objects strip language and country
information out of the PDText string and track them separately.

ASTexts also can be used to accomplish encoding conversions; your plug-in can request a
string in any of the formats specified above.
In all cases the ASText code attempts to preserve all characters. For example, if your plug-
in attempts to concatenate strings in separate host encoding, the implementation may
convert both to Unicode and perform the concatenation in Unicode space.
When creating a new ASText object, or putting new data in an existing object, Acrobat
will always copy the supplied data into the ASText object. The original data is yours to do
with as you will (and release if necessary).

248 Acrobat and PDF Library API Overview


Acrobat Support (AS) Layer
5
ASText

The size of ASText data always is specified in bytes, for example, the len argument to
ASTextFromSizedUnicode specifies the number of bytes in the string rather than the
number of Unicode characters.
Host encoding and Unicode strings are always terminated with a null character (which
consists of one null byte for host-encoded strings and two null bytes for Unicode strings).
You cannot create a string with an embedded null character even using methods that take
an explicit length parameter.
The GetXXX methods return pointers to data held by the ASText object. Your plug-in
cannot free or manipulate this data directly. The GetXXXCopy methods return data that
your plug-in can manipulate at will and is responsible for freeing.
ASText methods include:

ASTextCaseSensitiveCmp Compares two ASConstText objects, ignoring


language and country information.
ASTextCat Concatenates the from text to the end of the to
text, altering to but not from.
ASTextCatMany Concatenates a series of ASText objects to the end
of the to object.
ASTextCmp Compares two ASText objects, ignoring language
and country information.
ASTextCopy Copies the text in from to to, along with the
country and language.
ASTextDestroy Frees all memory associated with the text object.

ASTextDup Creates a new ASText object that contains the same


text/country/language as the one passed in.
ASTextEval Replaces percent-quoted expressions in the text
object with the result of their evaluation, using
key/value pairs in the ASCab.
ASTextFilter Runs the specified filter on a text object, modifying
the text as specified.
ASTextFromEncoded Creates a new text object from a null-terminated
multi-byte string in the specified host encoding.
ASTextFromInt32 Create a new string from an ASInt32 by converting
the number to its decimal representation without
punctuation or leading zeros.
ASTextFromPDText Creates a new string from PDF text taken out of a PDF
file.

Acrobat and PDF Library API Overview 249


Acrobat Support (AS) Layer
5
ASText

ASTextFromScriptText Creates a new string from a null-terminated multi-


byte string of the specified script.
ASTextFromSizedEncoded Creates a new text object from a multi-byte string in
the specified host encoding and of the specified
length.
ASTextFromSizedPDText Creates a new string from PDF text taken out of a PDF
file.
ASTextFromSizedScriptText Creates a new text object from the specified multi-
byte string of the specified script.
ASTextFromSizedUnicode Creates a new ASText from the specified Unicode
string. This string is not expected to have 0xFE
0xFF prepended, or country/language identifiers.
ASTextFromUnicode Creates a new string from a null-terminated Unicode
string.
ASTextFromUns32 Create a new string from an ASUns32 by converting
it to a decimal representation without punctuation or
leading zeros.
ASTextGetBestEncoding Returns the best host encoding for representing the
text.
ASTextGetBestScript Returns the best host script for representing the text.

ASTextGetCountry Gets the country associated with a piece of text


stored in an ASText object.
ASTextGetEncoded Returns a null-terminated string in the given
encoding.
ASTextGetEncodedCopy Returns a copy of a string in a specified encoding.

ASTextGetLanguage Retrieves the language code associated with an


ASText object.
ASTextGetPDTextCopy Gets the text in a form suitable for storage in a PDF
file.
ASTextGetScriptText Converts the Unicode string in the ASText object to
the appropriate script and returns a pointer to the
converted text.
ASTextGetUnicode Returns a pointer to a string in
kUTF16HostEndian format (see
ASUnicodeFormat).

250 Acrobat and PDF Library API Overview


Acrobat Support (AS) Layer
5
ASText

ASTextGetUnicodeCopy Returns a pointer to a null-terminated string in the


specified Unicode format.
ASTextIsEmpty Used to determine whether the ASText object con-
tains no textfor example, if retrieving Unicode text
would yield a 0-length string.
ASTextMakeEmpty Removes the contents of an ASText (turns it into an
empty string).
ASTextNew Creates a new ASText containing no text.

ASTextNormalizeEndOfLine Replaces all end-of-line characters within the


ASText object with the correct end-of-line charac-
ter for the current platform for example, for Windows,
\r and \n are replaced with \r\n.
ASTextReplace Replaces all occurrences of toReplace in src with
the text specified in replacement.
ASTextReplaceASCII Replaces all occurrences of toReplace in src with
the text specified in replacement.
ASTextReplaceBadChars Replaces all occurrences of characters contained in
the list pszBadCharList in the text with the spec-
ified replacement character.
ASTextSetCountry ASText objects can have country and language
codes associated with them.
ASTextSetEncoded Replaces the contents of an existing ASText object
with a null-terminated multi-byte string in the speci-
fied host encoding.
ASTextSetLanguage Sets the language codes associated with an ASText.

ASTextSetPDText Alters an existing string from PDF text taken out of a


PDF file.
ASTextSetScriptText Alters an existing string from a null-terminated multi-
byte string of the specified script.
ASTextSetSizedEncoded Alters an existing string from a multi-byte string in
the specified host encoding and of the specified
length.
ASTextSetSizedPDText Replaces the contents of an existing ASText object
with PDF text taken out of a PDF file.

Acrobat and PDF Library API Overview 251


Acrobat Support (AS) Layer
5
ASTimeSpan

ASTextSetSizedScriptText Replaces the contents of an existing ASText object


with the specified multi-byte string of the specified
script.
ASTextSetSizedUnicode Replaces the contents of an existing ASText object
with the specified Unicode string.
ASTextSetUnicode Alters an existing string from a null-terminated
Unicode string.

ASTimeSpan
An ASTimeSpan object represents an exact time span, measured in seconds. The internal
representation uses 64-bit signed integers (to avoid the 2038 problem caused by 32-bit
representation). Negative timespans are allowed.
ASTimeSpan methods include:

ASCalendarTimeSpanAddWith Adds two calendar time spans, storing the result in


Base another calendar time span object.

ASCalendarTimeSpanCompare Compares two calendar time spans with respect to a


base date.
ASCalendarTimeSpanDiff Calculates the difference between calendar time
span objects and stores the result in the provided
ASCalendarTimeSpan object.
ASTimeSpanAdd Adds two time spans, storing the result (an exact
number of seconds) in another time span object.
ASTimeSpanCompare Compares two time spans to see if they are equal, or
if one represents fewer seconds than the other.
ASTimeSpanCopy Copies data from one time span object to another.

ASTimeSpanDestroy Releases and destroys a time span object.

ASTimeSpanDiff Calculates the exact difference in seconds between


time span objects and stores the result in the pro-
vided ASTimeSpan object.
ASTimeSpanDup Creates a new time span object containing the same
data as an existing time span object.
ASTimeSpanGetASInt32 Gets the number of seconds from a time span object.

252 Acrobat and PDF Library API Overview


Acrobat Support (AS) Layer
5
Configuration

ASTimeSpanNegate Negates the time span value of a time span object.

ASTimeSpanNew Creates a time span object.

ASTimeSpanSet The internal representation of a time span uses 64-bit


signed integers (to avoid the 2038 problem caused
by 32-bit representation).
ASTimeSpanSetFromASInt32 Initializes a time span object to represent a time span
of a specific number of seconds.
ASTimeSpanSetFromString Convert a string to a number of seconds, and initial-
izes a time span object to represent a time span of
that number of seconds.

Configuration
The ASGetConfiguration method allows a plug-in to determine which version of
Acrobat it is running under. Because Adobe Reader supports only a subset of the core API, it
is vital that plug-ins use this method at start-up to ensure that the version of Acrobat
currently running supports the API methods they need, including whether Acrobat can
save changes to files (Acrobat can always save changes).

Errors
Acrobat supports a mechanism for registering and using error codes. These error codes
may be returned by methods, or (more commonly) used as exception codes when raising
exceptions. See Chapter 13, Handling Errors for a description of exceptions and their
handling.
Error methods include:

ASGetErrorString Gets a string describing the specified


error/exception.
ASGetExceptionErrorCode Gets the code of the most recently raised exception.
For convenience, your plug-in may use the
ERRORCODE macro described in , Exception
Handlers on page 451.
ASRaise Raises an exception.

ASRegisterErrorString Registers a defined error and an associated


descriptive string.

Acrobat and PDF Library API Overview 253


Acrobat Support (AS) Layer
5
Fixed-point Math

Fixed-point Math
These macros and methods support operations on fixed-point numbers. Acrobat uses 32-
bit fixed numbers, with the least significant 16 bits of a fixed-point number representing
the fractional part of the number. The operations supported include conversions between
integers and fixed-point numbers, conversions between C strings and fixed-point numbers,
math, rectangle utilities, and matrix operations. ASFixed is not a standard C type.
For more information, see Appendix E, Macros. The core API includes some macros and
some AS layer methods for making conversions.

Fixed-point Utility Macros


Some of the macros that convert between integer and fixed-point numbers, and that
specify common fixed-point numbers, are described here.

ASFixedRoundToInt32 Converts a fixed point number to an ASInt32 rounding


the result.
ASFixedTruncToInt32 Converts a fixed point number to an ASInt32 truncating
the result.
ASFloatToFixed Converts a floating point number to a fixed point
number.
ASInt32ToFixed Converts an ASInt32 to a fixed point number.

Fixed-point Mathematics Methods


The fixed-point mathematics methods are described here:

ASFixedDiv Divides two fixed point numbers.

ASFixedMul Multiplies two fixed point numbers.

ASFixedToFloat Converts a fixed point number to a floating point


number.

Fixed-point Matrix Methods


The fixed-point matrix methods are described here.

ASFixedMatrixConcat Multiplies two matrices.

ASFixedMatrixInvert Inverts a matrix.

254 Acrobat and PDF Library API Overview


Acrobat Support (AS) Layer
5
HFT Methods

ASFixedMatrixTransformRect Calculates the coordinates of a rectangles


corner points in another coordinate system.

In addition, the header file ASExpT.h contains a number of predefined constants for
specific fixed-point numbers.

HFT Methods
HFTs are the mechanism through which plug-ins call methods in Acrobat or in other
plug-ins. This capability enables plug-ins to override specific portions of Acrobats
functionality. For more information, see Acrobat SDK Plug-in Guide.
The AS group contains several methods for dealing with HFTs, including:

ASExtensionMgrGetHFT Gets an HFT by name.

HFTDestroy Destroys an existing HFT by freeing all the HFTs


memory.
HFTGetReplacedEntry Gets the HFTEntry that was replaced by the
specified HFTEntry in the specified entry.
HFTGetVersion Returns the version of the HFT, if available.

HFTIsValid Tests whether an HFT is valid.

HFTNewEx Creates an HFT.

HFTReplaceEntry Replaces a replaceable method in an HFT.

HFTServerDestroy Destroys an HFT server.

HFTServerNew Creates an HFT server.

HFTUnreplaceEntry Allows HFT replacements to be undone in cases such


as with the DigSig plug-in, which replaces a method
that Acrobat could use after DigSig unloads.

Memory Allocation
The core API provides methods for allocating and managing memory. These should always
be used instead of C functions such as malloc and free. Memory allocation methods
include:

ASmalloc Allocates a block of memory.

Acrobat and PDF Library API Overview 255


Acrobat Support (AS) Layer
5
Thread-safe Multithreading APIs

ASfree Frees a block of memory.

ASrealloc Reallocates (changes the size of ) a block of memory.

Thread-safe Multithreading APIs


The core API provides methods that support the ability to safely operate in a multithreaded
environment. The methods are primarily used with the PDF Library. These include:

ASGetRamFileSys Creates a virtual (memory resident) file system

ASRamFileSysSetLimitKB Sets the in-memory file system size limit, in kilobytes.

ASGetTempFileSys Gets the file system to be used for temporary files.

ASSetTempFileSys Sets the in-memory file system size limit, in kilobytes.

ASGetRamFileSys is used to create a virtual (memory-resident) file system. This file


system is flat and uses a single global directory that maps between filenames and files.
ASRamFileSysSetLimitKB is used to set the in-memory file system size limit, in
kilobytes. A RAM file system should be created and used by only a single thread.
NOTE: Multiple threads should be able to access a RAM file system created by another
thread, but such use is NOT recommended. Given the availability of a memory-
based file system, the client may wish the PDF Library to use that file system for
temporary files. ASSetTempFileSys and ASGetTempFileSys allow the client to
establish which file system is used for temporary files.
ASSetTempFileSys allows the client to set which file system is used for temporary files.
ASGetTempFileSys returns the file system to be used for temporary files. The default
temporary file system is the default file system as returned by ASGetDefaultFileSys.
If clients don't call ASSetTempFileSys to establish a temporary file system, no change
in system behavior will occur (ASGetDefaultFileSys will return a real default file
system as usual).
Both PDDocOpenWithParams and PDDocSaveWithParams allow the client to pass
an ASFileSys in the parameter structure. A client can call PDDocCreate to create a
new PDF file, put in contents, and then call PDDocSaveWithParams and specify the
ASFileSys returned by ASFileSysGetRamFileSys as the file system. The client can
then call ASFileSysOpenFile with the same ASFileSys parameter and the same
pathName to get an ASFile on the document and then call ASFileRead to get the
bytes and stream it off to a destination.
NOTE: The PDF Library currently has the notion of a temporary file pathname. The client
can set a pathname to be used when generating temporary files. The temporary file
system is orthogonal to the existing pathname mechanism.

256 Acrobat and PDF Library API Overview


Acrobat Support (AS) Layer
5
Platform-Specific Utilities

Using Threads
To use threads, simply make the appropriate system call (_beginthreadex on Windows,
and pthread_create on UNIX). While multiple threads cannot share PDFL datatypes,
they do share the same process heap; this means that an application can share generic
datatypes between threads. However, multiple threads should not attempt to write to the
same PDF document. There is not a problem, however, with multiple threads opening the
same file read-only.
NOTE: On Windows, CreateThread is not recommended if the application is using most
stdio.h-defined functions, including file I/O and string manipulation. It is best to
use _beginthreadex on Windows, which performs extra bookkeeping to ensure
thread-safety.

Platform-Specific Utilities

Macintosh
The core API includes Macintosh-specific methods for plug-ins. For details on all the
Macintosh methods available, see Macintosh-specific Methods in the Acrobat and PDF
Library API Reference. Methods include:

AVAppDidOrWillSwitchForDialog Useful when Acrobat is running embed-


ded in a browser and needs to present a
dialog for user input.
AVAppEnumSystemFonts Enumerates a list of fonts that are
installed in the system.
AVAppHandleAppleEvent Handles an Apple event.

AVRectToRect Converts an AVRect into a QuickDraw


rect.
AVWindowGetCursorAtPoint Queries the AVWindow for the appropri-
ate cursor for display at the given point (in
the AVWindows device coordinate
space).
RectToAVRect Converts a Macintosh rect to an AVRect.

UNIX
The core API also includes UNIX-specific utility methods, which are only available for
plug-ins. These methods allow a plug-in to

Acrobat and PDF Library API Overview 257


Acrobat Support (AS) Layer
5
Platform-Specific Utilities

Find out about its environment


Handle events
Synchronize its operation with the window manager
Read resources
Write items into the preferences file
Read the preferences file
UNIX methods include:

UnixAppAddModifierCallback Registers a callback to call when a KeyEvent


that specifies a modifier key is dispatched.
UnixAppClipboardGetItemId Gets the item_id, display, and window needed
to call XmClipboardCopy during a Copy or Cut
operation of a custom selection server
UnixAppDispatchEvent A wrapper function for XtDispatchEvent.

UnixAppGetAppShellWidget Gets the application shell widget created when


Acrobat called XtAppInitialize.
UnixAppGetPlugInFilename Gets the clients filename.

UnixAppLoadPlugInAppDefaults Loads the system and user application defaults


for a client into the screen resource database.
UnixAppProcessEvent A wrapper function for XtAppProcessEvent.

UnixAppRemoveModifierCallback Removes a callback added by


UnixAppAddModifierCallback.
UnixAppWaitForWm Dispatches events until the shell is mapped or the
time out specified by the shells XtNwaitForWm
and XmNwmTimeout has expired.
UnixMachinePortGetOffscreenPi If offscreen drawing is in effect, this method
xmap returns true and clients should draw directly onto
the display using XtWindow to obtain the Win-
dow associated with widget.
UnixSysGetConfigName Gets the Acrobats configuration name.

UnixSysGetCursor A convenience method for getting


internationalized cursors.
UnixSysGetCwd Gets the current working directory.

258 Acrobat and PDF Library API Overview


Acrobat Support (AS) Layer
5
Platform-Specific Utilities

UnixSysGetHomeDirectory Gets the home directory of the user running


Acrobat.
UnixSysGetHostname Gets the host name.

UnixSysGetIcon A convenience method for getting international-


ized icons, which are bitmaps (pixel maps
with depth 1).
UnixSysGetInstallDirectory Gets the directory in which Acrobat is installed.

UnixSysGetPixmap A convenience method for getting


internationalized pixel maps of depth greater
than 1.
UnixSysGetString A convenience method for getting
internationalized strings.
UnixSysGetTempFileDirectory Gets the temporary file directory specified by the
user. The default is /tmp.
UnixSysPrefInit Reads preferences from the specified file into a
resource manager database.
UnixSysPrefUpdate Updates a preference file read in by
UnixSysPrefInit.

Windows
Windows-specific utility methods are only available for plug-ins. These methods allow a
plug-in to:
Manipulate modal and modeless dialogs
Get the color palette
Control the AVAppIdle timer
Windows methods include:

WinAppEnableIdleTimer Allows a client to turn the AVAppIdle


timer on and off.
WinAppGetModalParent Gets the appropriate parent for any modal
dialogs created by a plug-in.
WinAppGetPalette Gets the applications color palette in the
case where the system is running in 256
color mode or less.

Acrobat and PDF Library API Overview 259


Acrobat Support (AS) Layer
5
Platform-Specific Utilities

WinAppGetPrinterHDC Gets the device context for a printer, which


is the HDC used to print a document.
WinAppRegisterInterface Registers a COM interface.

WinAppRegisterModelessDialog Registers modeless dialogs with Acrobat


so that the dialog gets the correct
messages.
WinAppUnRegisterModelessDialog Un-registers modeless dialogs with
Acrobat.

260 Acrobat and PDF Library API Overview


6 Acrobat Viewer (AV) Layer

The Acrobat Viewer (AV) layer of the core API (also known as AcroView) allows plug-ins to
control Acrobat and modify its user interface. Using the AV methods, a plug-in can add
menus and menu items, add buttons to the toolbar, open and close files, display simple
dialog boxes, and perform many other application-level tasks. Plug-ins must use AV layer
methods to be accessible through the Acrobat viewers user interface.
NOTE: AcroView methods are not available to the Adobe PDF Library.
The AV layer methods do not provide access to:
Detailed internal structure of a PDF file (provided by the PD layer methods described in
Chapter 7, Portable Document (PD) Layer).
Editing page contents (provided by the PDFEdit section of the core API, described in
Chapter 8, PDFEdit LayerCreating and Editing Page Content).
Low-level disk structure of a file (provided by the Cos section of the core API, described
in Chapter 10, Cos Layer).
File I/O system (provided by the AS methods, described in Chapter 5, Acrobat Support
(AS) Layer).
The AV layer consists of the objects shown in Figure 6.1, Acrobat Viewer Objects. The
relationships in the figure are not strictly hierarchical, but are meant to indicate how
objects are associated. For example, the PDTextSelect object is included in the figure
because of its close association with the AV selection methods.

FIGURE 6.1 Acrobat Viewer Objects

AVSys AVApp AVAlert

AVCommand AVSweetPea AVDoc AVActionHandler AVAnnotHandler AVMenuBar AVToolbar AVTool

AVPageView Selection AVWindow AVCrypt AVMenu AVMenuBar

AVGrafSelect PDTextSelect AVMenuItem

Acrobat and PDF Library API Overview 261


Acrobat Viewer (AV) Layer
6
General

NOTE: The AVUndo object, added in Acrobat 6.0, is not shown.


The following sections describe these objects and provide an overview of the methods
each supports. See the Acrobat and PDF Library API Reference for a detailed description of
each method.

General
General methods do not apply to a particular AV layer object. An example method is
AVDestInfoDestroy, which destroys a destination info object.

AVActionHandler
An AVActionHandler carries out an action. For instance, an action is what happens
when a link or bookmark is clicked in Acrobat. See Section 8.5 in the PDF Reference for more
information on actions.
When Acrobat executes an action, it looks for the action handler with a type matching
that of the action it is trying to execute. Acrobat invokes the matching handler to perform
the action. If no match is found, Acrobat ignores the user action.
Your plug-in can add new action handlers by using AVAppRegisterActionHandler,
expanding the range of action types to which Acrobat can respond. See Action Handlers
on page 430 for further information on creating action handlers.
Your plug-in can use AVActionHandlerGetProcs to get a structure containing
pointers to an action handlers methods. This method can be used to modify an existing
action handler.
AVActionHandler methods include:

AVActionHandlerGetProcs Gets a structure containing pointers to the action


handler's procedures.
AVActionHandlerGetType Gets the ASAtom specifying what type of actions an
action handler services.
AVActionHandlerGetUName Gets the string that was passed as the user friendly
when the action handler was registered using
AVAppRegisterActionHandler.

262 Acrobat and PDF Library API Overview


Acrobat Viewer (AV) Layer
6
AVAlert

AVAlert
AVAlert provides platform-independent support for displaying simple dialog boxes.
AVAlert methods include:

AVAlert Displays a dialog box containing a string, icon, and


up to three buttons.
AVAlertConfirm Displays a dialog box containing the
ALERT_CAUTION icon, the specified message and
OK and Cancel buttons.
AVAlertGetPref Retrieves the value stored under name in the
AVAlert preference store.
AVAlertNote Displays a dialog box containing a string and an OK
button.
AVAlertResetPrefs Resets the entire AVAlert preference store.

AVAlertSetPref Stores a value under name in the AVAlert


preference store.
AVAlertWithParams Displays an alert dialog with a feature set as
described by the supplied AVAlertParams.

AVAnnotHandler
An AVAnnotHandler is responsible for creating, displaying, selecting, and deleting a
particular type of annotation. There is one annotation handler for each annotation type.
Acrobat contains two built-in annotation types (notes and links), and plug-ins can add new
annotation handlers by using AVAppRegisterAnnotHandler. See Annotation
Handlers on page 430 for details on creating new annotation types.
An AVAnnotHandler is generally accessed through AVApp methods, but it has two
methods of its own, AVAnnotHandlerGetInfo and AVAnnotHandlerDeleteInfo.
AVAnnotHandler methods include:

AVAnnotHandlerDeleteInfo Delete the AVAnnotHandlerInfo associated with


an annotation handler.
AVAnnotHandlerGetInfo Gets the information structure associated with an
annotation handler.

Acrobat and PDF Library API Overview 263


Acrobat Viewer (AV) Layer
6
AVApp

AVApp
AVApp represents the Acrobat application itself. From the application layer, you can control
the appearance of Acrobat, whether Acrobat appears, and the size of the application
window. Your application has access to the menubar and the toolbar through this object.
The application layer also provides access to the visual representation of a PDF file on the
screen, that is, an AVDoc.
AVApp methods include:

AVAppBeginModal Prepares Acrobat to display a modal


window.
AVAppCanQuit Acrobat calls this method to obtain
permission (programmatically, not
using the user interface) when it wants
to quit.
AVAppChooseFolderDialog Displays a platform dependent folder
selection dialog. fileSys and
pathName will be NULL if the user
cancelled the operation.
AVAppCreateIconBundle6 Creates an icon bundle object from an
array of icon data records.
AVAppDidOrWillSwitchForDialog (Macintosh only) This call is useful
when Acrobat is running embedded in
a browser and needs to present a dia-
log for user input.
AVAppDoingFullScreen Tests whether the application is run-
ning in full-screen mode.
AVAppEndFullScreen Ends full-screen mode.
AVAppEndModal (Windows only) Informs Acrobat that a
modal window is no longer being
displayed.
AVAppEnumActionHandlers Enumerates all registered action
handlers, calling the user- supplied
procedure for each.
AVAppEnumAnnotHandlers Enumerates all registered annotation
handlers, calling the user- supplied
procedure for each.

264 Acrobat and PDF Library API Overview


Acrobat Viewer (AV) Layer
6
AVApp

AVAppEnumDocs Enumerates all AVDocs currently


open in Acrobat, calling the user-
supplied procedure for each.
AVAppEnumTools Enumerates all registered tools, calling
the user-supplied procedure for each.
AVAppEnumTransHandlers Enumerates all registered transition
handlers, calling the user-supplied
procedure for each.
AVAppFindCommandHandlerByName Gets the AVCommandHandler that
was registered under the given name.
AVAppGetActionHandlerByType Gets the action handler whose type is
specified.
AVAppGetAnnotHandlerByName Gets the annotation handler that
handles the specified annotation type.
AVAppGetActiveDoc Gets the frontmost document view.

AVAppGetCancelProc Gets the default application cancel


procedure.
AVAppGetDefaultTool Gets the default tool.

AVAppGetDocProgressMonitor Gets the standard application progress


monitor, which puts combined status
window/progress bar in the message
pane of the frontmost document win-
dow.
AVAppGetHowToPanelAutoShow Get the current auto-show state of a
HowTo panel.
AVAppGetLanguage Gets the language in which the
applications user interface is running.
AVAppGetLanguageEncoding Returns the ASHostEncoding
corresponding to Acrobat's current
locale setting.
AVAppGetLanguageWithParams Retrieves the language in which the
applications user interface is running,
in the format specified by the kLang-
Format member of the supplied
parameter structure.

Acrobat and PDF Library API Overview 265


Acrobat Viewer (AV) Layer
6
AVApp

AVAppGetLastActiveTool Gets the tool that was active before


the current tool became active.
AVAppGetMenubar Gets Acrobats menu bar, toolbar, or a
AVAppGetToolBar specific tool.
AVAppGetToolByName
AVAppGetToolBarByName
AVAppGetName Gets the ASAtom corresponding to
the application's name - that is, the
name of the file containing the Acro-
bat application.
AVAppGetNumDocs Gets the number of open document
views.
AVAppGetPrefAtom Retrieves an ASAtom stored in the
specified prefs section with the
specified key.
AVAppGetPrefBool Retrieves an ASBool stored in the
specified prefs section with the
specified key.
AVAppGetPrefCab Allocates and fills in an ASCab object
based on the specified prefs section
with the specified key.
AVAppGetPrefDouble Retrieves a double value stored in the
specified prefs section with the
specified key.
AVAppGetPreference Get and set user preferences for the
AVAppSetPreference application.

AVAppGetPrefInt Retrieves an ASInt32 stored in the


specified prefs section with the
specified key.
AVAppGetPrefPathName Retrieves an ASBool stored in the
specified prefs section with the
specified key.
AVAppGetPrefString Retrieves a char stored in the
specified prefs section with the
specified key.

266 Acrobat and PDF Library API Overview


Acrobat Viewer (AV) Layer
6
AVApp

AVAppGetPrefText Allocates and fills in an ASText object


based on the specified prefs section
with the specified key.
AVAppGetReportProc Retrieves a standard report proc that
can be used to report errors and
warnings to the user.
AVAppGetTransHandlerByType Gets the transition handler registered
for the specified transition type.
AVAppGetUUID Gets a unique identifier (UUID) for the
current user or the current session.
AVAppGetVersion Gets the major and minor version
numbers of Acrobat.
AVAppHandlePlatformEvent Handles a platform-specific event.

AVAppHelpSearch Opens the specified PDF file (if it is not


already open) and searches for a
specified string.
AVAppHelpShowContents Opens the specified PDF help file and
goes to the location of the specified
content.
AVAppHelpShowIndex Opens the specified PDF help file and
displays the index.
AVAppIsIdle Returns true if the application is in a
state in which it is safe to destroy a
document that uses the multi-read
protocol.
AVAppModalWindowIsOpen A client should use this method to
determine whether a modal window is
open.
AVAppOpenDialog Displays a platform-dependent file
open dialog.
AVAppOpenHelpFile Opens a specified help file from the
default installation help directory.
AVAppOpenHelpFileWithParams Opens a specified help PDF file, using
the specified parameters to control the
window's size, location, and
visibility.

Acrobat and PDF Library API Overview 267


Acrobat Viewer (AV) Layer
6
AVApp

AVAppRegisterActionHandler Registers an action handler within


Acrobat.
AVAppRegisterAnnotHandler Registers a handler for an annotation
subtype, replacing any previous han-
dler that had been registered for that
subtype.
AVAppRegisterCommandHandler Registers an AVCommand handler to
implement an AVCommand with the
specified name. See AVCommand on
page 270 and AVCommand Handlers
on page 431 for details.
AVAppRegisterForContextMenuAddition Registers a user-supplied procedure to
call after a context menu has been
created but before it is shown to the
user.
AVAppRegisterForPageViewAdjustCursor Registers a user-supplied procedure to
call each time the cursor is moved.
AVAppRegisterForPageViewClicks Registers a procedure to call each time
a mouse click occurs.
AVAppRegisterForPageViewKeyDown Registers a user-supplied procedure to
call each time a key is pressed in an
AVPageView.
AVAppRegisterForPageViewRightClicks Registers a user-supplied procedure to
call each time a user clicks the right
mouse button in an AVPageView.
AVAppRegisterFromPDFHandler Registers a handler
AVAppRegisterToPDFHandler (AVConversionFromPDFHandler
or AVConversionToPDFHandler)
to export from PDF to other file
formats, or to import other file formats
to PDF.
AVAppRegisterGlobalCommand Registers an AVCommand in the global
command list.
AVAppRegisterToolBarPosition Sets the position of a toolbar. A toolbar
can have separate positional attributes
for internal and external views.

268 Acrobat and PDF Library API Overview


Acrobat Viewer (AV) Layer
6
AVApp

AVAppRegisterForPageViewDrawing Registers a user-supplied procedure to


call each time a window is drawn, after
the pages contents and annotations
have been drawn.
AVAppRegisterHowToPanel Registers a HowTo panel with the
application.
AVAppRegisterIdleProc Registers a user-supplied procedure to
call regularly when Acrobat is
otherwise idle.
AVAppRegisterLateInitProc Registers a callback that will be called
once, when Acrobat is first idle and not
drawing during idle.
AVAppRegisterNotification Registers a user-supplied procedure to
call when the specified event occurs.
AVAppRegisterTool Registers the specified tool with
Acrobat.
AVAppRegisterTransHandler Registers a transition handler within
Acrobat.
AVAppSaveDialog Displays a platform-dependent file
save dialog.
AVAppSetActiveTool Sets the active tool.

AVAppSetHowToPanelAutoShow Set the current auto-show state of a


HowTo panel.
AVAppSetHowToPanelAutoShowText When the auto-show state of a HowTo
panel is true, the panel is shown when-
ever when the client calls
AVAppAutoShowHowToPanel.
AVAppSetHowToPanelComputeVisibleProc Registers a new HowTo panel callback
with the application.
AVAppShouldKeyDeleteObject Returns whether the passed keyCode
should cause a selected item to be
deleted.
AVAppUnregisterForPageViewAdjustCursor Un-registers a user-supplied adjust
cursor procedure.
AVAppUnregisterForPageViewClicks Un-registers a user-supplied page view
click procedure.

Acrobat and PDF Library API Overview 269


Acrobat Viewer (AV) Layer
6
AVCommand

AVAppUnregisterForPageViewDrawing Un-registers a user-supplied page view


drawing procedure.
AVAppUnregisterForPageViewDrawingEx Un-registers a user-supplied page view
drawing procedure.
AVAppUnregisterForPageViewKeyDown Un-registers a user-supplied page view
key down procedure.
AVAppUnregisterForPageViewRightClicks Un-registers a user-supplied
procedure to call each time a user
clicks the right mouse button in an
AVPageView.
AVAppUnregisterGlobalCommand Removes an AVCommand from the
global command list.
AVAppUnregisterIdleProc Un-registers a user-supplied idle
procedure.
AVAppUnregisterNotification Un-registers a user-supplied
notification procedure.
AVAppYieldToOtherApps (Macintosh Only) Yield to other
applications for yieldTimeout.

AVCommand
An AVCommand represents an action that the user can perform on the current document
or the current selection in the current document. An AVCommand can be added to a
command sequence and executed either interactively or by means of batch processing,
using the method AVCommandExecute.

Invoking AVCommands Programmatically


To invoke AVCommands programmatically using the AVCommand methods, a plug-in client
must:
1. Instantiate the command.
To instantiate an AVCommand, the client must call the AVCommandNew method,
providing the registered name of the command, for example:
ASAtom cmdName;
AVCommand cmd;

cmdName = ASAtomFromString ("MinimalCommand");


cmd = AVCommandNew (cmdName);

270 Acrobat and PDF Library API Overview


Acrobat Viewer (AV) Layer
6
AVCommand

For details on registering AVCommand handlers, see AVCommand Handlers on


page 431.
2. Configure the command by setting required and optional parameters. See Configuring
Commands below.
3. Run the command, using AVCommandExecute or AVCommandWork.

Configuring Commands
Prior to executing the AVCommand, the client can configure three categories of properties:
Input parameters (required)
Configuration parameters (optional - initialized to defaults)
AVCommand parameters (optional - initialized to defaults)
Input Parameters
At minimum, the client must configure the AVCommands input parameters. The command
must be provided with a PDDoc upon which to operate, as shown in this example.
PDDoc pdDoc; // Initialized elsewhere
// Create cab to hold input parameters and populate
ASCab inputs = ASCabNew();
ASCabPutPointer (inputs, kAVCommandKeyPDDoc, PDDoc, pdDoc, NULL);
// Set the input parameters and destroy the container ASCab
if (kAVCommandReady != AVCommandSetInputs (cmd, inputs)) {
// Handle error
}
ASCabDestroy (inputs);
All other inputs are optional. See the description of AVCommandSetInputs in the
Acrobat and PDF Library API Reference, for details.
Configuration Parameters
Optionally the client can set configuration parameters. The default UI policy is for
commands to be fully interactive. To invoke the command programmatically instead, the
client can create an ASCab object and populate it with the appropriate parameters, for
example,
// Create cab to hold config parameters and populate
ASCab config = ACabNew();
ASCabPutInt (config, "UIPolicy", kAVCommandUISilent);

if (kAVCommandReady != AVCommandSetConfig (cmd, config)) {


// Handle error
ASCabDestroy (config);

AVCommand Parameters
An AVCommands parameter set is specific to each command. For example, the Document
Summary command accepts values for five parameters: Title, Subject, Author, Keywords,

Acrobat and PDF Library API Overview 271


Acrobat Viewer (AV) Layer
6
AVCommand

Binding, and LeaveAsIs. As in the Configuration Parameters example, a plug-in can create
ASCabs to hold the appropriate parameters; then it can create empty ASText objects to
hold the parameter values and put these values in the ASCabs. The following example uses
this approach to set Document Summary title and subject values:
const char *docTitleValue = "Document Title";
const char *docSubjectValue = "Document Subject";

// Create cab to hold command parameters and populate

ASCab params = ASCabNew();


ASText text = ASTextNew();
ASTextSetEncoded (text, docTitleValue,
(ASHostEncoding)PDGetHostEncoding());
ASCabPutText (params, docTitleKey, text);
text = ASTextNew();
ASTextSetEncoded (text, docSubjectValue,
(ASHostEncoding)PDGetHostEncoding());
ASCabPutText (params, docSubjectKey, text);
...
ASCabDestroy(params);

AVCommand Methods
AVCommand methods include:

AVCommandCancel Cancels the specified command.

AVCommandDestroy Destroys the specified command and its associated


resources.
AVCommandExecute A wrapper method that repeatedly calls
AVCommandWork until the command returns a status
code other than kAVCommandworking.
AVCommandGetAVDoc Gets the AVDoc from a commands inputs ASCab.

AVCommandGetCab Returns the ASCab stored in the specified command


under key.
AVCommandGetCancelProc Returns a cancellation procedure for the command.

AVCommandGetConfig Retrieves the configuration parameters for the


specified command.
AVCommandGetInputs Gets or sets the input parameters of the specified
AVCommandSetInputs command.

AVCommandGetName Returns the name of the command.

272 Acrobat and PDF Library API Overview


Acrobat Viewer (AV) Layer
6
AVConversion

AVCommandGetParams Gets or sets the parameter set for the specified


AVCommandSetParams command.

AVCommandGetPDDoc Retrieves the PDDoc from a command's inputs ASCab.

AVCommandGetProgressMonitor Returns a progress monitor the command can use to


report progress.
AVCommandGetProps Retrieves the properties of the specified command.

AVCommandGetReportProc Returns the ASReportProc associated with the


specified command.
AVCommandGetStatus Returns the current status of the specified command.

AVCommandGetUIPolicy Retrieves the user interface policy that the command


will respect while it is executed.
AVCommandNew Creates a new command of the specified type.

AVCommandPutCab Stores a cabinet in the specified command.

AVCommandReset Resets the specified command.

AVCommandSetConfig Sets the configuration for the specified command.

AVCommandSetInputs Sets the input parameters of the specified command.

AVCommandSetParams Sets the parameters for the specified command.

AVCommandShowDialog Instructs the command to bring up its configuration


dialog and gather parameter information from the
user.
AVCommandWork Instructs the command do some work based on its
current parameters.

AVConversion
The AVConversion methods enable conversion from non-PDF file formats to PDF and
vice versa. For information on using the AVConversion methods to create a file
conversion handler, see File Format Conversion Handlers on page 434.
The AVConversion methods include:

AVConversionConvertFromPDFWithHandler Converts a PDF document to


another file format using the
specified handler.

Acrobat and PDF Library API Overview 273


Acrobat Viewer (AV) Layer
6
AVCrypt

AVConversionConvertStreamFromPDFWithH Converts a PDF document to a


andler stream using the handler
specified.
AVConversionConvertStreamFromStructNo Converts a structure node to a
deWithHandler stream using the handler
specified.
AVConversionConvertStreamToPDF Converts the specified stream to
a PDF document using whatever
converter is found.
AVConversionConvertStreamToPDFWithHan Converts the specified file to a
dler PDF document using the
specified handler.
AVConversionConvertToPDF Converts the specified file to a
PDF document using whatever
converter is found.
AVConversionConvertToPDFWithHandler Converts a file to a PDF
document using the specified
handler.
AVConversionEnumFromPDFConverters Enumerates all registered
ConvertFromPDF conversion
handlers.
AVConversionEnumToPDFConverters Enumerates all registered
ConvertToPDF conversion
handlers.

AVCrypt
AVCrypt methods implement Acrobats built-in dialogs for encryption control. They are
present in the core API so that they can be used by other security handlers. The AVCrypt
methods include:

AVAuthOpen Determines if a user is authorized to open a


document.
AVCryptDoStdSecurity Displays a security dialog to the user, allowing the
user to change a documents print, edit, and copy
permissions.

274 Acrobat and PDF Library API Overview


Acrobat Viewer (AV) Layer
6
AVDoc

AVCryptGetPassword Displays the standard dialog box that lets a user


enter a password. The PDDocAuthorize or
PDDocPermRequest method (see PDDoc on
page 313) actually checks the password.

AVDoc
An AVDoc is a view of a PDF document in a window. Usually there is one AVDoc per
displayed document. Unlike a PDDoc (described in PDDoc on page 313), an AVDoc has a
window associated with it. Starting with Acrobat 7, it is possible to have multiple windows
open on the same document. An API client can track the coming and going of document
windows using three new notifications and query for all windows open for an AVDoc using
two new API calls. AVDoc methods include:

AVDocAlert Displays an alert containing the specified mes-


sage, icon, and one to three buttons with the
specified titles.
AVDocAlertConfirm Displays a dialog box containing the
ALERT_CAUTION icon, the specified message
and OK and Cancel buttons.
AVDocAlertNote Displays a dialog box containing the
ALERT_NOTE icon, the specified message and
an OK button.
AVDocAlertYesNo Displays an dialog box containing the speci-
fied message, icon, and two or three buttons
with the titles Yes, No,
and (optionally) Cancel.
AVDocBeginUndoOperation Begins an undo group for the document.

AVDocClearSelection Clears and destroys the current selection by


calling the appropriate selection server's
AVDocSelectionLosingSelection-
Proc.
AVDocClearUndos Clears the entire undo list for the AVDoc and
releases all associated AVUndo objects.
AVDocClose Closes a document.

AVDocCopyAction Makes a copy of the action for the (possibly


different) specified AVDoc.

Acrobat and PDF Library API Overview 275


Acrobat Viewer (AV) Layer
6
AVDoc

AVDocCopyActionCommon Makes a copy of the action for the (possibly


different) specified AVDoc.
AVDocCopyAdditionalActions Makes a copy of the action for the (possibly
different) specified AVDoc.
AVDocCopyAnnot Makes a copy of the annotation for the
(possibly different) specified AVDoc.
AVDocCopyAnnotCommon Makes a copy of the annotation for the
(possibly different) specified AVDoc.
AVDocCopySelection Copies the current selection to the clipboard, if
possible.
AVDocDeleteSelection Deletes the specified document's current
selection, if possible.
AVDocDoActionPropsDialog Displays a modal dialog that allows a user to
specify an action. Used, for example, by forms
to add actions to fields.
AVDocDoAnnotProperties Show the properties dialog for the specified
annotation.
AVDocDoCopyAs Prompts the user with a standard file dialog
and copies the file doc byte for byte.
AVDocDoPrint Performs the print operation, including user
dialogs.
AVDocDoSave Replacable method that allows plug-ins to
implement their own save functionality.
AVDocDoSaveAs Displays a file dialog and saves the document
to a potentially new name.
AVDocDoSaveAsWithParams Saves a file, using the parameters specified in
paramsIn.
AVDocDoSelectionProperties Displays the user interface, if any, for setting
the current selection's properties.
AVDocEndUndoOperation Ends an undo group for the document.

AVDocEnumSelection Enumerates the elements of the current selec-


tion by calling the current selection server's
AVDocSelectionEnumSelectionProc
callback.
AVDocFromPDDoc Gets the AVDoc associated with a PDDoc.

276 Acrobat and PDF Library API Overview


Acrobat Viewer (AV) Layer
6
AVDoc

AVDocGetActiveTool Gets the active tool for the AVDoc.

AVDocGetAVWindow Gets the AVWindow in which the document is


displayed.
AVDocGetBookmarks Gets the set of bookmarks for a given
document that satisfy the input filter.
AVDocGetClientName Gets the AVDoc client (container application)
name.
AVDocGetLastActiveTool Gets the tool that was active for this document
before the current tool became active.
AVDocGetNthPageView Gets the specified AVPageView for the
specified document.
AVDocGetNthWindow Gets the specified AVWindow for the specified
document.
AVDocGetNumPageViews Gets the number of page views for the
specified document.
AVDocGetNumWindows Returns the number of windows currently
open for the document.
AVDocGetPageText Gets the text from the specified text selection,
converts it to the specified format, and passes
it to a user-supplied procedure.
AVDocGetPageView Gets the AVPageView for the specified
document.
AVDocGetPDDoc Gets the PDDoc to associate with the specified
AVDoc.
AVDocGetSelection Gets the current selection for the specified
document.
AVDocGetSelectionServerByType Gets the selection server that handles the
specified selection type.
AVDocGetSelectionType Gets the current selection's type for the
specified document.
AVDocGetServerType Gets the server type for the specified
document.
AVDocGetSplitterPosition Gets the splitter position.

AVDocGetTopUndo Returns the most recent AVUndo record in the


document's undo list, if it of the desired type.

Acrobat and PDF Library API Overview 277


Acrobat Viewer (AV) Layer
6
AVDoc

AVDocGetTopUndoAndRedo Returns the most recent undo and redo


records in the document's undo list, if they are
of the desired type.
AVDocGetViewDefEx Fills out the given view definition with the
information needed to restore this document's
state at a later date.
AVDocGetViewMode Gets the current view mode.

AVDocIsDead Determines whether a given document is


dead.
AVDocIsExternal Determines whether a given document is dis-
played in an application's external window
(such as in a Web browser's window).
AVDocIsReadOnly Checks to see if an AVDoc is read-only.

AVDocIsSlow Determines whether a given document is on a


slow file system (such as a Web browser).
AVDocOpenFromASFileWithParams Opens and displays a document from a file,
using the specified parameters to control the
window's size, location, and visibility.
AVDocOpenFromASFileWithParamString Opens and displays a document from an
ASFile, using the specified parameters to
control the window's size, location, and visibil-
ity, and passing a URL open action string to
control how the file is opened.
AVDocOpenFromFile Opens and displays a document from a file.

AVDocOpenFromFileWithParams Opens and displays a document from a file,


using the specified parameters to control the
window's size, location, and visibility.
AVDocOpenFromFileWithParamString Opens and displays a document from a file,
using the specified parameters to control the
window's size, location, and visibility, and
passing a URL open action string to control
how the file is opened.
AVDocOpenFromPDDoc Opens and returns an AVDoc view of pdDoc.

278 Acrobat and PDF Library API Overview


Acrobat Viewer (AV) Layer
6
AVDoc

AVDocOpenFromPDDocWithParams Opens and displays a document from a


PDDoc, using the specified parameters to con-
trol the window's size, location, and visibility.
AVDocOpenFromPDDocWithParamString Opens and displays a document from a
PDDoc, using the specified parameters to con-
trol the window's size, location, and visibility,
and passing a URL open action string to con-
trol how the file is opened.
AVDocPerformAction Performs an action.

AVDocPerformActionEx Same as AVDocPerformAction, but


provides context for the execution of the
action.
AVDocPermRequest An exact way to ask if an operation is
permitted.
AVDocPrintPages Prints pages from a document without
displaying a print dialog to the user.
AVDocPrintPagesWithParams Prints a document with a full range of options.

AVDocPrintSeparations Prints document color separations using the


supplied parameters.
AVDocRegisterSelectionServer Registers a new selection server with Acrobat.

AVDocSelectionEnumPageRanges Enumerates the pages on which there is a


selection by calling the current selection
servers AVDocSelectionEnumPag-
eRangesProc callback.
AVDocSendAuxData Sends auxiliary data to an AVDoc.

AVDocSetActiveTool Sets the active tool for the AVDoc.

AVDocSetClientName Sets the AVDoc client (container application)


name.
AVDocSetDead Indicates the file stream for this document is
terminated, although the AVDoc is still open.
AVDocSetReadOnly Sets the read-only state of an AVDoc.

Acrobat and PDF Library API Overview 279


Acrobat Viewer (AV) Layer
6
AVGrafSelect

AVDocSetSelection Sets the document's current selection to the


specified selection by calling the appropriate
selection servers AVDocSelectionGet-
tingSelectionProc callback.
AVDocSetSplitterPosition Sets the splitter position.

AVDocSetViewDefEx Sets the documents state to match the


information in viewDef.
AVDocSetViewMode Shows bookmarks, thumbnails, neither, or uses
full-screen mode.
AVDocShowSelection Displays the current selection by calling the
selection servers
AVDocSelectionShowSelectionProc
callback.

AVGrafSelect
An AVGrafSelect is a graphics selection on a page. It is a rectangular region of a page
that can be copied to the clipboard as a sampled image. After a plug-in creates an
AVGrafSelect, it can use AVDocSetSelection to set the AVGrafSelect as the
current selection and AVDocShowSelection to scroll it to a visible position in the
window.
AVGrafSelect methods include:

AVGrafSelectCreate Creates a graphics selection.

AVGrafSelectDestroy Destroys a graphics selection.

AVGrafSelectGetBoundingRect Gets a graphics selections bounding rectangle.

AVMenu
An AVMenu is a menu in the Acrobat viewers menubar. Plug-ins can create new menus,
add menu items at any location in any menu, and remove menu items. Deleting an
AVMenu removes it from the menubar (if it was attached) and deletes all the menu items it
contains.
There is a special AVMenu with the title Tools. This menu (the About Plug-ins menu item and
the Plug-in Help menu item) are always created when Acrobat is launched. They are

280 Acrobat and PDF Library API Overview


Acrobat Viewer (AV) Layer
6
AVMenu

removed if and only if they are empty after every plug-ins initialization routines have been
called.
Submenus (also called pullright menus) are AVMenu objects that are attached to an
AVMenuItem instead of to the menubar.
Each menu has a title and a language-independent name. The title is the string that appears
in the user interface, while the language-independent name is the same regardless of the
language used in the user interface. Language-independent names allow a plug-in to
locate the File menu without knowing, for example, that it is called Fichier in French and
Ablage in German.
It is strongly encouraged that you begin your language-independent menu names with the
plug-in name (separated by a colon) to avoid name collisions when more than one plug-in
is present. For example, if my plug-in is named myPlug, it might add a menu whose name
is myPlug:Options.
Your plug-in cannot directly remove a submenu. Instead, it must remove the AVMenuItem
to which the submenu is attached.
The AVMenu methods include:

AVMenuAcquire Acquires the specified menu. Increments the menu's


reference count. When you are done using the menu
item, release it using AVMenuRelease.
AVMenuAcquireMenuItemBy Acquires the menu item at the specified location in
Index the specified menu.

AVMenuAddMenuItem Adds a menu item at a specified location in a menu.

AVMenuClone Clones a menu, creating a new menu which is an


exact duplicate of the original, except that shortcuts
are not created for the items.
AVMenuDoPopUp Pops up a submenu.

AVMenuGetMenuItemIndex Gets the index of the specified menu item in the


specified menu.
AVMenuGetName Gets the language-independent menu name.

AVMenuGetNumMenuItems Gets the number of menu items in a menu, including


those that are visible only in long-menus mode.
AVMenuGetParentMenubar Gets the parent menubar for the specified menu.

AVMenuGetParentMenuItem Gets the parent menu item for the specified menu.

AVMenuGetTitle Gets the menu's title as it appears in the user


interface.

Acrobat and PDF Library API Overview 281


Acrobat Viewer (AV) Layer
6
AVMenubar

AVMenuGetTitleAsASText Gets the menus title as it appears in the user


interface, as an ASText object.
AVMenuIsHiddenOnMenubar Tests whether a menu is hidden on the menubar.

AVMenuNew Creates a new menu.

AVMenuNewWithASText Creates and acquires a new menu with the given title
and language-independent name.
AVMenuRelease Releases a previously acquired menu.

AVMenuRemove Removes a menu from the menu bar.

AVMenubar
The AVMenubar is Acrobats menubar and contains a list of all menus. There is only one
AVMenubar. Plug-ins can add new menus to, or remove any menu from, the menubar. The
menubar can be hidden from the users view. The AVMenuBar methods include:

AVMenubarAcquireMenuByIndex Acquires the menu with the specified


index.
AVMenubarAcquireMenuByName Acquires the menu with the specified
name.
AVMenubarAcquireMenuByPredicat Acquires a menu using a user-supplied
e selection routine.

AVMenubarAcquireMenuItemByName Acquires the menu item with the specified


name.
AVMenubarAcquireMenuItemByPred Acquires a menu item using a user-
icate supplied selection routine.

AVMenubarAddHiddenMenu Inserts a hidden menu into the menubar.

AVMenubarAddMenu Adds a menu to the menubar.

AVMenubarGetMenuIndex Gets the index of the specified menu in


the menubar.
AVMenubarGetNumMenus Gets the number of menus in menubar.

AVMenubarHide Hides the menubar.

AVMenubarShow Shows the menubar.

282 Acrobat and PDF Library API Overview


Acrobat Viewer (AV) Layer
6
AVMenuItem

AVMenuItem
An AVMenuItem is a menu item in a menu. It has attributes, including
A name
A keyboard shortcut
A procedure to execute when the menu item is selected
A procedure to compute whether the menu item is enabled
A procedure to compute whether the menu item is check marked, and whether it has a
submenu.
Menu items also may serve as separators between menu items. You are encouraged to
position your plug-in menu items relative to a separator. This helps ensure that if a block of
menu items is moved in a future version of Acrobat, your plug-ins menu items also are
moved.
In Acrobat 4.0 and higher, plug-ins can be liberal in their use of separators. After
initialization, Acrobat 4.0 and higher clean up by removing separators at the beginning or
end of menus as well as removing duplicate separators.
A plug-in can simulate a user selecting a menu item by calling AVMenuItemExecute. If
the menu item is disabled, AVMenuItemExecute returns without doing anything.
AVMenuItemExecute works even when the menu item is not displayed (for example, if it
has not been added to a menu, its menu is not displayed, or the menu bar is not visible).
Plug-ins can set all attributes of menu items they create, but must not set the Execute
procedure of Acrobats built-in menu items.
Your plug-in can specify menu item names using either the names seen by a user, or
language-independent names. The latter allows your plug-in to locate the Print menu
item without knowing, for example, that it is called Imprimer in French and Drucken in
German.
You are strongly encouraged to begin your plug-ins language-independent menu item
names with your plug-ins name (separated by a colon) to avoid name collisions when more
than one plug-in is present. For example, if my plug-in is named myPlug, it might add
menu items whose names are myPlug:Open and myPlug:Find.
The AVMenuBar methods include:

AVMenuItemAcquire Acquires a menu item.

AVMenuItemAcquireSubmenu Acquires the submenu attached to the specified


menu item, if there is one.
AVMenuItemClone Creates a new menu item object using an
existing menu item as a template.
AVMenuItemExecute Executes a menu items action by invoking the
ExecuteProc procedure.

Acrobat and PDF Library API Overview 283


Acrobat Viewer (AV) Layer
6
AVMenuItem

AVMenuItemGetLongOnly Gets the flag indicating whether a menu item is


visible only in long-menus mode.
AVMenuItemGetName Gets the language-independent name of the
menu item.
AVMenuItemGetParentMenu Gets the menu in which the specified menu item
appears.
AVMenuItemGetShortcut Gets the shortcut key for the specified menu
item.
AVMenuItemGetTitle Gets a menu item's title, which is the string that
appears in the user interface.
AVMenuItemGetTitleAsASText Gets the menu item's title as it appears in the
user interface, as an ASText object.
AVMenuItemIsEnabled Tests whether the specified menu item is
enabled.
AVMenuItemIsMarked Tests whether menuItem is marked (for example,
appears with a check mark).
AVMenuItemIsVisible Tests whether the specified menu item is visible
on its parent menu.
AVMenuItemNew Creates a new menu item.

AVMenuItemNewWithASText Creates and acquires a new AVMenuItem.

AVMenuItemRelease Releases a menu item.

AVMenuItemRemove Removes a menu item from the menu hierarchy


and releases it.
AVMenuItemSetComputeEnabledProc Sets the user-supplied procedure to call to
determine whether the menu item is enabled.
AVMenuItemSetComputeMarkedProc Sets the user-supplied procedure that
determines whether the menu item appears
with a check mark.
AVMenuItemSetComputeVisibleProc Sets the user-supplied procedure that deter-
mines whether the menu item appears when its
parent menu is opened.
AVMenuItemSetExecuteProc Sets the user-supplied procedure to execute
whenever the menu item is chosen.
AVMenuItemSetTitle Sets a menu item's title, which is the string that
appears in the user interface.

284 Acrobat and PDF Library API Overview


Acrobat Viewer (AV) Layer
6
AVPageView

AVMenuItemSetTitleWithASText Sets a menu item's title, which is the string that


appears in the user interface, from a constant
text object.

AVPageView
An AVPageView is the area of Acrobats window that displays the contents of a document
page. Every AVDoc has an AVPageView and vice versa. It contains references to the
PDDoc and PDFont objects for the document being displayed. Plug-ins can control the
size of the AVPageView through AVWindowSetFrame and
AVDocSetSplitterPosition.
AVPageView has methods to display a page, select a zoom factor, scroll the page
displayed inside, highlight one or more words, control screen redrawing, and traverse the
history stack that records where users have been in a document.
In continuous page modes when more than one page may be displayed, AVPageView
may not completely specify the view of the AVDoc. In these cases, your plug-in needs to
call AVPageViewSetPageNum to set the page number that it wants. For instance, if your
plug-in is getting an annotations bounding rectangle with
AVPageViewGetAnnotRect, it should call AVPageViewSetPageNum first, providing
the annotations page number. This ensures that your plug-in gets the AVRect on the page
upon which the annotation appears.
Additional AVPageView methods include:

AVPageViewAcquireMachinePort Acquires the platform-specific object


needed to draw into Acrobats docu-
ment window using a platform's
native graphics calls.
AVPageViewAnnotDidPerformOp Goes out when an annotation has
performed a focus operation
AVPageViewAppearanceGetAVMatrix Calculates a matrix for use with
AVPageViewDrawCosObj or
AVPageViewDrawCosObjEx
that leaves the appearance unro-
tated and un-zoomed as specified by
flags.
AVPageViewBeginOperation Increments an internal variable.

AVPageViewClearFocusAnnot Removes the focus from the


currently selected annotation.

Acrobat and PDF Library API Overview 285


Acrobat Viewer (AV) Layer
6
AVPageView

AVPageViewDevicePointToPage Transforms a points coordinates


from device space to user space.
AVPageViewDeviceRectToPage Transforms a rectangle from device
space to user space coordinates.
AVPageViewDeviceRectToPageRZ Transforms an annotation's rectan-
gle from device space to user space
coordinates, allowing for the annota-
tion's attributes of whether it should
zoom or rotate when the page is
zoomed or rotated.
AVPageViewDeviceToInfo Translates the given point from the
device space coordinate system to
the info space coordinate system.
AVPageViewDoPopupMenu Displays the given AVMenu as a
popup menu anchored at xHit and
yHit, which are in device coordi-
nates relative to pageView.
AVPageViewDragOutNewRect Allows the user to drag out a new
rectangle.
AVPageViewDragOutNewRectSnapped Drags out a rectangle anchored at
the given point.
AVPageViewDragRect Allows the user to move or resize a
rectangle.
AVPageViewDragRectSnapped Allows the user to move or resize a
rectangle.
AVPageViewDragRectSnappedEx Allows the user to move or resize an
existing rectangle.
AVPageViewDrawAnnotSequence Draws the annotation sequence
number of an annotation in a
rectangle.
AVPageViewDrawCosObj Draws the CosObj (which currently
must be a Form object) and scales it
to fit rect.
AVPageViewDrawCosObjEx Draws the CosObj (which currently
must be a Form object) and scales it
to fit rect.

286 Acrobat and PDF Library API Overview


Acrobat Viewer (AV) Layer
6
AVPageView

AVPageViewDrawNow Forces any pending updates for the


specified page view to finish
drawing.
AVPageViewDrawNowWithTransition Forces any pending updates for the
specified page view to finish draw-
ing, using the specified transition
effect.
AVPageViewDrawPolygon Draws a polygon, filled with the color
most recently set using
AVPageViewSetColor, or
inverted.
AVPageViewDrawPolygonOutline Draws a stroked (not filled) or
inverted polygon, using the color
most recently set using AVPageV-
iewSetColor.
AVPageViewDrawRect Draws a rectangle filled with the
color most recently set using
AVPageViewSetColor.
AVPageViewDrawRectOutline Draws a stroked, but not filled,
rectangle using the color most
recently set using
AVPageViewSetColor.
AVPageViewDrawRectOutlineWithHandles Draws the specified rectangle in the
page view with drag handles.
AVPageViewEndOperation Decrements an internal variable. Nei-
ther drawing nor AVPageViewD-
idChange notifications will occur
as long as the variable has a value
greater than zero.
AVPageViewFilterKeyDownForFocusAnnot Processes a keystroke through the
currently focused annotation.
AVPageViewFocusAnnotPerformOp Attempts to have the currently
focused annotation perform the
given operation.
AVPageViewGetActiveBead Gets the currently active article
thread bead in the specified page
view.

Acrobat and PDF Library API Overview 287


Acrobat Viewer (AV) Layer
6
AVPageView

AVPageViewGetAnnotRect Gets an annotation's bounding


rectangle.
AVPageViewGetAperture Gets the aperture of the specified
page view.
AVPageViewGetAVDoc Gets the AVDoc for the document
currently displayed in pageView.
AVPageViewGetAVWindow Gets the AVWindow associated with
this AVPageView.
AVPageViewGetColor Gets the color that will be used for
subsequent drawing by AVPageV-
iewDrawRect and AVPageView-
DrawRectOutline.
AVPageViewGetDevToPageMatrix Gets the matrix that transforms
device space coordinates to user
space coordinates for the specified
page view.
AVPageViewGetFirstVisiblePageNum Returns the page number of the first
page visible.
AVPageViewGetFocusAnnot Gets the currently focused
annotation from the page view.
AVPageViewGetGrayRect Gets the rectangle that bounds a
page view.
AVPageViewGetLastVisiblePageNum Returns the page number of the last
page that is visible on the screen.
AVPageViewGetLayoutMode Gets the page layout mode for a
page view.
AVPageViewGetMousePosition Gets the mouse position in
pageView.
AVPageViewGetMousePositionSnapped Gets the current mouse position
snapped to the layout grid.
AVPageViewGetNextView Used by page caching code to
determine the next page to cache
(and at what scale).
AVPageViewGetNumVisibleInks Gets the number of inks (color
separations) that are displayed for a
page view.

288 Acrobat and PDF Library API Overview


Acrobat Viewer (AV) Layer
6
AVPageView

AVPageViewGetPage Gets the PDPage for a page view.

AVPageViewGetPageNum Gets the current page number for


pageView.
AVPageViewGetPageToDevMatrix Gets the matrix that transforms user
space coordinates to device space
coordinates for the specified page
view.
AVPageViewGetPageToDevScaling Gets the point-to-pixel scaling factor
that transforms page units to device
space units for the specified page
view.
AVPageViewGetPixelInformationAtPoint Gets the color-separation ink
information for pixels at the cursor
position in the specified page view.
AVPageViewGetSelectedAnnotPageNum Returns the page number of the
currently selected annotation or -1
if no annotation is selected.
AVPageViewGetThreadIndex Gets the index of the currently active
thread in a page view.
AVPageViewGetVisibleAnnotPage Gets the number of a page
containing an annotation.
AVPageViewGetVisibleInks Gets the set of inks to be displayed in
a separations preview for a page
view.
AVPageViewGetWireframeDrawing Gets the wireframe mode for a page
view.
AVPageViewGetZoom Gets the current zoom for
pageView.
AVPageViewGetZoomType Gets the current zoom type.

AVPageViewGhostRectOutline Draws the specified rectangle in


pageView using the ghost outline.
AVPageViewGoBack Goes to the previous view on the
view stack, if a previous view exists.
AVPageViewGoForward Goes to the next view on the view
stack, if a next view exists.

Acrobat and PDF Library API Overview 289


Acrobat Viewer (AV) Layer
6
AVPageView

AVPageViewGoTo Goes to specified page, retaining the


current location on the page and the
current zoom (either explicit or a
variable).
AVPageViewHighlightText Inverts the given text selection on
the current page using the current
AVPageView color.
AVPageViewInfoToDevice Translates the given point from info
space to device space.
AVPageViewInfoToPoint Translates the given point from info
space to user space.
AVPageViewInsetRect Draws a 3-D looking inset rectangle
on the page view.
AVPageViewInvalidateRect Indicates that the specified area of
pageView is invalid and should be
redrawn.
AVPageViewInvalidateText Invalidates the bits that
AVPageViewHighlightText
touches.
AVPageViewInvertQuad Inverts the interior of a quad.

AVPageViewInvertRect Inverts the interior of a rectangle.

AVPageViewInvertRectOutline Inverts the specified rectangle's


outline.
AVPageViewIsAnnotAtPoint Tests whether the specified point is
within an annotation.
AVPageViewIsAnnotOfTypeAtPoint Determines if an annotation of the
specified type resides under the
given point.
AVPageViewIsBeadAtPoint Tests whether the specified point is
within a bead.
AVPageViewIsFocusAnnot Used to determine if annot currently
has focus.
AVPageViewPageNumIsVisible Determines if a given page number
is visible.
AVPageViewPointInText Tests if the given point is in the
PDTextSelect.

290 Acrobat and PDF Library API Overview


Acrobat Viewer (AV) Layer
6
AVPageView

AVPageViewPointToDevice Transforms a points coordinates


from user space to device space. See
Understanding Coordinate
Systems on page 30.
AVPageViewPointToInfo Translates the given point from user
space to info space.
AVPageViewReadPageDown Scrolls down through a document,
as if the user hit the Enter key.
AVPageViewReadPageUp Scrolls up through a document, as if
the user hit the Enter key.
AVPageViewRectToDevice Transforms a rectangle's coordinates
from user space to device space.
AVPageViewReleaseMachinePort Releases the platform-specific object
needed to draw into Acrobat's docu-
ment window using a platform's
native graphics calls.
AVPageViewResumeOffscreenDrawing Clients that correctly use machine
ports should work with the new off-
screen drawing behavior introduced
in Acrobat 5.
AVPageViewScrollTo Scrolls pageView to the location
specified by xOrigin and yOri-
gin, within the limits imposed by
the current zoom mode and Acrobat.
AVPageViewScrollToAnnot Scrolls the pageView to ensure that
the specified annot is visible.
AVPageViewScrollToRect Attempts to scroll the page view as
little as possible to make the
specified rectangle completely
visible.
AVPageViewSetAnnotLocation Sets an annotation's location,
specified in device space
coordinates.

Acrobat and PDF Library API Overview 291


Acrobat Viewer (AV) Layer
6
AVPageView

AVPageViewSetColor Sets the color that will be used for


subsequent drawing by AVPageV-
iewDrawRect and AVPageView-
DrawRectOutline.
AVPageViewSetFocusAnnot Attempts to set an annotation as the
active annotation.
AVPageViewSetInkPreview Sets or clears the ink preview value
for a page view, which allows you to
disable the rendering of individual
inks.
AVPageViewSetLayoutMode Sets the layout mode for a page
view.
AVPageViewSetPageNum Sets the current logical page of the
page view, which might not be the
same as the current number indi-
cated on the screen.
AVPageViewSetVisibleInks Sets the set of inks to be displayed in
a separations preview for a page
view.
AVPageViewSetWireframeDrawing Sets the wireframe mode for a page
view.
AVPageViewShowControl Shows or hides the controls in the
status area at the bottom of a page
view.
AVPageViewSnapPoint Snaps a point to the layout grid if the
avpSnapToGrid preference is set.
AVPageViewSnapPointEx Snaps a point to the layout grid if the
avpSnapToGrid preference is set,
using page-space coordinates.
AVPageViewSnapRect Given a starting point, ending point,
and starting rectangle, return a
resulting rectangle which is snapped
to the grid.
AVPageViewStartReadingThread Puts the specified page view into
article thread-reading mode.

292 Acrobat and PDF Library API Overview


Acrobat Viewer (AV) Layer
6
AVSweetPea

AVPageViewSuspendOffscreenDrawing Clients that correctly use machine


ports should work with the new off-
screen drawing behavior introduced
in Acrobat 5.0.
AVPageViewToDestInfo Creates a destination info object
from a given AVPageView and
fitType.
AVPageViewToViewDest Builds a PDViewDestination
from the current zoom and position.
AVPageViewTrackText Called in response to a mouse click
to track a text selection on the
screen.
AVPageViewTransformRectRZ Calculates where an annotation is
drawn with no zoom or no rotation,
as specified by the annotation flags.
AVPageViewUpdateInfoPanel Allow clients to control the Info
panel output.
AVPageViewUseDestInfo Causes the given page view to
change to the view given by an
AVDestInfo object.
AVPageViewUseThisDestination Causes the given page view to
change to the view given by
viewDest and sourceZoom.
AVPageViewWasCreated Sets the zoom factor and zoom type
for the specified page view.
AVPageViewZoomTo Sets the zoom factor.

AVSweetPea
The AVSweetPea methods are used to implement the Adobe Dialog Manager (ADM), a
cross-platform API for creating and managing dialogs by Adobe applications. For details on
how to use ADM for Acrobat dialogs, see ADM Programmers Guide and Reference. The
AVSweetPea methods include:

AVSweetPeaGetBasicSuiteP Accesses the basic ADM suite.

AVSweetPeaGetPluginRef Gets a reference to the ADM plug-in itself (not the


plug-in you are currently developing).

Acrobat and PDF Library API Overview 293


Acrobat Viewer (AV) Layer
6
AVSys

AVSweetPeaGetResourceAccess Used to implement the Adobe Dialog Manager


(ADM).
AVSweetPeaIsADMAvailable Determines whether ADM is available.

AVSweetPeaProcessADMEvent Used to implement the Adobe Dialog Manager


(ADM).
AVSweetPeaSetResourceAccess Used to implement the Adobe Dialog Manager
(ADM).

AVSys
AVSys provides various system-wide utilities, including setting the cursor shape, getting
the current cursor, and beeping. Methods include:

AVSysAllocTimeStringFromTimeRec Gets a string representing the date and


time.
AVSysBeep Beeps.

AVSysGetCursor Gets the current cursor.

AVSysGetIconFromFilename Gets an icon of the specified type from


the specified file.
AVSysGetIconFromMimeType Gets an icon of the specified type from
the specified Mime type.
AVSysGetIconFromTypeAndCreator Gets an icon of the specified type from
the specified type and creator (for Mac
OS).
AVSysGetModifiers Gets a flag indicating which modifier
keys are currently being pressed.
AVSysGetStandardCursor Gets the specified cursor.

AVSysGetUsePenForInput Gets the value of the


UsePenForInput user-preference
attribute.
AVSysMouseIsStillDown Tests whether the mouse button is still
being pressed.
AVSysSetCursor Sets the cursor to the specified
AVCursor. See Predefined
Cursors.

294 Acrobat and PDF Library API Overview


Acrobat Viewer (AV) Layer
6
AVTool

AVSysSetWaitCursor Turns the wait cursor on or off.

AVTool
An AVTool is an object that can handle key presses and mouse clicks in the content region
of an AVPageView. Tools do not handle mouse clicks in other parts of Acrobats window,
such as in the bookmark pane. At any time, there is one active tool, which a plug-in can set
using AVAppSetActiveTool.
Tools are often, but not always, set from toolbar buttons (see AVToolButton on page 296).
Some buttons, such as Zoom, set an active tool; in this case, setting the active tool to one
that drags out a rectangle, or adjusts Acrobats zoom level in response to user actions.
Other buttons, such as the one that displays thumbnail images, do not change the active
tool.
Use AVAppRegisterTool to add a new tool to Acrobat.
Additional AVTool methods include:

AVToolGetType Gets a tools type.

AVToolIsPersistent Indicates whether a tool is persistent or is one shot.

AVToolBar
AVToolBar is Acrobats toolbar (the palette of buttons). In Acrobat 4.0 and later, a plug-in
can create flyouts that contain additional buttons and attach these flyouts to existing
buttons.
Plug-ins can add buttons to and remove buttons from a toolbar, show or hide toolbars, and
(Acrobat 5.0) create new toolbars. Because screen space is limited on many monitors, plug-
ins should add as few buttons as possible to toolbars.
Buttons can be organized into groups of related buttons, with additional space between
the groups. It is possible to implement a group in which only one button can be selected at
a time. The logic of doing this is the plug-ins responsibility; the plug-in API does not
provide any means to automatically relate one buttons state to another buttons state.
A plug-in adds buttons to a toolbar by specifying the relative position of the button (before
or after) to an existing button.
Although there appear to be multiple toolbars in the Acrobat 4.0 and higher user interface,
there is still only one AVToolBar containing all the buttons that are not on flyouts. A plug-

Acrobat and PDF Library API Overview 295


Acrobat Viewer (AV) Layer
6
AVToolButton

in controls the toolbar upon which a button will appear by placing the button next to an
existing one already in the appropriate location. The AVToolBar methods include:

AVToolBarAddButton Adds a button to the toolbar.

AVToolBarEnumButtons Calls enumProc once for each toolbar button in


the specified toolbar.
AVToolBarGetButtonByName Gets the button that has the specified name.

AVToolBarGetNumButtons Gets the number of buttons in toolbar.

AVToolBarIsRoomFor Tests whether there is room in a toolbar for an


additional specified number of buttons and
separators.
AVToolBarNew Creates a new named toolbar.

AVToolBarNewFlyout Creates a new sub-toolbar for use as a tool button


flyout.
AVToolBarUpdateButtonStates Forces a redraw of the toolbar.

AVToolButton
An AVToolButton is a button in the Acrobat viewers toolbar. Like menu items, the
procedure that executes when the button is clicked can be set by a plug-in. Although not
required, there generally is a menu item corresponding to each button, allowing users to
select a function using either the button or the menu item.
A plug-in can invoke a button as if a user clicked it. Buttons can be enabled (selectable) or
disabled (grayed out), and can be marked (selected). Each button also has an icon that
appears in the toolbar. AVToolButtons frequently, but not always, change the active tool
(see AVTool on page 295). For example, the button that selects the link tool changes the
active tool; whereas, the button that goes to the last page of a document does not.
Normally, all tools are persistent and remain selected indefinitely. The Option key
(Macintosh platform) or Control key (Windows) can be used to select a tool for one-shot
use. Plug-ins should follow this convention to add buttons.
Separators between groups of buttons are themselves buttons, although they are neither
selectable nor executable. Because they are buttons, however, they do have names,
allowing other buttons to be positioned relative to them.
Plug-ins are encouraged to position their tool buttons relative to separators. Doing this
increases the likelihood that tool buttons will be correctly placed if future versions of
Acrobat move groups of toolbuttons around.

296 Acrobat and PDF Library API Overview


Acrobat Viewer (AV) Layer
6
AVToolButton

Acrobat 4.0 and higher cleans up separators. It ensures that separators don't appear back-
to-back or at the beginning or end of the toolbar. Plug-ins can be liberal with separators in
Acrobat 4.0 and higher versions.
You are strongly encouraged to begin your language-independent button names with the
plug-in name (separated by a colon) to avoid name collisions when more than one plug-in
is present. For example, if my plug-in is named myPlug, it might add a button whose name
is myPlug:LastFile. For more information on plug-in naming, see the Acrobat SDK
Plug-in Guide.
The AVToolButton methods include:

AVToolButtonAddAnimationIcon Adds the specified AVIcon to the


AVToolbuttons animation list.
AVToolButtonDestroy Removes the specified button from the
toolbar and destroys the button.
AVToolButtonExecute Executes a buttons action by invoking the
AVExcecuteProc callback.
AVToolButtonGetAnimationIconCount Returns the count of animation icons
associated with this toolbutton.
AVToolButtonGetAnimationPeriod Gets the period in seconds of how often to
flip the toolbutton animation icons.
AVToolButtonGetFlyout Gets the flyout attached to a toolbar button.

AVToolButtonGetIcon Gets the icon associated with the specified


AVToolButton.
AVToolButtonGetLabelText Gets the label text associated with the
specified AVToolButton and its priority
value.
AVToolButtonGetMenu Gets the menu attached to a toolbar
button.
AVToolButtonGetName Gets the name of a button.

AVToolButtonIsAnimationRunning Indicates whether the toolbutton animation


list is flipping or not.
AVToolButtonIsEnabled Tests whether a toolbar button is enabled.

AVToolButtonIsMarked Tests whether the specified button is


marked.
AVToolButtonIsSeparator Tests whether a toolbar button is a
separator or a normal button.
AVToolButtonNew Creates a new button.

Acrobat and PDF Library API Overview 297


Acrobat Viewer (AV) Layer
6
AVUndo

AVToolButtonRemove Removes (but does not destroy) a button


from the toolbar.
AVToolButtonRemoveAnimationIcons Removes all icons from toolbutton
animation list.
AVToolButtonSetAnimationPeriod Sets the period in seconds of how often to
flip the tool button animation icons.
AVToolButtonSetComputeEnabledProc Sets the AVComputeEnabledProc
associated with a toolbar button.
AVToolButtonSetComputeMarkedProc Sets the AVComputeMarkedProc
associated with a toolbar button.
AVToolButtonSetComputeTooltipProc Sets the AVComputeTooltipProc
associated with a toolbar button.
AVToolButtonSetComputeVisibleProc Sets the AVComputeVisibleProc
associated with a toolbar button.
AVToolButtonSetExecuteProc Sets the user-supplied procedure to call to
actually do whatever the button does.
AVToolButtonSetFlyout Attaches a sub-toolbar to a tool button.

AVToolButtonSetHelpText Sets the text to show in tooltips.

AVToolButtonSetIcon Sets a new icon for a toolbar button.

AVToolButtonSetLabelText Sets the label text associated with the


specified AVToolButton and its priority
value.
AVToolButtonSetMenu Attaches a menu to a toolbar button.

AVToolButtonStartAnimation Sets the AVNotifyTooltipProc


associated with a toolbar button.
AVToolButtonStopAnimation Starts flipping icons for specified button.

AVUndo
The AVUndo object represents an undo record for a document. An undo record allows a
client to associate private data with a particular AVDoc for the purpose of undoing and
redoing changes to the document. The client provides private data that encapsulates the
changes, and an AVUndoHandler that contains callbacks which interpret the data when
Undo and Redo commands are issued.

298 Acrobat and PDF Library API Overview


Acrobat Viewer (AV) Layer
6
AVWindow

The AVUndo object itself has an AVUndoNew method, and methods for getting and
setting properties, such as AVUndoGetData and AVUndoSetData. However, you
initiate and control an undo or redo operation from the document (which you can obtain
with AVUndoGetAVDoc), using methods such as AVDocBeginUndoOperation,
AVDocEndUndoOperation, and AVDocClearUndos.
The AVUndo methods include:

AVUndoGetAVDoc Gets the document whose undo list contains the undo
record.
AVUndoGetData Gets the client-defined private data for the undo record, as
specified on creation.
AVUndoGetType Gets the type of the undo record, as specified in the
AVUndoHandler.
AVUndoNew Creates a new AVUndo record for a document's undo list.

AVUndoSetData Sets or replaces the client-defined private data for the


undo record.

AVWindow
AVWindow provides methods for creating and managing windows. Plug-ins should use
AVWindow methods for their own dialogs, floating palettes, and so forth, to ensure that
those windows work well with Acrobat; for example, that under Windows, they are hidden
when Acrobat is iconified. Once the plug-in creates an AVWindow, it is free to use platform-
dependent code to put whatever it wants in the window.
Acrobat uses the concept of a key window. The key window is the window that receives
keyboard events. Only one window is the key window at any time. Windows can request to
become the key window, or request that they no longer be the key window.
On the Macintosh platform, there is an essential distinction between a key window and an
active window. A window is a key window if and only if it is the target of all keystrokes and
menu selections. A window is the active window if mouse clicks in it are interpreted
without requiring an initial activation click. This state is usually indicated (in modal and
non-floating windows) with some highlighting in the title bar. Floating windows are
inactive only if hidden.
NOTE: Plug-ins on the Macintosh platform should always use the core API methods to
zoom, resize, or move windows. They should never use the toolbox routines
(ZoomWindow, SizeWindow, GrowWindow, MoveWindow, and so forth) directly
on AVWindows.

In addition, Acrobat reserves the WRefCon field in the WindowRecord structure

Acrobat and PDF Library API Overview 299


Acrobat Viewer (AV) Layer
6
AVWindow

for internal purposes. To attach client data to an AVWindow, a plug-in should use
AVWindowGetOwnerData or AVWindowSetOwnerData.
The AVWindow methods include:

AVWindowBecomeKey Makes a window the key window (regardless


of the setting of its WantsKey flag) if the
window is visible.
AVWindowBringToFront Brings the specified window to the front.

AVWindowCenter Centers the window within its parent window


or the desktop if it has no parent.
AVWindowDestroy Centers the window within its parent window
or the desktop if it has no parent.
AVWindowDoModal Makes the specified window modal, so that no
other window can take the keyboard focus
when this window is active.
AVWindowDrawNow Updates a window.

AVWindowEndModal Stops the specified window from being modal,


so that other windows can take the keyboard
focus when this window is active.
AVWindowEnsureInBounds If the window is completely outside the desk-
top region (that is, off-screen), it is moved so
that it will be within the desktop region (that
is, on-screen).
AVWindowGetBorderWidths Fills a rectangle structure with the left, top,
right, and bottom distances between inner
window rectangle (the frame rectangle) and
outer window rectangle.
AVWindowGetCursorAtPoint Queries the AVWindow for the appropriate
cursor for display at the given point (in the
AVWindows device coordinate space).
AVWindowGetDesktopBounds Gets the desktop boundary for the monitor on
which the window would appear if its frame
was set to the specified frame.
AVWindowGetFrame Gets the windows frame, which specifies its
size and location on the screen.

300 Acrobat and PDF Library API Overview


Acrobat Viewer (AV) Layer
6
AVWindow

AVWindowGetInterior Gets the interior rectangle of the window.

AVWindowGetMinMaxSize Gets the minimum and maximum size of the


window.
AVWindowGetOwnerData Gets a windows owner data.

AVWindowGetPlatformThing Returns a pointer to the platform-specific


thing associated with the window.
AVWindowGetTitle Gets the title to display in the specified
window's title bar.
AVWindowHandlePlatformEvent Handles a platform-specific event.

AVWindowHide Hides a window.

AVWindowInvalidateRect Invalidates the specified rectangular region,


for eventual redraw.
AVWindowIsKey Tests whether the specified window is the key
window.
AVWindowIsVisible Tests whether a window is displayed on the
screen.
AVWindowMaximize Maximizes the specified window.

AVWindowNew Creates a new window.

AVWindowNewFromPlatformThing Creates a new window from a platform-native


window pointer or handle.
AVWindowResignKey Use this method when you want win to resign
its key window status.
AVWindowSetFrame Sets the windows frame, which specifies its
size and location on the screen.
AVWindowSetMinMaxSize Sets the minimum and maximum size of the
window.
AVWindowSetOwnerData Sets a window's owner data.

AVWindowSetTitle Sets the title to display in the specified


window's title bar.
AVWindowSetWantsKey Sets or clears a flag indicating that win wants
to become the key window.
AVWindowShow Shows the specified window.

AVWindowUserClose Simulates a user's click on a windows box.

Acrobat and PDF Library API Overview 301


Acrobat Viewer (AV) Layer
6
AVWindow

302 Acrobat and PDF Library API Overview


7 Portable Document (PD) Layer

The Portable Document (PD) layer of the core API (also called PDModel) is a collection of
object methods enabling plug-ins to access and manipulate most data in a PDF file.
Figure 7.1 shows the objects in the PD layer.

FIGURE 7.1 PD Layer Objects

PDAction PDBookmark PDDoc PDTextSelect

PDFileSpec PDViewDest PDPage PDThread PDWordFinder PDFont

PDAnnot PDTrans PDGraphic PDBead PDWord PDCharProc

PDLinkAnnot PDTextAnnot PDXObject PDPath PDText PDStyle

PDImage PDForm

PDInlineImage

NOTE: Because of its close association to the AVDoc selection mechanism, the
PDTextSelect object is shown in Figure 6.1, Acrobat Viewer Objects.
NOTE: New objects added in Acrobat 6.0 that implement optional content (layers) are not
shown. These include:
PDOCConfig
PDOCContext
PDOCG
PDOCMD
Because many PD layer objects are based on PDF objects, its important to understand PDF
file structure. See the PDF Reference for details on PDF files.

Acrobat and PDF Library API Overview 303


Portable Document (PD) Layer
7
General PD Layer Methods

PD layer methods perform the bookeeping that ensures any file written is a valid PDF file. In
addition, they take care of navigating much of the PDF file structure, such as traversing the
pages tree to get a specific page.
If you need lower-level access to the data in a PDF file, use Cos layer methods
(seeChapter 10, Cos Layer). To control the Acrobat application itself, use AV layer methods
(see Chapter 6, Acrobat Viewer (AV) Layer). To modify page contents, such as text, use
PDFEdit methods, described in Chapter 8, PDFEdit LayerCreating and Editing Page
Content.
The following sections describe each PD layer object and provide an overview of each
objects methods. See the Acrobat and PDF Library API Reference for complete detailed
descriptions of the methods.

General PD Layer Methods


Some methods are general PD layer methods that are not associated with a specific object.
They include:

PDEnumDocs Enumerates the currently open PDDocs.

PDGetHostEncoding Indicates whether a system is Roman or CJK-capable,


that is, capable of handling multibyte character sets,
such as Chinese, Japanese, or Korean..
PDGetPDFDocEncoding Gets a list describing the differences between host
encoding and a predefined encoding
PDFDocEncoding. See Appendix D of the PDF
Reference for a description of PDFDocEncoding.
PDXlateToHostEx Translates a string from PDFDocEncoding to host
encoding, allowing for multibyte characters.
PDXlateToPDFDocEncEx Translates a string from host encoding to
PDFDocEncoding or Unicode.

For a complete listing, see General PD functions in the Acrobat and PDF Library API
Reference.

Metadata
Metadata is information that describes document content or use. The PDF file format has
always provided the Info dictionary, which contains metadata that applies to an entire
document, with nine standard properties defined (including creation and modification
date, title, and author).

304 Acrobat and PDF Library API Overview


Portable Document (PD) Layer
7
Metadata

New Metadata Features in PDF 1.4


PDF 1.4 introduced an enhanced way of representing metadata. It has the following
features:
In addition to document-level metadata, there can be metadata describing individual
components of a PDF document, such as pages or images.
Metadata properties and values are represented in the World Wide Web Consortiums
Resource Definition Format (RDF), which is a standard metadata format based on XML.
The set of standard metadata items is organized into schemas, each of which represents
a set of properties from a particular applicaiton or industry standard. The schemas, as
well as the physical representation, are defined by Adobes Extensible Metadata
Platform (XMP) (formerly referred to as XAP).
See Section 10.2 in the PDF Reference for details about the use of metadata in PDF 1.4 and
later.

Metadata APIs in Acrobat 5.0


Acrobat 5.0 provided a set of methods for accessing metadata. They are summarized here
(note that there are PDFEdit and Cos layer calls in addition to PD layer methds):

PDDocGetXAPMetadata Gets the metadata of a document and


returns it as a newly allocated ASText
object.
PDDocSetXAPMetadata Sets the metadata of a document.

PDEContainerGetXAPMetadata Gets the metadata associated with a


document element
PDEContainerSetXAPMetadata Sets the metadata for a document
element
PDDocCalculateImplicitMetadata Broadcasts a notification to request that
plug-ins calculate and set implicit
metadata items. Implicit metadata is
metadata which depends on the state of
a document and must be calculated,
rather than being stored explicitly.
CosDictGetXAPMetadata Gets the metadata associated with a
dictionary or stream Cos object.
CosDictSetXAPMetadata Sets the metadata for a dictionary or
stream Cos object.

The Acrobat SDK contains several samples dealing with metadata. See the Guide to SDK
Samples for information.

Acrobat and PDF Library API Overview 305


Portable Document (PD) Layer
7
PDAction

PDAction
Actions are tasks that Acrobat performs when a user clicks on a link or a bookmark. Acrobat
allows a document to execute an action automatically when a document is opened.
Action types include
Going to another view within the same document
Going to a specified view in another PDF file
Launching an arbitrary file
Playing a sound
Resolving a URL
See Section 8.5 in the PDF Reference for more information on actions.
You can add custom action types to your plug-in by creating new action handlers (see
Action Handlers on page 430) that are responsible for interpreting an actions data and
carrying out the action. PDAction methods include:

PDActionCanCopy Tests whether the data from an action object can


be copied to a clipboard for pasting.
PDActionCanPaste Tests whether data from an action object that has
been copied to a clipboard can be pasted into a
destination document.
PDActionCopy Copies action object data to a clipboard structure,
from which it can be pasted.
PDActionDestroy Destroys an action object.

PDActionDestroyClipboardData Destroys data that has been copied from an action


object into a clipboard.
PDActionEqual Compares two actions for equality.

PDActionFromCosObj Converts a dictionary Cos object to an action and


verifies that the action is valid.
PDActionGetCosObj Gets the Cos object corresponding to an action.

PDActionGetDest Gets an actions destination view.

PDActionGetFileSpec Gets a file specification from an action.

PDActionGetSubtype Gets an actions subtype.

PDActionIsValid Tests whether an action is valid.

PDActionNew Creates a new action.

306 Acrobat and PDF Library API Overview


Portable Document (PD) Layer
7
PDAnnot

PDActionNewFromDest Creates a new action that takes the user to the


specified destination view.
PDActionNewFromFileSpec Creates an action of the specified type from a file
specification.
PDActionPaste Creates a new PDAction in the destination
document, using clipboard data generated by
PDActionCopy.

PDAnnot
This is the abstract superclass for all annotations (see Section 8.4, Annotations, in the PDF
Reference). Acrobat has two built-in annotation classes: PDTextAnnot and
PDLinkAnnot. Plug-ins add movie, Widget (form field), and other annotation types. You
can define new annotation subtypes by creating new annotation handlers (see Annotation
Handlers on page 430). There are no objects of type PDAnnot, but you-in can use
PDAnnot methods on any subclass of PDAnnot.
The Acrobat SDK provides three useful macros to cast among PDAnnot and its text
annotation and link annotation subclasses (see PDExpT.h). These are:
CastToPDAnnot
CastToPDTextAnnot
CastToPDLinkAnnot
The PDAnnot methods include:

PDAnnotCanCopy Tests whether the data from an annotation on a


given page can be copied to a clipboard for
pasting.
PDAnnotCanPaste Tests whether data from an annotation that has
been copied to a clipboard can be pasted to a
location on a page.
PDAnnotCopy Tests whether data from an annotation that has
been copied to a clipboard can be pasted to a
location on a page.
PDAnnotDestroyClipboardData Destroys data that has been copied from an
annotation object into a clipboard.
PDAnnotEqual Tests whether two annotations are identical.

Acrobat and PDF Library API Overview 307


Portable Document (PD) Layer
7
PDAnnot

PDAnnotFromCosObj Converts a dictionary Cos object to an


annotation.
PDAnnotGetColor Gets a note or link annotations color.

PDAnnotGetCosObj Gets the Cos object corresponding to an


annotation.
PDAnnotGetDate Gets an annotations date.

PDAnnotGetFlags Gets an annotations flags.

PDAnnotGetOCMD Gets an optional-content membership


dictionary (OCMD) object associated with the
annotation.
PDAnnotGetRect Gets an annotations size and location.

PDAnnotGetSubtype Gets an annotations subtype.

PDAnnotGetTitle Gets an annotation's label text.

PDAnnotIsCurrentlyVisible Tests whether an annotation with an OC entry is


visible in a given optional-content context.
PDAnnotIsValid Tests whether an annotation is valid.

PDAnnotNotifyDidChange Broadcasts a PDAnnotDidChange


notification.
PDAnnotNotifyWillChange Broadcasts a PDAnnotWillChange
notification.
PDAnnotPaste Pastes copied annotation data from a clipboard
structure to a new annotation object in a speci-
fied document.
PDAnnotRemoveOCMD Dissociates any optional-content membership
dictionary (OCMD) object from the annotation.
PDAnnotSetColor Sets a note or link annotation's color.

PDAnnotSetDate Sets an annotation's date.

PDAnnotSetFlags Sets an annotation's flags.

PDAnnotSetOCMD Associates an optional-content membership dic-


tionary (OCMD) object with the annotation,
making it optionally visible according to the
OCMD's visibility policy.

308 Acrobat and PDF Library API Overview


Portable Document (PD) Layer
7
PDBead

PDAnnotSetRect Sets the size and location of an annotation on its


page.
PDAnnotSetTitle Sets an annotations label text.

PDBead
A bead is a single rectangle in an article thread. An article thread represents a sequence of
physically discontiguous but logically related items in a document (for example, a news
story that starts on one page of a newsletter and runs onto one or more nonconsecutive
pages). See Section 8.3.2, Articles, in the PDF Reference for more information on article
threads and beads.
A bead remains valid as long as a thread is current and active. When traversing the beads
in a thread using PDBeadAcquirePage or PDBeadGetPrev, you can use
PDBeadEqual to determine the wraparound point (end of the list).
Additional PDBead methods include:

PDBeadAcquirePage Acquires the page on which a bead is located.

PDBeadDestroy Destroys a bead.

PDBeadEqual Tests two beads for equality.

PDBeadFromCosObj Gets the PDBead corresponding to a Cos object,


after checking the beads validity.
PDBeadGetCosObj Gets the Cos object corresponding to a bead.

PDBeadGetIndex Gets the index of a bead in its thread.

PDBeadGetNext Gets the next bead in a thread.

PDBeadGetPrev Gets the previous bead in a thread.

PDBeadGetRect Gets a beads bounding rectangle.

PDBeadGetThread Gets the thread containing the specified bead.

PDBeadInsert Inserts a bead after the specified bead.

PDBeadIsValid Tests a beads validity.

PDBeadNew Creates a new bead on the specified page.

PDBeadSetPage Sets the page for a bead.

PDBeadSetRect Sets a beads bounding rectangle.

Acrobat and PDF Library API Overview 309


Portable Document (PD) Layer
7
PDBookmark

PDBookmark
A bookmark corresponds to an outline object in a PDF document (see Section 8.2.2,
Document Outline, in the PDF Reference). A document outline allows the user to navigate
interactively from one part of the document to another. An outline consists of a tree-
structured hierarchy of bookmarks, which display the documents structure to the user.
Each bookmark has:
A title that appears on screen
An action that specifies what happens when the user clicks on the bookmark
Bookmarks can either be created interactively by the user through Acrobats user interface
or can be generated programmatically. The typical action for a user-created bookmark is to
move to another location in the current document, although any action (see PDAction on
page 306) can be specified.
Each bookmark in the bookmark tree structure has zero or more children that appear
indented on screen, and zero or more siblings that appear at the same indentation level. All
bookmarks except the bookmark at the top level of the hierarchy have one parent, the
bookmark under which it is indented. A bookmark is said to be open if its children are
visible on screen, and closed if they are not.
A plug-in can get or set:
The open attribute of a bookmark
The text used for the bookmarks title
The action that is invoked when the bookmark is selected
PDBookmark methods include:

PDBookmarkAddChild Adds a bookmark as the last child of parent,


adjusting the tree containing parent
appropriately.
PDBookmarkAddNewChild Adds a new child to a bookmark.

PDBookmarkAddNewSibling Adds a new sibling to a bookmark.

PDBookmarkFromCosObj Converts an appropriate Cos object to a


bookmark.
PDBookmarkGetAction Gets a bookmarks action.

PDBookmarkGetCosObj Gets the Cos object associated with a bookmark

PDBookmarkGetParent Gets a bookmarks parent bookmark.

PDBookmarkSetOpen Opens or closes a bookmark.

PDBookmarkSetTitle Sets a bookmarks title.

310 Acrobat and PDF Library API Overview


Portable Document (PD) Layer
7
PDBookmark

PDBookmarkAddNext Adds newNext as the new right sibling to


aBookmark.
PDBookmarkAddPrev Adds newPrev as the new left sibling to aBook-
mark, adjusting the tree containing aBookmark
appropriately.
PDBookmarkAddSubtree Adds a copy of the bookmark sub-tree source to
aBookmark, as a new last child of aBookmark.
PDBookmarkDestroy Destroys a bookmark and all of its children.

PDBookmarkEqual Tests whether two bookmarks are equal.

PDBookmarkFromCosObj Converts a Cos dictionary object to a bookmark


and checks the validity of the bookmark.
PDBookmarkGetAction Gets a bookmarks action.

PDBookmarkGetByTitle Gets the first bookmark whose title is aName.

PDBookmarkGetColor Retrieves the color of the specified bookmark.

PDBookmarkGetCosObj Gets the Cos object for a bookmark.

PDBookmarkGetCount Gets the number of open bookmarks in a subtree.

PDBookmarkGetFirstChild Gets a bookmarks first child.

PDBookmarkGetFlags Retrieves the flags of the specified bookmark.

PDBookmarkGetIndent Returns the indentation level of a bookmark in its


containing tree.
PDBookmarkGetLastChild Gets a bookmark's last child.

PDBookmarkGetNext Gets bookmarks next (right) sibling.

PDBookmarkGetParent Gets a bookmarks parent bookmark.

PDBookmarkGetPrev Returns bookmarks previous (left) sibling.

PDBookmarkGetTitle Gets a bookmarks title.

PDBookmarkHasChildren Tests whether a bookmark has children.

PDBookmarkIsOpen Tests whether a bookmark is open.

PDBookmarkIsValid Tests whether a bookmark is valid.

PDBookmarkRemoveAction Removes a bookmarks action.

PDBookmarkSetAction Sets a bookmarks action.

Acrobat and PDF Library API Overview 311


Portable Document (PD) Layer
7
PDCharProc

PDBookmarkSetColor Sets the color of the specified bookmark.

PDBookmarkSetFlags Sets the flags of the specified bookmark.

PDBookmarkSetOpen Opens or closes a bookmark.

PDBookmarkSetTitle Sets a bookmarks title.

PDBookmarkUnlink Unlinks a bookmark from the bookmark tree that


contains it, and adjusts the tree appropriately.

PDCharProc
A PDCharProc is a character procedure, a stream of graphic operators (see PDGraphic
on page 327) that draw a particular glyph of a Type 3 PostScript font.
A glyph is the visual representation of a character, part of a character, or even multiple
characters. For example, a glyph can be a picture of the letter A, or it can be an accent mark,
such as grave (`), or it can be a picture of multiple characters such as the ligature fl, which
represents the letters f and l. Glyphs can also be used to represent arbitrary symbols, such
as in the font ITC Zapf Dingbats. Every glyph has a name in a Type 1, multiple master Type
1, or Type 3 font. In most TrueType fonts, glyphs are assigned names. In some TrueType
fonts, the glyph names are implicit.
For information on Type 3 fonts, see Section 5.5.4 in the PDF Reference.
To determine the sequence of graphics operations used to draw one or more glyphs in a
Type 3 font, use PDFontEnumCharProcs to enumerate the glyphs in the font. Then use
PDCharProcEnum to enumerate the graphic operators in each glyph of interest.
PDCharProc methods include:

PDCharProcEnum Enumerates the graphic description of a single


character procedure for a Type 3 font.
PDCharProcEnumWithParams Enumerates the graphic description of a single
character procedure for a Type 3 font, for those
contents that are visible in a given optional-con-
tent context.
PDCharProcGetCosObj Get the stream Cos object associated with the
PDCharProc.

312 Acrobat and PDF Library API Overview


Portable Document (PD) Layer
7
PDDoc

PDDoc
A PDDoc object represents a PDF document. There is a correspondence between a PDDoc
and an ASFile. Also, every AVDoc has an associated PDDoc, although a PDDoc may not
be associated with an AVDoc.
NOTE: An ASFile may have zero or more underlying files, so a PDF file does not always
correspond to a single disk file. For example, an ASFile may provide access to PDF
data in a database.
A plug-in may create a new document or open a document using an ASFileSys and an
ASPlatformPath. These frequently provide access to disk files, but could also provide
access to PDF files by other methods, such as via a modem line. Because PD layer objects do
not have a concept of an active document, or even of a user, getting the PDDoc of a
document opened by the user requires calls to AV layer objects (see Chapter 6, Acrobat
Viewer (AV) Layer).
Each PDF document contains, among other things:
A tree of pages (PDPage)
(Optionally) trees of bookmarks and articles
(Optionally) information and security dictionaries
These objects correspond to CosObj objects in the catalog of a CosDoc (see Chapter 10,
Cos Layer). However, they also have PD layer equivalents which are accessible directly
through PDDoc methods. Other objects in the catalog of a PDF file may require Cos
methods to access.
When you merge a PDF file containing form fields that have appearances, those
appearances and forms data are merged along with all the other page contents. If you
merge a file that has forms data into another file that has forms data, name conflicts are
resolved (in the same way the Acrobat Forms plug-in resolves these conflicts).
NOTE: For PDF files with forms data, when inserting pages from another file using
PDDocInsertPages, do not use the PDInsertAll flag. Using this flag wipes
out the previous forms data and replaces it with the information from the file being
inserted.

Querying PDDoc Permissions


With Acrobat 5.0 and higher, plug-ins can query the permissions on a PDDoc to a finer
granularity than in previous Acrobat releases. Plug-ins can query specific PDDoc objects
and for specific operations authorized to be performed on those objects. At the PDDoc
level, for example, plug-ins can query whether printing the document is fully allowed,
allowed only at a low resolution, or not allowed under any circumstances. A plug-in can
request the applicable operations authorized for any the following objects:
Document
Page

Acrobat and PDF Library API Overview 313


Portable Document (PD) Layer
7
PDDoc

Link
Bookmark
Thumbnail
Annotation
Form
Signature
To obtain the permissions, a plug-in can call the PDDocPermRequest method (which
replaces PDDocGetPermissions used with earlier Acrobat versions). The plug in can
request, for example, whether a particular operation can be performed on a particular
object (from the list above) for a specified PDDoc. The plug-in may, for example, request
whether permissions allow a rotating operation on a page object in the PDDoc.
For a list of all the operations (PDPermReqOprs) that each object (PDPermReqObj)
supports (and a plug-in can request using PDDocPermRequest), see the
PDPermReqOpr and PDPermReqObj enumerations in the Acrobat and PDF Library API
Reference.
New callbacks have been added to the security handler structure PDCryptHandler to
support the finer granularity of permissions that plug-ins can query.

Enumeration With PDDoc Objects


The core API provides several methods that enumerate all objects of a particular type. This
can be useful, either because there is no way to access the objects (such as PDPaths)
directly, or for convenience (such as using PDDocEnumFonts to enumerate all fonts used
in a document).
The methods can be especially useful with PDDoc objects. When these methods are called,
Acrobat enumerates the specified objects, and calls a plug-in-specified callback procedure
for each object of that type. For example, when PDDocEnumFonts is called, Acrobat
enumerates all fonts used in the document, calling a procedure provided for each font it
finds. Enumeration is complete after the enumeration method returns.
Your plug-in can call an enumeration method and create an array of found elements to be
used later. Alternately, your plug-in can search for a particular item and, upon finding the
item, stop the enumeration and immediately return. Using enumeration methods, your
plug-in can find any toolbar or menu item, or any number of elements on a page.
Enumeration methods may take a monitor as a parameter. A monitor is a C structure that
contains pointers to one or more plug-in-supplied callback procedures. The API calls one or
more of the functions defined in the monitor for each object in a list. One method that uses
a monitor is PDPathEnum, which provides a set of callbacks for each path object in a
pages display list (list of marking operations that represent the displayed portion of a page).
This allows a plug-in to be aware of (but not to alter the rendering of ) the path objects in a
page.

314 Acrobat and PDF Library API Overview


Portable Document (PD) Layer
7
PDDoc

PDDoc Methods
PDDoc methods include:

PDDocAcquire Increments a documents reference count.

PDDocAcquirePage Gets a PDPage from a document. Increments


the pages reference count.
PDDocAddThread Adds an article thread to a document after
the specified thread index.
PDDocAddWatermarkFromPDPage Adds a PDPage as a watermark to a page
range in the given document.
PDDocAddWatermarkFromText Adds a text-based watermark to a page range
in the given document.
PDDocAuthorize Adds permissions to the specified document,
if permitted.
PDDocClearFlags Clears flags associated with a document.

PDDocClose Closes an open document.

PDDocCopyToFile In the Adobe Reader or for documents that


are not dirty, this method copies the bytes
from the document's ASFile to the speci-
fied location.
PDDocCreate Creates a new document.

PDDocCreateNameTree Retrieves the name tree inside the Names


dictionary with the specified key name, or
creates it if it does not exist.
PDDocCreatePage Creates a new page.

PDDocCreateStructTreeRoot Creates a new StructTreeRoot element.

PDDocCreateTextSelect Creates a text selection that includes all


words totally or partially enclosed by a
rectangle.
PDDocCreateThumbs Creates thumbnail images for the specified
range of pages.
PDDocGetWordFinder Gets the word finder associated with a
document.

Acrobat and PDF Library API Overview 315


Portable Document (PD) Layer
7
PDDoc

PDDocCreateWordFinderEx This is a version 6.0 replacement for PDDoc-


CreateWordFinder and PDDocCreate-
WordFinderUCS that adds configurable
word-breaking behavior.
PDDocCreateWordFinderUCS Creates a word finder (see PDWordFinder
on page 355) for extracting text in UCS
format from a PDF file.
PDDocDeletePages Deletes the specified pages, inclusively.

PDDocDeleteThumbs Deletes thumbnail images for a range of


pages in a document.
PDDocEnumFonts Enumerates all the fonts in the specified page
range.
PDDocEnumLoadedFonts Enumerates all the fonts that have been
encountered so far.
PDDocEnumOCConfigs Enumerates the optional-content configura-
tions for the document, calling the supplied
procedure for each one.
PDDocEnumOCGs Enumerates the optional-content groups for
the document, calling the supplied
procedure for each one.
PDDocEnumPDSElementsWithUserPr Enumerates the elements in the document's
operties structure tree that have UserProperties
attributes or classes, calling the supplied enu-
meration procedure for each such element
found.
PDDocEnumResources Enumerates the specified type of page
resources, for a specified range of pages.
PDDocExportNotes Creates a document containing empty pages
plus text annotations (notes) from
sourceDoc.
PDDocExportSomeNotes Like PDDocExportNotes but the caller
provides the list of annots to export.
PDDocFindPageNumForLabel Finds the first page in the document with a
specified label.
PDDocFindPageNumForLabelEx Finds the first page in the document with a
specified label.

316 Acrobat and PDF Library API Overview


Portable Document (PD) Layer
7
PDDoc

PDDocFlattenOC Replaces the contents of every page in the


document with a version that has no optional
content, containing only what was visible on
the page when the call was made, and
removes all other optional-content informa-
tion.
PDDocFromCosDoc Gets the PDDoc associated with a CosDoc.

PDDocGetBookmarkRoot Gets the root of the document's bookmark


tree.
PDDocGetCosDoc Gets a document's Cos-level document
object.
PDDocGetCryptHandler Gets the specified document's current secu-
rity handler (that is, the security handler that
was used to open the document).
PDDocGetCryptHandlerClientData Gets the client data for the encryption
handler associated with the PDDoc.
PDDocGetFile Gets the file object for a document.

PDDocGetFlags Gets information about the document's file


and its state.
PDDocGetFullScreen Tests whether the document will open in full-
screen mode.
PDDocGetID Gets an element of a document's file
identifier.
PDDocGetInfo Gets a value from a documents Info
dictionary.
PDDocGetLabelForPageNum Retrieves the label string associated with the
given page number.
PDDocGetLabelForPageNumEx Retrieves the label string associated with the
given page number.
PDDocGetLayoutMode Gets the value of the PageLayout key in the
Catalog dictionary.
PDDocGetNameTree Retrieves a name tree, with the key name
specified in theTree, from the Names
dictionary of the PDDoc.

Acrobat and PDF Library API Overview 317


Portable Document (PD) Layer
7
PDDoc

PDDocGetNewCryptHandler Gets the specified document's new security


handler (that is, the security handler that will
be used after the document is saved).
PDDocGetNewSecurityData Gets the security data structure for the
specified document's new security handler.
PDDocGetNewSecurityInfo Gets the security information from the
specified document's new security handler.
PDDocGetNumOCGs Returns the number of optional-content
groups associated with a document, which is
the number of unique entries in the docu-
ments OCProperties OCGs array.
PDDocGetNumPages Gets the number of pages in the document.

PDDocGetNumThreads Gets the number of article threads in a


document.
PDDocGetOCConfig Gets the built-in default optional-content
configuration for the document from the
OCProperties D entry.
PDDocGetOCContext Gets the built-in default optional-content
context for the document.
PDDocGetOCGs Gets the optional-content groups for the
document.
PDDocGetOpenAction Gets the value of the OpenAction key in the
Catalog dictionary, which is the action per-
formed when the document is opened.
PDDocGetPageLabel Returns the label that is in effect for the given
page.
PDDocGetPageMode Gets the value of the PageMode key in the
Catalog dictionary.
PDDocGetPageObjByNum Returns the page Cos object corresponding
to the given page number.
PDDocGetPermissions Gets the permissions for the specified
document.
PDDocGetSecurityData Gets the security data structure for the speci-
fied document's current security handler.
PDDocGetStructTreeRoot Gets the structure tree root for a document.

318 Acrobat and PDF Library API Overview


Portable Document (PD) Layer
7
PDDoc

PDDocGetThread Gets an article thread having the specified


index.
PDDocGetThreadIndex Gets the index of the specified article thread.

PDDocGetTrapped Gets the value of the Trapped key in the Info


dictionary.
PDDocGetVersion Gets the major and minor PDF document
versions.
PDDocGetWordFinder Gets the word finder associated with a
document.
PDDocHasOC Determines whether the optional content
feature is associated with the document.
PDDocHasUserProperties Returns true if the document declares that
it has structure elements that conform to the
UserProperties attributes/class conven-
tions.
PDDocImportCosDocNotes Adds text annotations from sourceDoc to
doc.
PDDocImportNotes Adds text annotations (notes) from
sourceDoc to doc.
PDDocInsertPages Inserts pages from another document.

PDDocMovePage Moves one page in a document.

PDDocNewSecurityData Creates a security data structure appropriate


for the specified document's new security
handler.
PDDocOpen Opens a PDDoc from an ASFileSys and an
ASPathName.
PDDocOpenEx Opens the specified document.

PDDocOpenFromASFile Opens the document specified by the


ASFile.
PDDocOpenFromASFileEx Opens the document specified by the
ASFile.
PDDocOpenWithParams Opens the document specified by the
ASFile or ASFileSys/ASPathName.

Acrobat and PDF Library API Overview 319


Portable Document (PD) Layer
7
PDDoc

PDDocPermRequest (Acrobat 5.0 and higher) Causes Acrobat to


call the documents security handler via
PDCryptAuthorizeExProc requesting
whether the operation is allowed on the
object. Replaces the PDDocAuthorize and
PDDocGetPermission methods.
PDDocPermRequestNoUB PDDocPermRequestNoUB is equivalent to
PDDocPermRequest excepting that it does
not invoke the Ubiquity permissions handler.
PDDocPermsReady A document was opened and its permissions
(if present) have been validated.
PDDocPrintPages Prints a range of pages from a document,
controlled by a structure of data and
callbacks.
PDDocReadAhead Used for page-at-a-time downloading and
byte-serving Acrobat data.
PDDocReadAheadEmbeddedFile Used for page-at-a-time downloading and
byte-serving Acrobat data.
PDDocReadAheadPages Reads ahead nPages starting at
startPage (if the file is linearized).
PDDocRelease Decrements a documents reference count.

PDDocRemoveNameTree Removes the name tree inside the Names


dictionary with the specified key name.
PDDocRemoveOpenAction Removes the value of the OpenAction key in
the Catalog dictionary.
PDDocRemovePageLabel Removes the page label that is attached to
the specified page, effectively merging the
specified range with the previous page label
sequence.
PDDocRemoveStructTreeRoot Removes, but does not destroy, the specified
StructTreeRoot element from the
specified PDDoc.
PDDocRemoveThread Removes an article thread from a document.

PDDocReplaceOCG In the document associated with a specified


optional-content group, replaces that group
with another group.

320 Acrobat and PDF Library API Overview


Portable Document (PD) Layer
7
PDDoc

PDDocReplacePages Replaces the specified range of pages in one


document with pages from anther.
PDDocRequestEntireFile Requests the document file and performs the
specified procedure on it.
PDDocRequestPages Requests nPages starting at startPage, and
performs a specified procedure on them.
PDDocSave Saves a document.

PDDocSaveWithParams Saves a document to disk as specified in a


parameters structure.
PDDocSetFlags Sets information about the documents file
and its state.
PDDocSetFullScreen Sets whether this document opens in full-
screen mode.
PDDocSetInfo Sets a value in a documents Info dictionary.

PDDocSetLayoutMode Sets the value of the PageLayout key in the


Catalog dictionary.
PDDocSetNewCryptFilterData Sets the encrypted data for the specified
document's encryption filter to decrypt.
PDDocSetNewCryptFilterMethod Sets or resets the specified documents secu-
rity filter method, used for encryption and
decryption of the documents data.
PDDocSetNewCryptHandler Sets specified document's new security han-
dler (that is, the security handler that will be
used after the document is saved).
PDDocSetNewCryptHandlerEx Extends PDDocSetNewCryptHandler for
Acrobat 6.0. Sets specified documents new
security handler (that is, the security handler
that will be used after the document is
saved).
PDDocSetNewDefaultFilters Sets or resets the documents default security
filter methods for streams and strings, used
to encrypt and decrypt the document's data.
PDDocSetNewSecurityData Sets the security data structure for the
specified documents new security handler.

Acrobat and PDF Library API Overview 321


Portable Document (PD) Layer
7
PDFileSpec

PDDocSetOpenAction Sets the value of the OpenAction key in the


Catalog dictionary, which is the action per-
formed when the document is opened.
PDDocSetPageLabel Attaches a label to a page.

PDDocSetPageMode Sets the value of the PageMode key in the


Catalog dictionary.
PDDocSetTrapped Sets the value of the Trapped key in the Info
dictionary to the specified ASAtom.
PDDocSetXAPMetadata Draws the specified stream of PDF marking
operators into the specified window.

PDFileSpec
A PDFileSpec corresponds to the PDF file specification object (see Section 3.10, File
Specifications, in the PDF Reference). It is used to specify a file in an action (see PDAction
on page 306). A file specification in a PDF file can take two forms:
A single platform-independent pathname
A data structure containing one or more alternative ways to locate the file on different
platforms
PDFileSpecs can be created from ASPathNames or from Cos objects. Methods are also
provided to get ASPathNames and device-independent pathnames from PDFileSpecs.
The PDFileSpec methods include:

PDFileSpecAcquireASPath Acquires an ASPathName for the specified file


specification and relative path.
PDFileSpecFromCosObj Converts an appropriate string or dictionary Cos
object to a file specification.
PDFileSpecGetCosObj Gets the Cos object associated with a file
specification.
PDFileSpecGetDIPath Gets the device-independent pathname from a file
specification.
PDFileSpecGetDoc Gets the PDDoc that contains the file specification.

PDFileSpecGetFileSys Gets the file system that services the specified file
specification.
PDFileSpecGetFileSysName Gets the name of the file system to which the
PDFileSpec belongs.

322 Acrobat and PDF Library API Overview


Portable Document (PD) Layer
7
PDFont

PDFileSpecIsValid Tests whether a file specification is valid.

PDFileSpecNewFromASPath Creates a new file specification from the specified


ASPathName, using the PDFileSpecNewFro-
mASPathProc of the specified file system's file
specification handler.

PDFont
A PDFont is a font that is used to draw text on a page. It corresponds to a font resource in a
PDF file (see Chapter 5, Text, in the PDF Reference).
Plug-ins can get a list of PDFonts used on a PDPage or a range of PDPages. More than
one PDPage may reference the same PDFont object.
A PDFont has a number of attributes whose values can be read or set, including an array of
widths, the character encoding, and the fonts resource name.
In general, a PDFont refers to a base font and an encoding. The base font is specified by
the font name and the subtype (typically Type 0, Type 1, MMType1, Type 3, or TrueType).
This combination of base font and encoding is commonly referred to as a font instance.
In single-byte character systems, an encoding specifies a mapping from an 8-bit index,
often called a codepoint, to a glyph.
Type 0 fonts support single-byte or multibyte encodings and can refer to one or more
descendant fonts. These fonts are analogous to the Type 0 or composite fonts supported by
Level 2 PostScript interpreters. However, PDF Type 0 fonts only support character
encodings defined by a character map (CMap). The CMap defines the encoding for a Type 0
font. It specifies the mappings between character codes and the glyphs in the descendant
fonts. For more information on Type 0 fonts, see Section 5.6.5, Type 0 Font Dictionaries, in
the PDF Reference. See Section 5.6.4, CMaps, for information on CMaps.
Type 0 fonts may have a CIDFont as a descendant. A CIDFont is designed to contain a large
number of glyph procedures and is used for languages such as Chinese, Japanese, or
Korean. Instead of being accessed by a name, each glyph procedure is accessed by an
integer known as a character identifier or CID. Instead of a font encoding, CIDFonts use a
CMap to define the mapping from character codes to a font number and a character
selector. For more information on CIDFonts, see the following sections in the PDF Reference.
Section 5.6.1, CID-Keyed Fonts Overview
Section 5.6.2, CIDSystemInfo Dictionaries
Section 5.6.3, CIDFonts
To access documents on CIDFonts, see the Adobe Solutions Network Web site.

Acrobat and PDF Library API Overview 323


Portable Document (PD) Layer
7
PDFont

For general information on CID Fonts, refer to these technical notes:

Technical
Note # Title
5092 CID-Keyed Font Technology Overview
5014 Adobe CMap and CIDFont Files Specification
5147 Font Embedding Guidelines for Adobe Third-party Developers

For information on specific CID fonts, see these technical notes:

Technical
Note # Title
5078 Adobe-Japan1-2 Character Collection for CID-Keyed Fonts
5079 Adobe-GB1-0 Character Collection for CID-Keyed Fonts
5080 Adobe-CNS1-0 Character Collection for CID-Keyed Fonts
5093 Adobe-Korea1-0 Character Collection for CID-Keyed Fonts
5094 Adobe CJK Character Collections and CMaps for CID-Keyed Fonts
5097 Adobe-Japan2-0 Character Collection for CID-Keyed Fonts
5174 CID-Keyed Font Installation for PostScript File Systems

Each base font contains a fixed set of glyphs. There are some common sets of glyph names,
and these sets are typically called charsets. Acrobat takes advantage of the most common
charset to enable font substitution. This charset is called the Adobe Standard Roman
Character Set (see Appendix E in the PostScript Language Reference, third edition). If Acrobat
encounters a font with this charset, it knows that it can represent all of the glyphs in the
font using font substitution. Other common charsets are the Adobe Expert and Expert
Subset charsets, and the Symbol charset. Most decorative fonts, such as Carta and
Wingdings, have custom charsets.
Given a base font and its charset, multiple encodings are possible. For example, one
encoding for a font could specify that the glyph for the letter A appears at codepoint 65. A
different encoding could specify that A appears at both codepoint 65 and at codepoint 97.
If text were rendered using the second encoding using the text string a is always A, it
would appear as A is always A using a font such as Times. Encodings allow glyphs to be
reordered to the most convenient order for an application or operating system.
Every font has a default encoding, commonly called its built-in encoding. In PDF, shortcuts
are taken when specifying an encoding in order to minimize document size. If a font
instance uses the built-in encoding, no encoding information is written into the PDF
document. If a font has a different encoding, only those codepoints for which the encoding
differs from the built-in encoding are recorded in the PDF file. This information is called a

324 Acrobat and PDF Library API Overview


Portable Document (PD) Layer
7
PDFont

difference encoding; it describes the difference between the built-in encoding and the
current encoding.
For non-Roman systems, the font encoding may be a variety of encodings, which are
defined by a CMap. See Section 5.6.4, CMaps, in the PDF Reference for a list of predefined
CMaps, such as SHIFT-JIS for Japanese.
A host encoding is a platform-dependent encoding for the host machines base font. For
non-UNIX Roman systems, it is MacRomanEncoding on the Macintosh platform and
WinAnsiEncoding on Windows. For UNIX (except HP-UX) Roman systems, it is ISO8859-1
(ISO Latin-1); For HP-UX, it is HP-ROMAN8. See Appendix D, Character Sets and Encoding,
in the PDF Reference for descriptions of MacRomanEncoding and WinAnsiEncoding. These
encodings specify a mapping from codepoint to glyph name for fonts that use the Adobe
Standard Roman Character Set on the Macintosh and Windows platforms.
Across PDF documentsor even within a single PDF documentthe same base font can
be used with more than one encoding. This allows documents from different platforms to
be combined without losing information. Therefore, it is not uncommon to see a document
that contains two instances of Helvetica, one using MacRoman encoding and another
using WinAnsi encoding. See Appendix D, Character Sets and Encodings, in the PDF
Reference for descriptions of MacRomanEncoding and WinAnsiEncoding. For non-Roman
systems, the host encoding may be a variety of encodings, which are defined by a CMap.
Type 3 fonts do not have the ability to provide a base font with more than one encoding.
For each Type 3 font, there is only one encoding. This encoding is completely specified in
the PDF file; there are no shortcuts as there are for other fonts.
See Section 5.7, Font Descriptors, in the PDF Reference for a discussion of font descriptors.
Methods are provided to create and destroy fonts, as well as to access the information in
the fonts descriptor.
The PDFont methods include the following:

PDFontAcquireEncodingArray Acquires a fonts encoding array (the mapping of


character codes to glyphs).
PDFontAcquireXlateTable Increments the specified fonts XlateTable ref-
erence count and also returns the XlateTable,
which is a 256-entry table that maps characters
from their encoding in the PDF file to host encod-
ing.
PDFontEncodingArrayRelease Releases a fonts encoding array (the mapping of
character codes to glyphs).
PDFontEnumCharProcs Enumerates a Type 3 fonts character drawing
procedures.
PDFontFromCosObj Converts a dictionary Cos object to a font.

Acrobat and PDF Library API Overview 325


Portable Document (PD) Layer
7
PDFont

PDFontGetASTextName Fills in an ASText object with the font name, to


be used in displaying lists or menus.
PDFontGetBBox Gets a Type 3 fonts bounding box, which is the
smallest rectangle that would enclose every char-
acter in the font if they were overlaid and painted.
PDFontGetCharSet Gets the fonts character set.

PDFontGetCIDSystemInfo Gets an ASAtom representing Registry and


Ordering for a CIDFont.
PDFontGetCIDSystemSupplement Gets the SystemSupplement number of a
CIDFont.
PDFontGetCosObj Gets the Cos object for a font.

PDFontGetDescendant Gets a Type 0 fonts descendant, which may be a


CIDType0 or CIDType2 font.
PDFontGetEncodingIndex Gets a fonts encoding index.

PDFontGetEncodingName Gets a string representing a fonts encoding.

PDFontGetFontMatrix Gets a fonts matrix, which specifies the


transformation from character space to text
space.
PDFontGetMetrics Gets a fonts metrics, which provide the informa-
tion needed to create a substitute multiple master
font when the original font is unavailable.
PDFontGetName Gets the PostScript name for a Type 1 or Type 3
font, and the styled name for a TrueType font.
PDFontGetSubtype Gets the fonts subtype.

PDFontGetWidths Gets a fonts character widths.

PDFontIsEmbedded Tests whether the specified font is embedded in


the PDF file (that is, the font is stored as a font file,
which is a stream embedded in the PDF file).
PDFontSetMetrics Sets a font's metrics, which provide the
information needed to create a substitute
multiple master font when the original font is
unavailable
PDFontXlateString Translates a string from the PDFont's encoding
into host encoding.

326 Acrobat and PDF Library API Overview


Portable Document (PD) Layer
7
PDForm

PDFontXlateTableRelease Decrements the specified fonts XlateTable


reference count.
PDFontXlateToHost Translates a string from the PDFonts encoding
to host encoding.
PDFontXlateToUCS Translates a string from whatever encoding the
PDFont uses to Unicode encoding.
PDFontXlateWidths Translates an array of 256 glyph advance widths
(obtained from PDFontGetWidths) from their
order in the PDF file into host encoding order.

PDForm
A PDForm is a self-contained set of graphics operators that is used when a particular
graphic is drawn more than once in a document. It corresponds to a form resource (see
Section 4.9, Form XObjects, in the PDF Reference). PDForm objects inherit from the
PDXObject class; you can use any PDXObject methods on a PDForm..
NOTE: A PDForm does not correspond to Acrobats interactive forms. See Forms Extended
API on page 220 for information on the Acrobat Forms plug-in API methods.
The PDForm methods include the following:

PDFormEnumPaintProc Enumerates a forms drawing operations.

PDFormEnumPaintProcWithParams Enumerates a form's drawing operations for


those contents that are visible in a given
optional-content context.
PDFormGetBBox Gets a forms bounding box.

PDGraphic
PDGraphic is the abstract superclass for all graphic objects that comprise page, charproc,
and PDForm descriptions (see Chapter 4, Graphics, in the PDF Reference). There are no
objects of type PDGraphic, but its methods can be used by any graphic object. There are
three types of graphic objects: PDPath, PDText, and PDInlineImage. In addition to
these three objects, there are also operators in the content stream. These operators are:
Save, Restore, references to XObjects (forms and image resources), and for Type 3
font descriptions only, charwidth and cachedevice. Access to these objects and
operators is via PDPageEnumContents, PDFormEnumPaintProc, or
PDCharProcEnum.

Acrobat and PDF Library API Overview 327


Portable Document (PD) Layer
7
PDImage

The PDGraphic methods include the following:

PDGraphicGetBBox Gets a graphics bounding box.

PDGraphicGetCurrentMatrix Gets the current transformation matrix in effect for


a graphic object.
PDGraphicGetState Gets the graphics state associated with a graphic
object.

Many of the methods provide access to parameters of the graphics state. For a discussion of
the graphics state and its parameters, see Section 4.3, Graphics State, in the PDF Reference.

PDImage
A PDImage is a sampled image or image mask, and corresponds to a PDF Image resource
(see Stencil Masking in Section 4.8, Images, in the PDF Reference).You can use any
PDXObject method on a PDImage. The PDImage methods include the following:

PDImageGetAttrs Gets the attributes of an image.

PDImageSelAdjustMatrix Allows an image selector client to change the


region of the page occupied by an image.
PDImageSelectAlternate Selects an alternate image to use.

PDImageSelGetDeviceAttr Gets device-related attributes for a particular image


XObject.
PDImageSelGetGeoAttr Requests geometry-related attributes of an image
XObject.

PDInlineImage
A PDInlineImage is an image whose data is stored in the page descriptions contents
stream instead of being stored as an image resource (see PDImage). PDInlineImage is
a subclass of PDGraphic and corresponds to the PDF inline image operator (see Section
4.8.6, In-Line Images, in the PDF Reference).
Inline images generally are used for images with small amounts of data (up to several
kilobytes), while image resources are used for large images. The reason for this is that there
is a tradeoff between the time needed to access an image resource and the time saved by
not having to parse inline image data when display large images is disabled in Acrobat. For
small images, the time needed to access an image resource is large compared to the time
needed to parse the image data; the opposite is true for large images.

328 Acrobat and PDF Library API Overview


Portable Document (PD) Layer
7
PDLinkAnnot

The PDInlineImage methods include the following:

PDInlineImageColorSpaceGetIndexLookup Gets the lookup table for an


indexed color space.
PDInlineImageGetAttrs Gets an inline images attributes.

PDInlineImageGetData Gets the image data for an inline


image.

PDLinkAnnot
A PDLinkAnnot corresponds to a link annotation (see Sections 8.4.5, Annotation Types,
in the PDF Reference). You can use any PDAnnot method on a PDLinkAnnot.
Plug-ins can get and set:
The bounding rectangle and color, using PDAnnot methods
The action that occurs when the link is activated, using PDLinkAnnot methods
The links border, using PDLinkAnnot methods
Plug-ins can create new link annotations and delete existing ones, using the PDPage
methods.
The following are useful macros for casting among PDAnnot and its text annotation and
link annotation subclasses:
CastToPDAnnot
CastToPDTextAnnot
CastToPDLinkAnnot
The PDLinkAnnot methods include:

PDLinkAnnotGetAction Gets a link annotations action.

PDLinkAnnotSetBorder Sets a link annotations border.

PDLinkAnnotRemoveAction Removes a link annotation's action.


PDLinkAnnotSetAction Sets a link annotation's action.

PDLinkAnnotSetBorder Sets a link annotation's border.

Acrobat and PDF Library API Overview 329


Portable Document (PD) Layer
7
PDNameTree

PDNameTree
A PDNameTree is used to map Cos strings to Cos objects, just as a Cos dictionary is used to
map Cos names to Cos objects. However, a name tree can have many more entries than a
Cos dictionary. You can create a PDNameTree and locate it where appropriate (perhaps
under a page, but most often right under the catalog). A PDNameTree is used to store the
named destination information.
Name trees use Cos-style strings, which may use Unicode encoding, rather than null-
terminated C strings. Unicode encoding may contain bytes with zeroes in them (the high
bytes of ASCII characters).
The PDNameTree methods include:

PDNameTreeEnum Enumerates the entries in the tree.

PDNameTreeEqual Compares two name trees to determine if they are


the same object.
PDNameTreeFromCosObj Creates a type cast of the cosObj to a name tree.
This does not copy the object.
PDNameTreeGet Retrieves an object from the name tree.

PDNameTreeGetCosObj Creates a type cast of the name tree to a cosObj.

PDNameTreeIsValid Validates whether a PDNameTree is a CosDict


Cos object or not.
PDNameTreeLookup Given a name tree (such as the Dests tree in the
Names dictionary) and a string, find the CosObj
in the tree that matches the string.
PDNameTreeNew Creates a new name tree in the document.

PDNameTreeNotifyNameAdded Sends a PDNameTreeNameAdded notification.

PDNameTreeNotifyNameRemoved Sends a PDNameTreeNameRemoved


notification.
PDNameTreePut Puts a new entry in the name tree.

PDNameTreeRemove Removes the specified object from the tree.

330 Acrobat and PDF Library API Overview


Portable Document (PD) Layer
7
PDNumTree

PDNumTree
A PDNumTree is used to map integers to arbitrary Cos objects just as a Cos dictionary is
used to map Cos names to Cos objects. However, a number tree can have many more
entries than a Cos dictionary. The PDNumTree methods include:

PDNumTreeEnum Enumerates the entries in the tree.

PDNumTreeEqual Compares two number trees to determine if they are the


same object.
PDNumTreeFromCosObj Creates a type cast of a CosObj to a number tree.

PDNumTreeGet Retrieves an object from the number tree.

PDNumTreeGetCosObj Creates a type cast of the number tree to a cosObj.

PDNumTreeIsValid Validates whether a PDNumTree is a CosDict Cos object


or not
PDNumTreeNew Creates a new number tree in the document.

PDNumTreeNumAdded Puts a new entry in the number tree.

PDNumTreeNumRemoved Removes the specified object from the tree.

PDNumTreePut Puts a new entry in the number tree. If an entry with this
number is already in the tree, it is replaced.
PDNumTreeRemove Removes the specified object from the tree.

PDOCConfig
The PDOCConfig object represents an optional-content configuration structure, used to
maintain a set of visibility states and other optional-content information in a PDF file for
future use. A document has a default configuration, saved in the D entry in the
OCProperties dictionary, and can have a list of other configurations, saved as an array in the
Configs entry in the OCProperties dictionary.
Configurations are typically used to initialize the optional-content group (PDOCG) ON-OFF
states for an optional-content context (PDOCContext). The OCG order in the
configuration is the order in which the groups appear in the Layers panel of Acrobat 6.0.
The configuration can define a set of mutually exclusive OCGs, called a radio button group.
PDOCConfig methods include:

PDOCConfigCreate Creates a new optional-content


configuration object.

Acrobat and PDF Library API Overview 331


Portable Document (PD) Layer
7
PDOCConfig

PDOCConfigDestroy Removes an optional-content


configuration object and destroys the
Cos objects associated with it.
PDOCConfigGetAllRadioButtonGroups Returns an array of pointers to sets of
optional-content groups in the configu-
ration that are configured to be mutu-
ally exclusive.
PDOCConfigGetCosObj Gets the Cos object associated with the
optional-content configuration.
PDOCConfigGetCreator Gets the creator property for an
optional-content configuration.
PDOCConfigGetInitState Gets the initial ON-OFF states of
optional-content groups in an optional-
content configuration.
PDOCConfigGetIntent Gets the Intent entry for an optional-
content configuration.
PDOCConfigGetLockedArray Returns a PDOCConfigs list of locked
OCGs.
PDOCConfigGetName Gets the name of an optional-content
configuration.
PDOCConfigGetOCGOrder Gets the UI-display order of optional-
content groups (OCGs) in an optional-
content configuration.
PDOCConfigGetPDDoc Gets the document to which the
optional-content configuration
belongs.
PDOCConfigGetRadioButtonGroupForOCG Returns an array of optional-content
groups in the configuration that con-
tains the specified group, and is config-
ured to behave like a radio button
group, where only one member of the
set can be ON at one time.
PDOCConfigMakeRadioButtonGroup Configures a mutually exclusive set of
optional-content groups in an optional-
content configuration.
PDOCConfigSetCreator Sets the creator property of an optional-
content configuration.

332 Acrobat and PDF Library API Overview


Portable Document (PD) Layer
7
PDOCContext

PDOCConfigSetInitState Sets the initial ON-OFF states of


optional-content groups in an optional-
content configuration.
PDOCConfigSetIntent Sets the Intent entry in an optional-
content configuration's Cos dictionary.
PDOCConfigSetLockedArray Sets a PDOCConfigs list of locked
OCGs.
PDOCConfigSetName Sets the name of an optional-content
configuration.
PDOCConfigSetOCGOrder Sets the UI-display order of optional-
content groups (OCGs) in an optional-
content configuration. This is the order
in which the group names are displayed
in the Layers panel of Acrobat 6.0 and
later.

PDOCContext
The PDOCContext object represents an optional-content context in a document, within
which document objects such as words or annotations are visible or hidden. The context
keeps track the ON-OFF states of all of the optional-content groups (OCGs, represented by
the PDOCG object) in a document. Content is or is not visible with respect to the OCG states
stored in a specific context. The context does not correspond to any explicit PDF
specification.
The PDDoc has a default context that it uses for on-screen drawing and that determines
the default state for any other drawing or content enumeration. The context has flags that
control whether to draw or enumerate content that is marked as optional
(PDOCDrawEnumType), and whether to draw content that is not marked as optional
(NonOCDrawing).
There can be more than one PDOCContext object, representing different combinations of
OCG states. You can change the states of OCGs within any context. You can build contexts
with your own combination of OCG states, and issue drawing or enumeration commands
using that context instead of the document's default context. For example, you can pass an
optional-content context to PDPageDrawContentsWithParams through the
PDDrawParams structure. You can save the resulting state information as part of the
configuration, but the context itself has no corresponding PDF form, and is not saved.

Acrobat and PDF Library API Overview 333


Portable Document (PD) Layer
7
PDOCContext

PDOCContext methods include:

PDOCContextApplyAutoStateChanges Calls PDOCContextFindAu-


toStateChanges to find optional-
content groups whose ON-OFF states
should be toggled, based on usage
application directives contained in the
configurations AS array, and applies
the changes within the given context.
The AS array defines how usage entires
are used to automatically manipulate
the OCG states.
PDOCContextApplyAutoStateChanges Finds optional-content groups whose
ON-OFF states should be toggled,
based on usage application directives
contained in the configurations AS
array, and applies the changes within
the given context.
The AS array defines how usage entires
are used to automatically manipulate
the OCG states. It associates an event
(View, Print, or Export) with a list of
OCGs and a category, or list of usage
keys identifying OCG usage dictionary
entries.
PDOCContextClearAllUserOverrides Removes usage override marks in all
optional-content groups in the given
context.
PDOCContextContentIsVisible Tests whether content is visible in the
optional-content context.
PDOCContextFindAutoStateChanges Finds optional-content groups whose
ON-OFF states should be toggled in
the context, based on usage applica-
tion directives contained in the config-
uration's AS array.
PDOCContextFree Destroys an optional-content context
object and frees the associated
memory as needed.
PDOCContextGetIntent Gets the intent list for an optional-
content context.

334 Acrobat and PDF Library API Overview


Portable Document (PD) Layer
7
PDOCContext

PDOCContextGetNonOCDrawing Gets the non-OC drawing status for an


optional-content context.
PDOCContextGetOCDrawEnumType Gets the drawing and enumeration
type for an optional-content context.
PDOCContextGetOCGStates Gets the ON-OFF states for the given
optional-content groups (OCGs) in the
given optional-content context.
PDOCContextGetPDDoc Gets the document that contains an
optional-content context.
PDOCContextInit Initializes the ON-OFF states of all
optional-content groups (OCGs) within
an existing context.
PDOCContextMakeCopy Creates a new context object to repre-
sent an optional-content state of the
document, using an existing context as
a template.
PDOCContextMakeCopyWithAutoState Creates a new context object that rep-
Changes resents an optional-content state of
the document, using an existing con-
text as a template, but applying an
automatic state change for the speci-
fied event.
PDOCContextNew Creates a context object that repre-
sents an optional-content state of the
document, initializing it in the same
way as PDOCContextInit.
PDOCContextNewWithInitialState Creates a context object that repre-
sents an optional-content state of the
document, using the current state as
the initial state for each group (OCG), as
determined by the document's
optional-content configuration
(returned by PDDocGetOCCon-
fig(pdDoc)).

Acrobat and PDF Library API Overview 335


Portable Document (PD) Layer
7
PDOCContext

PDOCContextNewWithOCDisabled Creates a context object that repre-


sents an optional-content state of the
document, with the PDOCDrawEnum-
Type property set to kPDOC_NoOC.,
so that no content marked as optional
content is drawn, regardless of the visi-
bility according to the OCGs and
OCMDs. Content that is not marked as
optional content may still be drawn,
depending on the NonOCDrawing.
PDOCContextPopOCMD Pops the optional-content
membership dictionary (OCMD) stack
for an optional-content context.
PDOCContextPushOCMD Pushes a new optional-content mem-
bership dictionary (OCMD) onto the
stack for an optional-content context.
PDOCContextResetOCMDStack Clears the OCMD stack for an optional-
content context, and resets the current
visibility for the context based on the
context's non-OC drawing setting (see
PDOCContextSetNonOCDrawing).
PDOCContextSetIntent Sets the Intent entry in an optional-
content context's Cos dictionary.
PDOCContextSetNonOCDrawing Sets the non-OC status for an optional-
content context.
PDOCContextSetOCDrawEnumType Sets the drawing and enumeration
type for an optional-content context.
PDOCContextSetOCGStates Sets the ON-OFF states for the given
optional-content groups (OCGs) in the
given optional-content context.
PDOCContextXObjectIsVisible Tests whether an XObject form or
image contained in obj is visible in the
optional-content context.

336 Acrobat and PDF Library API Overview


Portable Document (PD) Layer
7
PDOCG

PDOCG
The PDOCCG object represents an optional-content group. This corresponds to a PDF OCG
dictionary representing a collection of graphic objects that can be made visible or invisible.
Any graphic content of the PDF can be made optional, including page contents, XObjects,
and annotations. The specific content objects in the group have an OC entry in the PDF. The
group itself is a named object that you can manipulate in the Layers panel of Acrobat 6.0.
In the simplest case, the groups ON-OFF state makes the associated content visible or
hidden. The ON-OFF state of a group can be toggled for a particular context
(PDOCContext), and a set of states is kept in a configuration (PDOCConfig). The visibility
can depend on more than one group in an optional-content membership dictionary
(PDOCMD), and can also be affected by the contexts or configurations
PDOCDrawEnumType.
A group has an Intent entry, an ASAtom value broadly describing the intended use, either
View or Design. A groups content is considered to be optional (that is, the groups state is
considered in its visibility) if any intent in its list matches an intent of the context. The intent
list of the context is usually set from the intent list of the document configuration.
A Usage dictionary entry provides more specific intended usage information than an intent
entry. Possible key values are:
CreatorInfo
Language
Export
Zoom
Print
View
User
PageElement
The usage value can act as a kind of metadata, describing the sort of things that belong to
the group: for example, text in French, fine detail on a map, or a watermark. The usage
values can also be used by the AutoState mechanism to make decisions about what groups
should be on and what groups should be off. The AutoState mechanism considers the
usage information in the OCGs, the AS array of the configuration, and external factors; for
example, the language the app is running in, the current zoom level on the page, or if the
page is being printed.
PDOCG methods include:

PDOCGSetCurrentState Sets the current ON-OFF state of the optional-


content group (OCG) object in a given context.
PDOCGSetInitialState Sets the initial state (ON or OFF) of the optional-
content group (OCG) object in a given configuration.
PDOCGSetUsageDictEntry Sets a Usage dictionary entry in an optional-content
group (OCG) object. The entry associates usage
information with an entry key for retrieval.

Acrobat and PDF Library API Overview 337


Portable Document (PD) Layer
7
PDOCG

PDOCGCreate Creates a new optional-content group (OCG) object


in the document.
PDOCGCreateFromCosObj Creates a new optional-content group (OCG) object
from a Cos object.
PDOCGDestroy Destroys an optional-content group (OCG) object.

PDOCGGetCosObj Gets the Cos object associated with the optional-


content group (OCG) object.
PDOCGGetCurrentState Gets the current ON-OFF state of the optional-
content group (OCG) object in a given context.
PDOCGGetFromCosObj Gets an optional-content group (OCG) object from
the associated Cos object.
PDOCGGetInitialState Gets a initial state (ON or OFF) of the optional-
content group (OCG) object in a given configuration.
PDOCGGetIntent Gets the intent list for an optional-content group.

PDOCGGetLocked Returns the locked state of an OCG in a given


configuration.
PDOCGGetName Gets the name of an optional-content group.

PDOCGGetPDDoc Gets the document that contains an optional-


content group.
PDOCGGetUsageEntry Gets usage information from an optional-content
group (OCG) object.
PDOCGGetUserOverride Tests whether the optional-content group is marked
as having had its state set directly by client code in
the specified context (as opposed to automatically
by the optional-content AutoState mechanism).
PDOCGHasUsageInfo Tests whether an optional-content group (OCG)
object is associated with a Usage dictionary.
PDOCGRemoveInitialState Removes the initial ON-OFF state information for the
optional-content group (OCG) object in a given con-
figuration.
PDOCGSetCurrentState Sets the current ON-OFF state of the optional-
content group (OCG) object in a given context.
PDOCGSetInitialState Sets the initial state (ON or OFF) of the optional-
content group (OCG) object in a given configuration.

338 Acrobat and PDF Library API Overview


Portable Document (PD) Layer
7
PDOCMD

PDOCGSetIntent Sets the Intent entry in an optional-content group's


Cos dictionary.
PDOCGSetLocked Sets the locked state of an OCG in a given
configuration.
PDOCGSetName Sets the name of an optional-content group.

PDOCGSetUsageDictEntry Sets a Usage dictionary entry in an optional-content


group (OCG) object.
PDOCGSetUserOverride Marks the optional-content group as having had its
state set directly by client code in the specified con-
text (as opposed to automatically by the optional-
content AutoState mechanism).
PDOCGUsedInOCConfig Tests whether an optional-content group (OCG)
object is used in a context initialized using the given
configuration.
PDOCGUsedInOCContext Tests whether an optional-content group (OCG)
object is used in a given context.

PDOCMD
The PDOCMD object represents an optional-content membership dictionary (OCMD) that
allows the visibility of optional content to depend on the states in a set of optional-content
groups (PDOCG). The object corresponds to the PDF OCMD dictionary.
An OCMD collects a set of OCGs. It sets a visibility policy, so that content in the member
groups is visible only when all groups are ON or OFF, or when any of the groups is ON or
OFF. This makes it possible to set up complex dependencies among groups.
An optional-content context can contain a stack of OCMD objects, which you can
manipulate with PDOCContextPopOCMD, PDOCContextPushOCMD, and
PDOCContextResetOCMDStack.
An OCMD can be associated with an annotation (PDAnnotSetOCMD) or a PDE element
(PDEElementSetOCMD).
PDOCMD methods include:

PDOCMDCreate Creates a new optional-content membership


dictionary object in the given document for the
given groups and visibility policy.

Acrobat and PDF Library API Overview 339


Portable Document (PD) Layer
7
PDOCMD

PDOCMDFindOrCreate Creates a new optional-content membership


dictionary object in the given document for the
given groups and visibility policy.
PDOCMDFindOrCreateEx Locates an existing optional-content member-
ship dictionary (PDOCMD) object that refer-
ences the given groups, uses the same visibility
policy, and uses the same visibility expression.
PDOCMDGetCosObj Gets the Cos object associated with the
optional-content membership dictionary
(OCMD) object.
PDOCMDGetFromCosObj Gets an optional-content membership
dictionary (OCMD) object from the associated
Cos object.
PDOCMDGetOCGs Gets the optional-content groups listed in a
membership dictionary.
PDOCMDGetPDDoc Gets the document that contains an optional-
content membership dictionary.
PDOCMDGetVisibilityExpression If the PDOCMD has a visibility expression entry,
the function returns true, and if veObj is non-
NULL, veObj is set to the CosObj for the visi-
bility expression.
PDOCMDGetVisPolicy Gets the optional-content membership
dictionarys visibility policy, which determines
the visibility of content with respect to the ON-
OFF state of OCGs listed in the dictionary.
PDOCMDIsCurrentlyVisible Based on the optional-content groups listed in
the dictionary, the current ON-OFF state of
those groups within the specified context, and
the dictionary's visibility policy, test whether
the content tagged with this dictionary would
be visible.
PDOCMDsAreCurrentlyVisible Tests a set of optional-content membership dic-
tionaries to determine whether contents
tagged with any of them is visible in a given
optional-content context.

340 Acrobat and PDF Library API Overview


Portable Document (PD) Layer
7
PDPage

PDOCMDsMakeContentVisible Makes content that uses any of a set of


optional-content membership dictionaries
visible in a given optional-content context. The
method manipulates the states of optional-
content groups in the dictionaries so that any
content controlled by any of the dictionaries
will be visible in the given context. There can be
more than one combination of states that
satisfies the request.

PDPage
A PDPage is a page in a document, corresponding to the PDF Page object (see Page
Objects in Section 3.6.2, Page Tree, in the PDF Reference). Among other associated
objects, a page contains:
A series of objects representing the objects drawn on the page (PDGraphic)
A list of resources used in drawing the page
Annotations (which are subclasses of PDAnnot)
An optional thumbnail image of the page
Beads used in any articles that occur on the page
PDPage methods include:

PDPageAcquirePage Increments the page's reference count.

PDPageAcquirePDEContent Creates a PDEContent object from


the PDPages contents and resources.
PDPageAddAnnot Adds an annotation to a page.

PDPageAddCosContents Completely replaces the contents of the


specified page with newContents.
PDPageAddCosResource Adds a Cos resource to a page object.

PDPageAddNewAnnot Adds an annotation to the page.

PDPageCreateAnnot Creates a new annotation, associated


with the specified page's CosDoc, but
not added to the page.
PDPageDrawContentsToWindow Draws the contents of a page into a
user-supplied window.

Acrobat and PDF Library API Overview 341


Portable Document (PD) Layer
7
PDPage

PDPageDrawContentsToWindowEx Provides control over the rendering of


annotations on the page to be drawn
into window.
PDPageDrawContentsWithParams Provides control over the rendering of
contents on the page, including both
those parameters you would pass to
PDPageDrawContentsToWin-
dowEx, and an optional-content con-
text that determines which contents are
visible.
PDPageEnumContents Enumerates the contents of a page,
calling a procedure for each drawing
object in the page description.
PDPageEnumInks Enumerates the inks for a page, calling
the supplied procedure for each
PDPageInk structure.
PDPageEnumInksEx Enumerates the inks for a page, calling
the supplied procedure for each
PDPageInk structure.
PDPageEnumOCGs Enumerates the optional-content
groups for the page, calling the
supplied procedure for each one.
PDPageFlattenOC Replaces the pages contents with a ver-
sion that has no optional content, con-
taining only what was visible on the
page when the call was made.
PDPageGetAnnot Gets an annotation from a page.

PDPageGetAnnotIndex Gets the index of a given annotation


object on a given page.
PDPageGetAnnotSequence Returns the sequence number of the
specified annotation for the given page.
PDPageGetBBox Gets the bounding box for a page.

PDPageGetBox Returns the box specified for the page


object intersected with the media box.
PDPageGetCosObj Gets the dictionary Cos object
associated with a page.

342 Acrobat and PDF Library API Overview


Portable Document (PD) Layer
7
PDPage

PDPageGetCosResources Gets the Cos object corresponding to a


pages resource dictionary.
PDPageGetCropBox Gets the crop box for a page.

PDPageGetDefaultMatrix Gets the matrix that transforms user


space coordinates to rotated and
cropped coordinates.
PDPageGetDoc Gets the document containing a page.

PDPageGetDuration Gets the page's automatic-advance tim-


ing valuethe maximum amount of
time the page is displayed before the
viewer automatically advances to the
next page.
PDPageGetFlippedMatrix Gets the matrix that transforms user
space coordinates to rotated and
cropped coordinates.
PDPageGetMediaBox Gets the media box for a page.

PDPageGetNumAnnots Gets the number of annotations on a


page.
PDPageGetNumber Gets a pages number

PDPageGetOCGs Gets the optional-content groups for


the document.
PDPageGetPalette Useful for obtaining the static, platform-
specific palette; the bitmap must be
already selected into the displayCon-
text to get the palette.
PDPageGetPDEContentFilters Gets filters used by
PDPageSetPDEContent.
PDPageGetPDEContentFlags Gets flags used by
PDPageSetPDEContent.
PDPageGetRotate Gets the rotation value for a page.

PDPageGetTransition Gets the transition for a given page.

PDPageGetUserUnitSize Returns the UserUnit value for the page.


If the key is not present in the page dic-
tionary the default of 1.0 is returned.

Acrobat and PDF Library API Overview 343


Portable Document (PD) Layer
7
PDPage

PDPageGetVisibleBBox Gets the bounding box for a given page


for those contents that are visible in the
given optional-content context.
PDPageHasTransition Tests whether a page has a transition.

PDPageHasTransparency Checks whether a page has any


transparency features.
PDPageLabelEqual Compares two page labels to see if they
are equivalent.
PDPageMakeSeparations Generates print color separations for a
page.
PDPageNotifyContentsDidChange Broadcasts a
PDPageContentsDidChange
notification.
PDPageNotifyContentsDidChangeEx Broadcasts a
PDPageContentsDidChange
notification.
PDPageNumFromCosObj Gets the page number of the page
specified by a Cos object.
PDPagePDEContentWasChanged Indicates a pages PDEContent has
changed.
PDPageRegisterForPDEContentChanged Registers for the
PagePDEContentDidChange
notification.
PDPageRegisterForPDEContentNotCached Register for the
PagePDEContentNotCached
notification.
PDPageRelease Decrements the specified page's
reference count.
PDPageReleasePDEContent Decrements a PDPages PDEContent
internal reference count.
PDPageRemoveAnnot Removes an annotation from the
specified page.
PDPageRemoveCosContents Removes the contents of the specified
page.
PDPageRemoveCosResource Removes a Cos resource from a page
object.

344 Acrobat and PDF Library API Overview


Portable Document (PD) Layer
7
PDPage

PDPageResumePDEContentChanged Resumes destruction of PDEContent


objects when a
PDPageContentsDidChange
notification occurs.
PDPageSetBox Sets the box specified by boxName for
the page.
PDPageSetCropBox Sets the crop box for a page.

PDPageSetDuration Sets the pages automatic-advance tim-


ing valuethe maximum amount of
time the page is displayed before the
viewer automatically advances to the
next page.
PDPageSetMediaBox Sets the media box for a page.

PDPageSetPDEContent Sets the pages PDEContent back into


the PDPages Cos object, using the
same compression filters with
which the content was previously
encoded.
PDPageSetPDEContentCanRaise Sets the pages PDEContent back into
the PDPages Cos object, using the
same compression filters with which
the content was previously encoded.
PDPageSetPDEContentFilters Sets filters used by
PDPageSetPDEContent.
PDPageSetPDEContentFlags Sets flags used by
PDPageSetPDEContent.
PDPageSetRotate Sets the rotation value for a page.

PDPageSetTransition Sets the transition for a given page.

PDPageSetUserUnitSize Set the UserUnit value for a page.

PDPageStmGetInlineImage Reads a PDF page content inline image


from a stream.
PDPageStmGetToken Reads a PDF page content token from a
stream.

Acrobat and PDF Library API Overview 345


Portable Document (PD) Layer
7
PDPageLabel

PDPageSuspendPDEContentChanged Suspends destruction of PDEContent


objects when a
PagePDEContentDidChange
notification occurs.
PDPageUnRegisterForPDEContentChanged Un-registers for the
PagePDEContentDidChange
notification.
PDPageUnRegisterForPDEContentNotCach Un-registers for the
ed PagePDEContentNotCached
notification.

PDPageLabel
A PDPageLabel represents a page label. These labels allow non-sequential page
numbering or the addition of arbitrary labels for a page (such as the inclusion of Roman
numerals at the beginning of a book). A PDPageLabel specifies:
The numbering style to use (for example, uppercase or lowercase Roman, decimal, and
so forth)
The starting number for the first page
An arbitrary prefix to be added to each number (for example, A- to generate A-1, A-
2, A-3, and so forth)
PDPageLabel methods include:

PDPageLabelEqual Compares two page labels to see if they are equivalent.

PDPageLabelFromCosObj Creates a type cast of the cosObj to a PDPageLabel


object.
PDPageLabelGetCosObj Creates a type cast of the page label object to a Cos
object.
PDPageLabelGetPrefix Creates a type cast of the page label object to a Cos
object.
PDPageLabelGetStart Gets the starting page number for the page label
specified.
PDPageLabelGetStyle Returns an ASAtom for the style of the label.

PDPageLabelIsValid Determines whether a page label is valid.

PDPageLabelNew Constructs a new label object in the document with the


specified style, prefix, and starting page number.

346 Acrobat and PDF Library API Overview


Portable Document (PD) Layer
7
PDPath

PDPath
A PDPath is a graphic object (a subclass of PDGraphic) representing a path in a page
description. Paths are arbitrary shapes made of straight lines, rectangles, and cubic curves.
Path objects may be filled or stroked, and they can serve as a clipping path. For details, see
the following sections in the PDF Reference:
Section 4.1, Graphic Objects
Section 4.4, Path Construction and Painting
PDPath methods include:

PDPathEnum Enumerates a paths operators, calling one of several user-


supplied callbacks for each.
PDPathGetPaintOp Determines which paint/close/clip operators are used for the
path.

PDStyle
A PDStyle object provides access to information on the fonts, font sizes, and colors used
in a PDWord. PDStyle methods include:

PDStyleGetColor Gets a styles color.

PDStyleGetFont Gets the specified styles font.

PDStyleGetFontSize Gets a styles font size.

PDText
A PDText is a graphic object (a subclass of PDGraphic) representing one or more
character strings on a page. For details, see the following sections in the PDF Reference:
Section 4.1, Graphics Objects
Section 5.3, Text Objects
Like paths, text can be stroked or filled, and can serve as a clipping path.
There are PDText methods to access the text-specific parameters in the graphics state. See
Section 4.3, Graphics State, in the PDF Reference for a discussion of graphics state. PDText
methods:

PDTextEnum Enumerates the strings of a text object.

Acrobat and PDF Library API Overview 347


Portable Document (PD) Layer
7
PDTextAnnot

PDTextGetState Gets the text state for a text object.

PDTextAnnot
A PDTextAnnot corresponds to a PDF text annotation. For details, see Text
Annotations in Section 8.4.5, Annotation Types, in the PDF Reference. You can use any
PDAnnot method on a PDTextAnnot.
Plug-ins can use PDTextAnnot methods to:
Get and set attributes including the rectangle, textual contents, and whether or not the
annotation is open.
Create new text annotations and delete or move existing ones using PDAnnot
methods.
Manipulate the behavior of text annotations by modifying the Text Annotation Handler.
The Acrobat SDK provides three useful macros to cast among PDAnnot and its text
annotation and link annotation subclasses. These are (see PDExpT.h):
CastToPDAnnot
CastToPDTextAnnot
CastToPDLinkAnnot
PDTextAnnot methods include:

PDTextAnnotGetContents Gets the text of a text annotation.

PDTextAnnotIsOpen Tests whether a text annotation is open.

PDTextAnnotSetContents Sets the text of a text annotation.

PDTextAnnotSetOpen Opens or closes a text annotation.

PDTextSelect
PDTextSelect objects represent a selection of text on a single page, and may contain
more than one disjointed group of words. A text selection contains one or more ranges of
text, with each range containing the word numbers (in PDF order, as returned by
PDWordFinderEnumWords or PDWordFinderAcquireWordList) of the selected
words. Each range has a start word (the first word in the series) and an end word (the first
word not in the series).
PDTextSelect methods are useful for:
Processing a text selection created by a user via Acrobats user interface

348 Acrobat and PDF Library API Overview


Portable Document (PD) Layer
7
PDTextSelect

Programmatically creating a region of text.


You can manipulate text selections using the PDTextSelectRangeRec data structure.
This structure contains two start/end pairs
The first pair indicates the word offsets of the start and end words of the selection.
The second pair indicates the character offsets within the start and end words of the
beginning and end of the selection.
NOTE: Plug-ins should set both character offset fields to zero, because Acrobat currently
highlights only whole words, not substrings within words.
To create a selection, plug-ins can:
Supply a list of PDTextSelectRangeRec structures to
PDTextSelectCreateRanges
Supply a list of word highlights to PDTextSelectCreateWordHilite
While character offsets are well-defined quantities in a PDF file, word numbers are
calculated by the PDWordFinder algorithm and, therefore, may change as the word
finder algorithm is improved in future versions. Because of this, long-term storage of
selection information (in custom annotations, for example) is safer if done with
page-relative character offsets and PDTextSelectCreatePageHilite.
Once a plug-in creates a text selection, it can make it the current selection using
AVDocSetSelection.
PDTextAnnot methods include the following:

PDTextSelectCreatePageHilite Creates a text selection containing one or


more words specified by their character offsets
from the start of the page.
PDTextSelectCreatePageHiliteEx Adds WFVersion parameter to
PDTextSelectCreatePageHilite.
PDTextSelectCreateRanges Creates a text selection from a list of start/stop
word offset pairs.
PDTextSelectCreateRangesEx Adds the WFVersion parameter to
PDTextSelectCreateRanges.
PDTextSelectCreateWordHilite Creates a text selection containing one or
more words specified by their word offsets
from the start of the page.
PDTextSelectCreateWordHiliteEx Adds the WFVersion parameter to
PDTextSelectCreateWordHilite.
PDTextSelectDestroy Deletes a text selection object (the text on the
page remains unchanged).

Acrobat and PDF Library API Overview 349


Portable Document (PD) Layer
7
PDThread

PDTextSelectEnumQuads Enumerates the bounding quads in a text


selection. proc is called for each quad.
PDTextSelectEnumText Enumerates the strings of the specified text
select object, calling a procedure for each
string.
PDTextSelectEnumTextUCS Same as PDTextSelectEnumText except
output is forced to UCS.
PDTextSelectGetBoundingRect Gets a text selections bounding rectangle.

PDTextSelectGetPage Gets the page number of a text selections


page.
PDTextSelectGetRange Extracts the range specified by index from a
text selection.
PDTextSelectGetRangeCount Gets the number of ranges in a text selection.

NOTE: The first three methods above have new versions, with Ex appended, which let
you specify the version of the word finder algorithm to use (see PDWordFinder on
page 355).

PDThread
A thread corresponds to an article in Acrobats user interface, and contains an ordered
sequence of rectangles that bound the article. Each rectangle is called a bead. See Section
8.3.2, Articles, in the PDF Reference for more information on articles and beads in PDF.
Threads can be created interactively by the user or programmatically. They are internally
represented by a circular linked list of PDBeads.
NOTE: With Acrobat and the PDF Library, it is possible to spawn threads using operating
system mechanisms. Acrobat and PDF Library are capable of operating in a thread-
safe environment, but that capability isnot related to thePDThread object. For
more information on using operating system threads, see , Using Threads on
page 257.
PDThread methods include the following:

PDThreadDestroy Deletes an article thread from its document.

PDThreadFromCosObj Gets the thread object corresponding to the


specified Cos object.
PDThreadGetCosObj Gets the Cos object corresponding to a thread.

PDThreadGetFirstBead Gets an article threads first bead.

350 Acrobat and PDF Library API Overview


Portable Document (PD) Layer
7
PDThumb

PDThreadGetInfo Gets the specified article threads info.

PDThreadIsValid Tests whether a thread is valid.

PDThreadNew Creates a thread.

PDThreadSetFirstBead Sets an article threads first bead.

PDThreadSetInfo Sets the specified article threads info.

PDThumb
A PDThumb is a thumbnail preview image of a page.

PDTrans
A PDTrans represents a transition to a page. The Trans key in a page dictionary specifies a
transition dictionary, which describes the effect to use when going to a page and the
amount of time the transition should take. See Section 8.3.3, Presentations, in the PDF
Reference for more information on transitions. PDTrans methods include the following:

PDTransEqual Tests two transitions for equality.

PDTransFromCosObj Converts the specified dictionary Cos object to a transition


and verifies that the transition is valid.
PDTransGetCosObj Gets the dictionary Cos object corresponding to the
transition and verifies that the transition is valid.
PDTransGetDuration Gets the duration of a transition.

PDTransGetSubtype Gets a transitions subtype.

PDTransIsValid Tests whether a transition is valid, that is, the transition has
not been deleted.
PDTransNew Creates a new transition

PDTransNewFromCosD Creates a new transition of the specified type and duration


oc associated with the given CosDoc.

PDTransNull Gets a NULL transition.

Acrobat and PDF Library API Overview 351


Portable Document (PD) Layer
7
PDViewDestination

PDViewDestination
A PDViewDestination represents a particular view of a page in a document. It contains
a reference to a page, a rectangle on that page, and information specifying how to adjust
the view to fit the windows size and shape. It corresponds to a PDF Dest array (see Named
Destinations in Section 8.2, Document-Level Navigation, in the PDF Reference) and can be
considered a special form of a PDAction.
PDViewDestination provides a number of methods to get or set the attributes
describing the location and size of the view, including the page, rectangle, and fit style.
PDViewDestination methods include:

PDViewDestCreate Creates a new view destination object.

PDViewDestDestroy Deletes a view destination object.

PDViewDestFromCosObj Converts the specified Cos object to a view destination and


verifies that the view destination is valid.
PDViewDestGetAttr Gets a view destinations fit type, destination rectangle, and
zoom factor.
PDViewDestGetCosObj Gets the Cos object corresponding to a view destination
and verifies that the view destination is valid.
PDViewDestIsValid Tests whether a view destination is valid.

PDViewDestResolve Resolves a destination. dest is the value of the D key in an


action.

PDWord
A PDWord object represents a word in a PDF file. Each word contains a sequence of
characters in one or more styles (see PDStyle on page 102).
All characters in a word are not necessarily physically adjacent. For example, words can be
hyphenated across line breaks on a page.
Each character in a word has a character type. Character types include: control code,
lowercase letter, uppercase letter, digit, punctuation mark, hyphen, soft hyphen, ligature,
white space, comma, period, unmapped glyph, end-of-phrase glyph, wildcard, word break,
and glyphs that cannot be represented in the destination font encoding. See Character
Type Codes in the Acrobat and PDF Library API Reference for details.
The PDWordGetCharacterTypes method can get the character type for each
character in a word. The PDWordGetAttr method returns a mask containing information
on the types of characters in a word. The mask is the logical OR of several flags, including
the following:

352 Acrobat and PDF Library API Overview


Portable Document (PD) Layer
7
PDWord

One or more characters in the word cannot be represented in the output encoding.
One or more characters in the word are punctuation marks.
The first character in the word is a punctuation mark (this bit is on in addition to the
punctuation bit).
The last character in the word is a punctuation mark (this bit is on in addition to the
punctuation bit).
The word contains a ligature (a special typographic symbol consisting of two or more
characters such as the English fi ligature used to replace the two-character sequence, f
followed by i). Ligatures are used to improve the appearance of a word.
One or more characters in the word are digits.
There is a hyphen in the word.
There is a soft hyphen in the word.
A words location is specified by the offset of its first character from the beginning of the
page (known as the character offset). The characters are enumerated in the order in which
they appear in pages content stream in the PDF file (which is not necessarily the order in
which the characters are read when displayed or printed).
A word also has a character delta, which is the difference between the number of
characters representing the word in the PDF file and the number of characters in the
word. The character delta is non-zero, for example, when a word contains a ligature.
PDWord methods include the following:

PDWordCreateTextSelect Creates a text selection object for a given page that


includes all words in a word list, as returned from a
PDWordFinder method.
PDWordFilterString Creates a text selection object for a given page that
includes all words in a word list, as returned from a
PDWordFinder method.
PDWordFilterWord Removes leading and trailing spaces and leading and
trailing punctuation (including soft hyphens) from
the specified word.
PDWordGetASText Copies the text from a word into an ASText object.

PDWordGetAttr Gets a bit field containing information on the types


of characters in a word.
PDWordGetAttrEx Gets a bit field containing information on the types
of characters in a word.

Acrobat and PDF Library API Overview 353


Portable Document (PD) Layer
7
PDWord

PDWordGetByteIdxFromHilite Returns the byte offset within the specified word of


Char the highlightable character at the specified character
offset.
PDWordGetCharacterTypes Gets the character type for each character in a word.

PDWordGetCharDelta Gets the difference between the word length (the


number of printed characters in the word) and the
PDF word length (the number of character codes in
the word).
PDWordGetCharEncFlags Gets the WordFinder Character Encoding Flags for
each character in a word, which specify how reliably
the word finder identified the character encoding.
PDWordGetCharOffset Returns the offset of a word from the beginning of
the page.
PDWordGetCharOffsetEx Returns the character offset for a character identified
by its index number, and the number of bytes
(length) used for that character.
PDWordGetCharQuad Gets the quadrilateral bounding of the character at a
given index position in the word.
PDWordGetLength Gets the number of bytes in a word.

PDWordGetNthCharStyle Returns a PDStyle object for the nth style in a


word.
PDWordGetNthQuad Gets the specified word's nth quad, specified in user
space coordinates.
PDWordGetNumHiliteChar Gets the number of highlightable characters in a
word.
PDWordGetNumQuads Gets the number of quads in a word.

PDWordGetString Converts a word to a null-terminated string and


converts ligatures to their constituent characters.
PDWordGetStyleTransition Gets the locations of style transitions in a word.

PDWordIsCurrentlyVisible Tests whether a word is visible in a given optional-


content context on a given page.
PDWordIsRotated Tests whether a word is rotated.

PDWordMakeVisible Makes a word is visible in a given optional-content


context on a given page.

354 Acrobat and PDF Library API Overview


Portable Document (PD) Layer
7
PDWordFinder

PDWordSplitString Splits the specified string into words by substituting


spaces for word separator characters.

PDWordFinder
A PDWordFinder extracts words from a PDF file, and enumerates the words on a single
page or on all pages in a document. The core API provides methods to extract words from a
document, obtain information on the word finder, and to release a list of words after a plug-
in is done using it.
To create a word finder, use PDDocCreateWordFinder or
PDDocCreateWordFinderUCS. PDDocCreateWordFinderEx is a version 6.0
replacement for PDDocCreateWordFinder and PDDocCreateWordFinderUCS
that adds configurable word-breaking behavior.
There are two primary methods of using word finders:
Calling the method PDWordFinderEnumWords, which calls a user-provided
procedure each time a word is recognized on a page.
Using PDWordFinderAcquireWordList, which builds a word list for an entire page
before it returns. This method can return the recognized words in two possible orders:
The order in which the words are encountered in the PDF file.
According to word location on the page. For a page containing a single column of
text, this generally is the same as reading order. For a page containing multiple
columns of text, this is not true.
The PDWordFinder methods include:

PDWordFinderAcquireVisibleWordList Finds all words on the specified page


that are visible in the given optional-
content context and returns one or
more tables containing the words.
PDWordFinderAcquireWordList Finds all words on a page, and returns
one or more tables containing the
words.
PDWordFinderDestroy Destroys a word finder.

PDWordFinderEnumVisibleWords Extracts visible words, one at a time,


from the specified page or the entire
document.
PDWordFinderEnumWords Extracts words, one at a time, from the
specified page or the entire document.

Acrobat and PDF Library API Overview 355


Portable Document (PD) Layer
7
PDXObject

PDWordFinderEnumWordsStr Constructs a PDWord list from a Uni-


code string, and calls a user-supplied
procedure once for each word found.
PDWordFinderGetLatestAlgVersion Gets the version number of the speci-
fied word finder, or the version number
of the latest word finder algorithm.
PDWordFinderGetNthWord Gets the nth word in the word list
obtained using
PDWordFinderAcquireWordList.
PDWordFinderReleaseWordList Releases the word list for a given page.

PDXObject
This object corresponds to a PDF XObject (see Section 4.9, Form XObjects, in the PDF
Reference). PDXObject objects currently used by Acrobat are of one of the two X Object
subclasses: PDImage and PDForm. You can use any PDXObject method on these
objects.

356 Acrobat and PDF Library API Overview


8 PDFEdit LayerCreating and
Editing Page Content

Introduction
The PDFEdit API provides easy access to PDF page contents. With PDFEdit, your plug-in can
treat a pages contents as a list of objects rather than manipulating the content streams
marking operators.
Page content is a major component of a PDF file. It represents the visible marks on a page
that are drawn by a set of PDF marking operators. The set of marking operators for a page
also is referred to as a display list, since it is a list of marking operations that represent the
displayed portion of a page. See Section 3.7.1, Content Streams, in the PDF Reference for
an overview of page content streams and references to other chapters that describe the
marking operators in detail.
PDFEdit provides easy access to PDF page contents. PDFEdit is meant to be used in
conjunction with the Acrobat PD layer and Cos layer methods for manipulating PDF
documents. To use PDFEdit effectively, you should be familiar with PDF page marking
operators and the PD layer of the core API, described in Chapter 7.
PDFEdit works with the page contents associated with the Contents key in the page
dictionary (see section 3.6.2 in the PDF Reference). It can also handle Form XObject
appearances represented by the AP (appearances) key in an annotation dictionary. See
section 8.4.1 in the PDF Reference for the entries in an annotation dictionary.

Overview of PDFEdit

Why PDFEdit?
Acrobat Distiller and PDFWriter create documents from PostScript or as output from a
printer driver. Non-PDFEdit methods in the core API allow displaying and printing
documents, and provide the ability to rearrange pages and to add annotations. However,
most of these manipulations are creation-centered, or only deal with objects at the page
level and above. PDFEdit methods, on the other hand, allow your plug-in to deal with
objects at the level of a pages contents.
The content of a page either resides in a stream object or an array of stream objects. Inside
the stream, the elements of a page are not described as objects; they are described as
marking operators. There are graphic and clip states at any point in the page description.
This state is modified by other operators (such as SC, w, and so on). These streams are
difficult to manipulate using non-PDFEdit core API methods for these reasons:

Acrobat and PDF Library API Overview 357


PDFEdit LayerCreating and Editing Page Content
8
Overview of PDFEdit

It is awkward to parse or enumerate a stream. Existing methods such as


PDPageStmGetToken get data from the contents stream, but the tokens returned are
uninterpreted page marking operators.The method does not readily allow your plug-in
to modify the content.
Resource handling is difficult. Non-PDFEdit methods in the core API treat resource and
contents as unrelated entities. Text is not readily associated with its font resource, for
instance.
Attribute handling requires reverse scanning. Given some piece of a pages contents, it is
difficult to determine its attributes. For instance, to determine the font used in a text
string, a plug-in must find the immediately preceding Tf (text state, font size) operator in
the stream.
The stream must be decoded. The page contents stream is typically encoded to
compress it, so it cannot be readily accessed by external programs.

What is PDFEdit?
PDFEdit provides an API to treat page contents as a list of objects whose values and
attributes can be modified. PDFEdit allows plug-ins to read, write, edit, and create page
contents and page resources, which may contain fonts, images, extended graphics states,
and so on. For details, see Section 3.7, Content Streams and Resources in the PDF
Reference. PDFEdit also provides mapping between document fonts and system fonts and
allows creating new page content objects.
PDFEdit offers these advantages:
PDFEdit objects are independent of each other. Each object encapsulates all the
relevant information about itself. A text object contains font attributes, for instance.
Your plug-in can use PDFEdit methods to modify the appearance of a page. It can
convert a pages content to a PDEContent (see PDFEdit Paradigm on page 358),
change the PDEContent, and then write it back to the page. Your plug-in also can
create pages from scratch.

PDFEdit Paradigm
PDFEdit converts page contents, XObjects, and charprocs to a PDEContent object for the
page. A PDEContent object contains a linear list of objects, which your plug-in can
manipulate or create from scratch. It can convert a PDEContent back to page contents
and resources, thus modifying the page. PDFEdit works with one page at a time.
The only effect of the ordering of objects in the display list is layering. Objects that occur
later in the display list can obscure earlier objects (or partially obscure them, with the
introduction in PDF 1.4 of transparency). There is no other meaning that the order provides.
For example, the fact that some text appears later in the list implies nothing about its
placement on the page.
When reading and modifying page display lists with PDFEdit, the resulting page stream
may be very different from the original. For example, there are many ways to represent the

358 Acrobat and PDF Library API Overview


PDFEdit LayerCreating and Editing Page Content
8
PDFEdit Classes

text drawn on a page. PDFEdit is not constrained by the representation used in the original
page stream. The resulting stream will, of course, have exactly the same visual
representation if a plug-in simply reads a pages contents and then writes the contents back
using PDFEdit methods.
PDFEdit works mainly with the page contents associated with the Contents key in the page
dictionary of a PDF file.

PDFEdit Classes
PDFEdit defines a set of classes to represent the contents and resources of a page.
Figure 8.1 shows the PDFEdit class inheritance hierarchy.
Like the other core API classes, these classes are implemented as C structures rather than
C++ classes.

Basic Classes
PDEObject is the base class of all PDFEdit objects.
A page display list is represented as a PDEContent object that contains PDEElement
objects. Each PDEElement object is a path, text, image, form, or a marked content place
or container of PDEElements. Objects in the PDEContent are listed in the pages
drawing order. Your plug-in can add or remove objects inside a PDEContent. It can also
change attributes of objects in a PDEContent, such as a bounding box, a text font, or a
clipping path.
Each PDEElement contains its state: colors, matrix, fonts, and clip. Each PDEElement is
independent of the others. Therefore, the display list does not need to be traversed to
determine an objects clip or matrix. An element can be moved or copied from one display
list to another without relying on or altering the neighboring elements.
A plug-in can attach information to PDEElements. This information is identified by a client
ID and a client-provided key or tag. Any PDEElement can be queried for its client ID and
tag.

Acrobat and PDF Library API Overview 359


PDFEdit LayerCreating and Editing Page Content
8
PDFEdit Classes

FIGURE 8.1 PDFEdit Classes

PDEContainer

PDEClip
PDEForm

PDEColorspace
PDEGroup

PDEContent
PDEImage
PDEDeviceN-
Colors
PDEPath
PDEObject
PDEElement
PDEPlace

PDEExtGState
PDEPS

PDEFont
PDESoftmask

PDEPattern
PDEText

PDEShading
PDEUnknown

PDEXGroup

PDEXObject

Several PDFEdit classes are container classes. A PDEContent is a list of the objects on a
page. A PDEContainer contains a set of PDEElements drawn on a page between
marked content operators. A PDEClip contains a set of path and text objects defining a
clipping path.

360 Acrobat and PDF Library API Overview


PDFEdit LayerCreating and Editing Page Content
8
PDFEdit Classes

NOTE: Since all PDFEdit classes derive from the PDEObject class, your plug-in can cast
any PDFEdit object as a PDEObject and use it with PDEObject methods.

PDEElement Classes
PDEElement is the base class of page elements. The following classes represent these
elements:

PDEContainer A container of PDEElements collected between marked content


BMC/EMC or BDC/EMC pairs.
PDEForm An XObject form. Forms are listed in page XObject resources. See
Section 3.7.2, Resource Dictionaries, in the PDF Reference for
details on the entries in a resource dictionary.
PDEGroup A container of PDEElements.

PDEImage An inline or XObject image. XObject images are listed in page


XObject resources.
PDEPath A path.

PDEPlace A place in the display list, marked by an MP or DP operator.

PDEPS A pass-through PostScript object.

PDESoftMask A reference to a Softmask object.

PDEText Text.

PDEUnknown An unknown element.

PDEXGroup A reference to an XGroup resource.

PDEXObject An arbitrary type of XObject

NOTE: Since these classes all derive from the PDEElement class, your plug-in can cast any
object in these classes as a PDEElement and use it with PDEElement methods.

PDEElement Attribute Classes


PDEElements can have attributes, represented by these classes:

PDEClip Container of PDEPath and PDEText objects describing paths


and charpaths.
PDEColorSpace Color space attribute of a PDEElement. Color spaces are listed
in page ColorSpace resources.

Acrobat and PDF Library API Overview 361


PDFEdit LayerCreating and Editing Page Content
8
Example

PDEExtGState Extended Graphics State attribute of a PDEElement. ExtGStates


are listed in page ExtGState resources.
PDEFont A font. Part of a texts font information is listed in page Font
resources.

Example
The following sample outlines how to add text and a path to a page using PDFEdit
methods.
/* Get contents object for a page */
PDDoc pdDoc = PDDocCreate();
PDPage pdPage = PDDocAcquirePage(pdDoc, 0);
PDEContent pdeContent = PDPageAcquirePDEContent(pdPage, clientID);

/* Set up some objects needed... */


/* Set up m as a transformation matrix */
ASFixedMatrix m;
...
/* Set up a graphics state */
PDEGraphicStateP gstateP;
...
/* Get a system font */
PDSysFont f;
...
/* Create text and font objects */
PDEText pdeText = PDETextCreate();
PDEFont pdeFont = PDEFontCreateFromSysFont(f, 0);

/* Add text to the end of the contents */


/* Create an array to hold the text to add */
ASUns8 hello[] = "Hello!";

PDETextAdd(pdeText, kPDETextRun, 0, hello, 6, pdeFont, &gstateP,


sizeof(gstateP), NULL, 0, &m, NULL);
PDEContentAddElem(pdeContent, kPDEAfterLast, (PDEElement)pdeText);
PDERelease(pdeText);

362 Acrobat and PDF Library API Overview


PDFEdit LayerCreating and Editing Page Content
8
Comparing PDFEdit to Other Core API Methods

/* Create a path and add it to contents */


Fixed pathData[6]; //array for path elements
pathData[0] = kPDEMoveTo; //moveto operator
pathData[1] = Int32ToFixed(10); // x
pathData[2] = Int32ToFixed(100); // y
pathData[3] = kPDELineeTo; //lineto operator
pathData[4] = Int32ToFixed(400); // x
pathData[5] = Int32ToFixed(100); // y
PDEPath pdePath = PDEPathCreate();
PDEPathSetPaintOp(pdePath, kPDEStroke);
PDEPathSetData(pdePath, pathData, 4*6);
PDEContentAddElem(pdeContent, kPDEAfterLast, (PDEElement)pdePath);
PDERelease(pdePath);

/* Put content back in page */


PDPageSetPDEContent(pdPage, clientID);
PDPageReleasePDEContent(pdPage, clientID);
PDPageRelease(pdPage);

Comparing PDFEdit to Other Core API Methods

Classes
PDFEdit has its own classes, distinct from the classes of objects used in a PDPage. For
instance, a PDEFont object is not a PDFont object.

Mapping Between PDF Operators and PDFEdit


In general, a sequence of PDF page marking operators creates the visible content of a page.
These operators may not be closely associated inside the stream.
For instance, each Tf (text state, font size) operator sets the font size and font used for the
subsequent Tj (text showing, show a text string) operator, which places a text string in a
pages contents until the next Tf operator. Thus, for any text string, theres a set of
associated attributes set by the Tf operator and other operators that affect text appearance.
The PDEText object corresponding to this text also has a set of attributes. However, these
attributes are get and set with PDEText methods rather than by manipulating a stream.
The PDF page marking operators that directly create marks on the page, such as Tj,
correspond to the PDFEdit methods that create objects, such as PDETextCreate. The
operators that determine how marks are placed on a page, such as Tf, correspond to the
PDFEdit methods that change an objects attributes, such as PDETextRunSetFont.

Acrobat and PDF Library API Overview 363


PDFEdit LayerCreating and Editing Page Content
8
Comparing PDFEdit to Other Core API Methods

Page Contents Stream and PDFEdit Object List Correspondence


Every page in a PDF file has a contents member, which is either a stream or an array of
streams. Without PDFEdit, your plug-in would access these streams through the ASStm
object methods in the core API; but as noted in Why PDFEdit? on page 357, the streams
are not easy to manipulate.
ASStm objects are not objects in the PDF file. They are abstractions that the core API uses
for reading, seeking, and so on.
PDFEdit converts these content streams to a PDEContent object, containing various
PDEElement objects in a list that represents the page content. The list objects can be
rearranged, removed, or added to. The objects in the list have attributes that may be
changed as well.
PDFEdit does not provide the ability to directly modify an existing page contents stream.
When a display list is converted back to a stream, an entirely new stream is written. It is not
possible to insert a stream of new bytes into, or remove a stream of bytes from, a stream
while leaving the rest of the stream unchanged.
PDFEdit does let your plug-in edit an existing pages contents stream. It makes a copy of the
page for editing. Then it replaces the existing page with the modified copy. Acrobat does
not know the difference. As far as it is concerned, the pages contents stream has been
updated.

Enumerating Page Objects


PDFEdit provides methods your plug-in can use to determine how many objects there are
on a page. The example code below shows how a plug-in can get the number of objects
and loop through them to obtain individual PDEElements. For each object, it can then
determine the object type.
See the Acrobat SDK Plug-in Guide for details on the complete plug-in example that this
code is part of.
numElems = PDEContentGetNumElems(pdeContent);
/* loop through elements to find text */
for (j = 0; j < numElems; j++)
{
ASFixedRect bbox;
AVRect rect;
pdeElement = PDEContentGetElem(pdeContent, j);
/* determine if the object is of type text */
if (PDEObjectGetType((PDEObject) pdeElement) == kPDEText)
...

NOTE: Two core PD layer methods were available in pre-4.0 Acrobat to describe the objects
in a page description, namely: PDPageEnumContents and
PDPageEnumResources. It is not recommended that you use either of these
methods in new plug-ins, as they cannot fully parse PDF files that are version 1.2 or
later.

364 Acrobat and PDF Library API Overview


PDFEdit LayerCreating and Editing Page Content
8
Comparing PDFEdit to Other Core API Methods

Using PDFEdit versus PDWordFinder


A PDWordFinder provides access to the PDWords of a PDPage. Given a PDWord, your
plug-in can
Find its position and character offset on a page
Find various attributes such as whether it has ligatures
Get a text representation of the word
However, your plug-in cannot alter PDWords or their placement on the page.
PDFEdit does not recognize PDWords. Instead, it deals with the text on a page represented
as PDEText objects. Your plug-in not only can get information about the text, but it can
alter text and its attributes, such as the font and position on the page.
When a PDPages contents are first converted to a PDEContent, a plug-in can map the
PDWords in a PDWord list to the characters in the PDEContent. After changing the
PDEContent, this direct mapping is lost. A plug-in can obtain a new PDWord list by
converting a PDEContent into the contents of a PDPage, and then calling
PDWordFinderAcquireWordList.
The design of PDFEdit assumes that characters and show stringsnot wordsare the
basic elements of a PDEText object. When a plug-in edits and creates text blocks, it must
be able to specify the location of each character to perform kerning and other character
placement operations. Having page display operations use words as a basic element is not
general enough in this situation.

Using PDFEdit Versus PDPageAddCosContents


PDPageAddCosContents completely replaces the contents of a specified page with
new contents. The new contents must be a Cos object, which your plug-in could get from
the Contents key of the page contents provided by the PDPageGetCosObj method.
However, the Cos object contains streams that are difficult to manipulate, as discussed in
Why PDFEdit? on page 357.
PDFEdit allows you to manipulate or add to the objects on a page, treating them as text,
path, image, form, XObject, and container objects.

Hit Testing
PDFEdit provides the ability to locate objects at a point. The PDEElementIsAtPoint
and PDEElementIsAtRect methods allow your plug-in to determine whether a point
or rectangle is on an element. PDETextIsAtPoint and PDETextIsAtRect provide
the same capability for text objects.
PDFEdit also allows your plug-in to specify exact placement on a page of text, graphics, and
path objects. If your plug-in knows where a user clicked on screen, it can convert the device
space coordinates to user space coordinates and determine which objects are beneath that
point.

Acrobat and PDF Library API Overview 365


PDFEdit LayerCreating and Editing Page Content
8
Using PDFEdit Methods

Using PDFEdit Methods

Reference Counting
All PDEObjects contain a reference count. The reference count is initialized to 1 when an
object is created. The count is also incremented when an object is added to another object,
such as a PDEContent, and is decremented when it is removed from an object. When the
reference count becomes 0, the object is freed and the reference to the object is no longer
valid.
A plug-in may explicitly increment or decrement the reference count of an object using the
PDEAcquire and PDERelease methods, respectively. When a plug-in no longer needs
an object, it should call PDERelease.
Objects should only be disposed of with PDERelease if the method by which they were
obtained incremented the reference count for the object. In general, methods that get an
object do not increment the reference count. As you recall from Core API Methods on
page 25, methods that increment the reference count typically contain the word acquire
or create in the method name and specifically state that your plug-in must release the
object in the method description.
All of the Create methods, including the PDEContentCreateFromCosObj method,
set the reference count to 1 on the newly created object.
When a plug-in adds an object to a container, that containers reference count is
incremented. When a containers reference count becomes 0, it releases all of its contained
objects. Typically, if an object is created and added to a container, a plug-in should call
PDERelease immediately after the add operation. The object then has a reference count
of 1 and will be destroyed when its container is destroyed.
Your plug-in should take care when removing an object from one container and adding it
to another. It should acquire the object before removing it from the container. Otherwise,
the containers reference count could reach 0 when your plug-in removes it. In this
situation, adding the object to another container would be illegal since the object would
be invalid.
The Get methods in the API do not change the reference count. However, a plug-in must
be careful not to hold an object it did not acquire for too long, since a subsequent remove
operation on its container could destroy the object.
The Set methods increment the reference count of the object whose attribute is set. For
example, the PDETextRunSetFont method increments the reference count of the font.
Furthermore, the reference count of the previous attribute object (the older font in this
example) is decremented.
The PDEGraphicsState attribute contains references to up to five objects:
Fill and stroke color spaces
Fill and stroke color objects (if the color space is Pattern)
The ExtGState

366 Acrobat and PDF Library API Overview


PDFEdit LayerCreating and Editing Page Content
8
Using PDFEdit Methods

(Some of these objects may be NULL.) The Get and Set rules apply to the component
references in this case.
A PDEObject may be contained or referenced by more than one PDEObject. This is
obvious in the case of resources such as fonts and color spaces. Other objects also may be
referenced multiple times. For example, a PDEElement may be contained in two
PDEContents.
The best approach a plug-in can take to reference counting is to:
Create its objects
Add the objects to a content object
Add the content object to a page
Release all the objects it created

Matrix Operations
Several PDEElements have matrixes associated with them.
PDFEdit flattens matrixes on input and output. When parsing a page content stream, it sets
the matrix of an element to the value of the current transformation matrix. When parsing a
path, the matrix is applied to the path segments. Thus, after parsing a page, paths have the
identity matrix, images contain the final image matrix, and text runs contain a single matrix
composed of the graphics state matrix, the text state matrix, and the text placement and
scaling operators.
The PDEElementSetMatrix method applies the matrix immediately to images;
PDETextRunSetMatrix applies the matrix immediately to text runs. The path matrix is
not applied to path segments until the page is emitted to a page content stream. After
emission, the path matrix is reset to the identity matrix. This operation is deferred because
it can be time consuming to apply the matrix to each path segment in a large path. Because
the matrix operation is deferred, a plug-in must always examine the path matrix when
processing path data.

Clip Objects and Sharing


A PDEClip object may be shared among multiple PDEElements. Therefore, care must be
taken when a plug-in changes the clip of an element, since modifying the clip of one
element can have the side effect of modifying the clip for multiple elements. If the clip for
only one element is to be changed, a plug-in should copy the clip object and apply the
modifications to the copy.

Marked Content
PDFEdit supports the marked content operators. These operators provide a mechanism for
attaching additional meaning to locations and to objects in a page content stream. For
details, see Section 10.5, Marked Content, in the PDF Reference. The PDEPlace object

Acrobat and PDF Library API Overview 367


PDFEdit LayerCreating and Editing Page Content
8
Using PDFEdit Methods

marks a location in a sequence of PDEElements. The PDEContainer object marks a


group of 0 or more PDEElements.
The PDEContainer contains a PDEContent, which itself contains the marked
PDEElements that constitute the markings on the page. Nested marked content
operators result in nested PDEContainers and PDEPlace objects.
When enumerating a PDEContent that contains marked content operators, it is necessary
for a plug-in to examine the PDEContainers to find all renderable PDEElements.

Cos Objects and Documents


Many of the PDEObjects contain a reference to a Cos object. Examples include PDEFont,
PDEForm, and some PDEColorSpace objects. In the current Cos implementation,
composite and indirect objects belong to a particular document. Cos objects cannot be
intermingled between documents. For example, a dictionary in one document cannot
contain a reference to an array in another document.
When a plug-in calls PDEContentToCosObj, it specifies a destination Cos document. If
the PDEContent contains references to Cos objects in a different document, PDFEdit
makes copies of the Cos objects in the destination document and refers to the copies.
Some of the PDFEdit Create methods can create a Cos object, such as
PDEFontCreateFromCosObj and PDEFormCreateFromCosObj. PDFEdit creates
these Cos objects in a scratch document that it maintains. This can result in unexpected
behavior from the GetCosObj methods. A method may return the original object from
which the PDEObject was instantiated, or it may return a copy of the Cos object in a
different document.

XObjects and PDEObjects


A Cos XObject resource (an image or a form) may occur more than once on a page. A
distinct PDEElement is created for each occurrence, but the PDEElements share the
underlying Cos object. Each PDEElement typically has a distinct matrix and graphic state.
When a PDEContent is written to a stream, multiple references to the Cos objects are
recognized such that all instances of an XObject are referred to by the same resource name.

Resources
In PDF, page content streams do not directly refer to Cos resources. Instead, they refer to
them by a name that is used to look up the Cos resource in the Resources dictionary. When
reading and writing streams in an existing document, PDFEdit tries to preserve the original
page resource names. When this is not possible, PDFEdit generates new names as required.
PDFEdit maintains a list of names and Cos objects for each open document to which any
PDFEdit operation has been performed. Every time a stream is generated, PDFEdit consults
the database. If no name exists for a Cos object, it generates a new name and adds the
name to the database. If a name exists but is already in use by another Cos object, it

368 Acrobat and PDF Library API Overview


PDFEdit LayerCreating and Editing Page Content
8
Guide to Page Creation

generates an alternative name. Thus, a single Cos object may be referenced by different
names in different page content streams.
For example, consider a document with two pages. Page 1 contains text set in Helvetica,
and the fonts page resource name is F1. Page 2 contains text set in Times-Roman, and the
fonts page resource name also is F1. Now, if a plug-in adds Helvetica text to page 2, it
cannot use the resource name F1, because F1 already refers to Times-Roman on this page.
Therefore, PDFEdit generates a new page resource name for the Helvetica added to page 2.
Each form (and Type 3 font) should contain a resources dictionary. It is the plug-ins
responsibility to put the resources dictionary in the forms attribute dictionary upon return
from the PDEContentToCosObj method when the PDEContent is a form.

Client Identifiers
Some methods such as PDEAddTag or PDPageAcquirePDEContent require a client
identifier (ID).
A plug-in should use its gExtensionID for the client ID.
NOTE: For the Adobe PDF Library, use a consistent value for the client ID throughout your
code; the value 0 is recommended.
When several plug-ins want to operate on the same page at the same time, they should use
a separate ID for each thread.

Guide to Page Creation


In general, a plug-in should use PDPageAcquirePDEContent to obtain a pages
PDEContent. The plug-in can modify the PDEContent with PDFEdit methods as
desired. Then it should put the PDEContent back on the page with
PDPageSetPDEContent and call PDPageReleasePDEContent after it is completely
done with the page.

Common Code Sequence


A plug-in can frequently use a sequence like this to get a pages contents, modify it, and put
it back:
PDEContent pdecontent;
PDPage pdpage;
ASBool result;
ASInt32 count;

/* Get pages contents */


pdecontent = PDPageAcquirePDEContent(pdpage, clientID);
/* Modify the contents */
...

Acrobat and PDF Library API Overview 369


PDFEdit LayerCreating and Editing Page Content
8
Guide to Page Creation

/* Put the contents back in the page */


result = PDPageSetPDEContent(pdpage, clientID);
/* Clean up */
count = PDPageReleasePDEContent(pdpage, clientID);
/* Release the page */
PDPageRelease(pdpage);

Ways To Modify a Pages Content


This section shows how to modify a pages content in various ways.
Sequence for Adding Text to a Page
/* Enumerate the system fonts. Look for font=FONTNAME */
/* The fontEnumProc callback looks for a font */

PDEFont gFont;
char buf[255];
PDEText pdeText = NULL;
PDETextState tState;
FixedMatrix matrix;
PDEFontAttrs textFontAttr;
PDEGraphicState gstate;

PDEnumSysFonts(fontEnumProc, (void *)FONTNAME);

/* If font found, proceed */


if (gFont) {
strcpy(buf, "Added text...");

/* Create a new PDEText object */


pdeText = PDETextCreate();
memset(&tState, 0, sizeof(PDETextState));

/* Set the text matrix to 24 pt type, v=300 pts, h=72 pts */


memset(&matrix, 0, sizeof(FixedMatrix));
matrix.a = Int16ToFixed(24);
matrix.d = Int16ToFixed(24);
matrix.v = Int16ToFixed(300);
matrix.h = Int16ToFixed(72);

/* Set the text attributes, including font name and type of font */
/* Type of font could be Type1, MMType1, or TrueType */

memset(&textFontAttr, 0, sizeof(textFontAttr));
textFontAttr.name = ASAtomFromString(FONTNAME);
textFontAttr.type = ASAtomFromString("Type1");

/* Set up the default Graphics state */


memset(&gstate, 0, sizeof(PDEGraphicState));
gstate.strokeColorSpec.space =

370 Acrobat and PDF Library API Overview


PDFEdit LayerCreating and Editing Page Content
8
Guide to Page Creation

gstate.fillColorSpec.space = pdeColorSpace;
gstate.miterLimit = fixedTen; /* constants */
gstate.flatness = fixedOne;
gstate.lineWidth = fixedOne;

/* Create PDEText object as a text run, */


/* and add to PDEContent */
PDETextAdd(pdeText, kPDETextRun, 0, (unsigned char *)buf,
strlen(buf), gFont, &gstate, sizeof(gstate), &tState,
sizeof(PDETextState), &matrix, NULL);

/* Add to end of contents */


PDEContentAddElem(pdecontent, kPDEAfterLast, (PDEElement)pdeText);

/* Release the PDEText object after it has been added */


PDERelease((PDEObject)pdeText);
}

Sequence for Adding a Path to a Page


/* Draw a filled rectangle */
PDEColorSpace pdeColorSpace;
PDEPath pdePath;
Fixed pathSeg[5];
PDEGraphicState gstate;

pdeColorSpace =
PDEColorSpaceCreateFromName(ASAtomFromString("DeviceGray"));

/* Draw a filled in rectangle */


pdePath = PDEPathCreate();
pathSeg[0] = kPDERect; /* rectangle */
pathSeg[1] = Int32ToFixed(72); /* x */
pathSeg[2] = Int32ToFixed(2*72); /* y */
pathSeg[3] = Int32ToFixed(3*72); /* width */
pathSeg[4] = Int32ToFixed(72); /* height */

PDEPathSetPaintOp(pdePath, kPDEFill);

/* Set up the default Graphics state */


memset(&gstate, 0, sizeof(PDEGraphicState));
gstate.strokeColorSpec.space = gstate.fillColorSpec.space =
pdeColorSpace;
gstate.miterLimit = fixedTen; /* constants */
gstate.flatness = fixedOne;

Acrobat and PDF Library API Overview 371


PDFEdit LayerCreating and Editing Page Content
8
Guide to Page Creation

gstate.lineWidth = fixedOne;

PDEElementSetGState((PDEElement) pdePath, &gstate, sizeof(gstate));


PDEPathSetData(pdePath, pathSeg, sizeof(pathSeg));

/* Add rectangle to end of PDEContent */


PDEContentAddElem(pdecontent, kPDEAfterLast, (PDEElement)pdePath);
/* Release the PDEPath object */
PDERelease((PDEObject)pdePath);

Sequence for Adding an Image to a Page


/* Create a simple bitmap graphic */
char* data;
PDEImageAttrs imageAttrs;
FixedMatrix matrix;
PDEColorValue pdeColorValue;
PDEColorSpace pdeColorSpace;
PDEImage pdeImage = NULL;

pdeColorSpace =
PDEColorSpaceCreateFromName(ASAtomFromString("DeviceGray"));

data = (char*)ASmalloc(sizeof(char)*10000);
if (data)
{
memset(&imageAttrs, 0, sizeof(PDEImageAttrs));
imageAttrs.flags = kPDEImageExternal;
imageAttrs.width = 100L;
imageAttrs.height = 100L;
imageAttrs.bitsPerComponent = 8L;

/* Fill in matrix for image. Offset it to v=500 pts, h=72 pts */


matrix.a = Int16ToFixed(100);
matrix.b = matrix.c = fixedZero;
matrix.d = Int16ToFixed(-100);
matrix.v = Int16ToFixed(500);
matrix.h = Int16ToFixed(72);

memset(&pdeColorValue, 0, sizeof(PDEColorValue));
pdeColorValue.color[0] = fixedZero;

/* Create stream for image data (you can also use a */


/* file stream or a proc stream) */

372 Acrobat and PDF Library API Overview


PDFEdit LayerCreating and Editing Page Content
8
Guide to Page Creation

memset(data, 0, 10000);
for (i = 0; i < 5000; i++)
data[i]=1;
stm = ASMemStmRdOpen(data, 10000L);

pdeImage = PDEImageCreate(&imageAttrs, (Uns32)sizeof(imageAttrs),


&matrix, 0, pdeColorSpace, &pdeColorValue, NULL, stm,
NULL, 0);

/* Add the image to end of PDEContent */


if (pdeImage)
{
PDEContentAddElem(pdecontent, kPDEAfterLast,
(PDEElement)pdeImage);
PDERelease((PDEObject)pdeImage);
}

/* Close the stream and free the image data */


if (stm)
ASStmClose(stm);
if (data)
ASfree(data);
}

Generating Efficient Pages


Create a PDPage before creating the PDEContent for it. Page notifications work better
this way.
Font Embedding and Subsetting
To author a document with an embedded system font, a plug-in must set the
kPDEFontCreateEmbedded flag when calling PDEFontCreateFromSysFont. This
causes the font to be embedded when first used in a document; no further work is required.
To author a document with an embedded and subsetted system font, a plug-in must set
both the kPDEFontCreateEmbedded and kPDEFontWillSubset flags when calling
PDEFontCreateFromSysFont. The font is embedded and given a subset name, but it
is not subsetted until later. The plug-in can then use characters from the font at will;
PDFEdit tracks which characters were actually emitted into each CosDoc via
PDEContentToCosObj. PDFEdit tracks character usage separately for each CosDoc in
which a font is used.
A plug-in eventually must call PDEFontSubsetNow on a font to subset it. The font is
subsetted to contain only the characters used in the PDEText objects that reference that
font. The plug-in should call PDEFontSubsetNow after it has set the content for the page.
Calling PDEFontSubsetNow on a font that was not created using the
kPDEFontWillSubset flag does nothing.
A font that is created using the kPDEFontCreateEmbedded flag is always embedded. A
plug-in does not need to call PDEFontSubsetNow if it sets the kPDEFontWillSubset

Acrobat and PDF Library API Overview 373


PDFEdit LayerCreating and Editing Page Content
8
Debugging Tools and Techniques

flag. In addition, it is possible for a plug-in to call PDEFontSubsetNow multiple times. The
subsetted data is rewritten with glyphs for any additional text used with the font.
A plug-in also can call PDEmbedSysFontForPDEFont to embed a system font,
including one for which kPDEFontWillSubset was specified. Therefore, the plug-in can
create a font with the kPDEFontWillSubset flag, and, at a later time, decide to leave
the font unembedded (by doing nothing), create the subset by calling
PDEFontSubsetNow, or embed the entire font by calling
PDEmbedSysFontForPDEFont.
Proper Use of Marked Content
Marked content allows a plug-in to identify, characterize, and organize a PDF file. For
instance, it may mark a set of paragraphs with style information. Similarly, a place in the
document may have information for looking up entries in a database. The structure that
marked content provides to a document can facilitate extracting data from a PDF file or
converting it to another file format. Structural information could be used by other
programs to implement PDF and Acrobat enhancements.
PDF marked content operators are used in page descriptions to indicate a part of the
stream that may be significant to an application other than a strict PDF consumer. These
operators attach a tag and, optionally, a property list, to part of the stream.
There are two kinds of marks, those that bracket a sequence of objects, and those that mark
a place in the stream. These operators may appear only between objects.
The BMC/EMC or BDC/EMC operators bracket an object sequence and correspond to the
PDEContainer, which contains a set of objects. This is useful for grouping objects that
belong together in some sense, defined by the document creator. Bracketed sequences
may be nested within each other, and thus a PDEContainer may contain other
PDEContainer objects.
Places are marked with either MP or DP operators. These correspond to the PDEPlace
object, which marks a place in the object list. Theoretically, your plug-in could bracket a
sequence of operators with a pair of related PDPlace objects, but this is not
recommended. Use the PDEContainer for enclosing a set of objects.
The BDC and DP operators take a property list dictionary argument; otherwise they
function identically to BMC and MP operators. Similarly, the PDEContainerCreate and
PDEPlaceCreate methods take an optional dictionary parameter, in addition to a tag for
the object. Use this dictionary to provide additional information about the
PDEContainer or PDEPlace, if needed.
For details on the marked content operators, see Section 10.5, Marked Content, in the PDF
Reference.

Debugging Tools and Techniques


Dump methods allow dumping objects and their attributes.

374 Acrobat and PDF Library API Overview


PDFEdit LayerCreating and Editing Page Content
8
Debugging Tools and Techniques

Object Dump
The PDEObjectDump enumeration method gets a text description of a given object.
Since objects can be nestedPDEContent objects can contain other objectsyour plug-
in specifies the nesting level for the children and attributes it wants to see. The
PDEObjectDumpProc callback specified in PDEObjectDump returns a buffer with text
describing each object.
The following example illustrates dumping a content object, pdecontent, to a file:
/* Dump the content object */
PDEContent pdecontent;
...
PDEObjectDump((PDEObject)pdecontent, 10,
ASCallbackCreateProto(PDEObjectDumpProc, myPDEObjectDumpProc),
NULL);
...
/* Dump callback function */
ACCB1 void ACCB2 myPDEObjectDumpProc(PDEObject pdeobject,
char* dumpInfo, void* clientData)
{
/* Output the data to a file */
FILE *f;

f=fopen(":PDEObjectDump.txt", "a");
if (f)
{
fprintf(f, "%s\n", dumpInfo);
fclose(f);
}
}
Here is a dump of a PDEContent object, showing its flags and number of elements,
among other information. It also includes the objects inside the PDEContent:
A path
An image
A text object
The number after the pound sign (#) is each objects reference count.
Content (0) #1 3a9d264
Content flags: none Num elems: 3

Path (2) #1 3a9d31c


Op: fill Size: 20 bbox 71 143 288 216
{
ColorSpace (9) #6 3a9d2fc
{DeviceGray }
fill: DeviceGray 0 0 0 0
Rect: 72 144 216 72
}

Acrobat and PDF Library API Overview 375


PDFEdit LayerCreating and Editing Page Content
8
Debugging Tools and Techniques

Image (3) #1 3a9dbec


CSpace: DeviceGray bbox 72 400 172 500

Text (1) #1 3a9dbac


Num elems: 1
{
font: 3a9e2cc
matrix: 24 0 0 24 72 300 bbox 67 294 256 323
fill: DeviceGray 0 0 0 0
This is a test.
}
The objects inside the PDEContent could also be dumped individually.
Dump Log
The PDELogDump methods PDEObjectDumpProc callback returns a buffer with text
describing each object that has been created. The text is in the object dump format noted
above.
Attribute Enumeration
The PDEAttrEnumTable method enumerates the shared resource objects, providing
their reference counts.
Reference Counts
Your plug-in can determine if any object has a non-zero reference count, that is, it has not
released the object.
After your plug-in has released a page, it should call PDEAttrEnumTable with an
enumeration function. The function is called back with every attribute object that has a
reference count greater than 0. The enumeration function provides an opaque pointer to
each object, which your plug-in can compare to the objects it created to check if it did not
release an object.
NOTE: Some objects, such as fonts, are allocated at initialization time and deallocated at
termination time, so some PDEObjects are left over after your plug-in completes
its processing of the PDF file and releases objects it created.

376 Acrobat and PDF Library API Overview


PDFEdit LayerCreating and Editing Page Content
8
PDFEdit Methods

PDFEdit Methods

Dump Methods
Dump methods allow enumerating objects and their attributes. An objects information
can be dumped in human readable form. An object dump includes its reference count,
which is useful in debugging reference count problems. The Dump methods include:

PDELogDump Enumerates PDEObjects.

PDEObjectDump Dumps an ASCII version of an object, its children, and


their attributes.
PDEAttrEnumTable Enumerates the table of attributes.

General Methods
These utility methods simplify tasks, such as setting up graphics information structures and
merging resources for a page. The General methods include the following:

PDEDefaultGState Fills out a structure with the default graphic state.

PDEEnumElements Enumerates all PDEElements in a given stream.

PDEMergeResourcesDict Merges two resources dictionaries.

PDEClip
A PDEClip is a list of PDEElements containing a list of PDEPaths and PDETexts that
describe a clipping state. PDEClips can be created and built up with PDEClip methods.
Any PDEElement object can have PDEClip associated with it by using the
PDEElementSetClip method. The PDEClip methods include the following:

PDEClipAddElem Adds an element to a clipping path.

PDEClipCopy Makes a deep copy of a PDEClip object.

PDEClipCreate Creates an empty clip object.

PDEClipFlattenedEnumElems For a given PDEClip, enumerates all of the


PDEElements in a flattened manner.
PDEClipGetElem Gets an element from a clip object.

Acrobat and PDF Library API Overview 377


PDFEdit LayerCreating and Editing Page Content
8
PDEColorSpace

PDEClipGetNumElems Gets the number of path and charpath elements


in a clip object.
PDEClipRemoveElems Removes one or more elements from a clip
object.

PDEColorSpace
A PDEColorSpace object is a reference to a color space used on a page. The color space
is part of the graphics state attributes of a PDEElement. See Sections 4.5, Color
Spaces, in the PDF Reference, for details on color spaces and color operators. The
PDEColorSpace methods include the following:

PDEColorSpaceCreate Creates a new color space object of the


specified type.
PDEColorSpaceCreateFromCosObj Creates a color space object from a Cos
object.
PDEColorSpaceCreateFromName Creates a new color space object.

PDEColorSpaceGetBase Obtains the name of the base color space.

PDEColorSpaceGetBaseNumComps Gets the number of components in the


base color space of an indexed color
space.
PDEColorSpaceGetCosObj Gets a Cos object for a color space.

PDEColorSpaceGetCTable Obtains component information for an


indexed color space.
PDEColorSpaceGetHiVal Gets the highest index for the color lookup
table for an indexed color space.
PDEColorSpaceGetName Gets the name of a color space object.

PDEColorSpaceGetNumComps Calculates the number of components in a


color space.

PDEContainer
A PDEContainer contains a group of PDEElements on a page. In the PDF file,
containers are delimited by the Marked Content operator pairs BMC/EMC or BDC/EMC.
Every PDEContainer has a Marked Content tag associated with it. In addition to
grouping a set of elements, a BDC/EMC pair specifies a property list to be associated with

378 Acrobat and PDF Library API Overview


PDFEdit LayerCreating and Editing Page Content
8
PDEContainer

the grouping. Thus a PDEContainer corresponding to a BDC/EMC operator pair also has
a property list dictionary associated with it.
For example, the following PDF marking operators would correspond to a PDEContainer
that contains several paths and has the tag PathABC:
\PathABC BMC
1 g
84.96 745.2 449.28 -9.596 ref
1 g
427.957 153.071 m
435.4 153.071 441.436 159.107 441.436 166.549
c
441.436 173.993 435.4 180.028 427.957 180.028
c
420.514 180.028 414.479 173.993 414.479
166.549 c
414.479 159.107 420.514 153.071 427.957
153.071 c
b
EMC
A PDEContainer is itself a PDEElement, so a PDEContainer can contain other
PDEContainer objects, which would reflect nested marked content operator pairs.
Marked content is useful for adding structure information to a PDF file. For instance, a text
processing program may have font and style information associated with a paragraph. You
may want to retain this information in the PDF file, and marked content provides a means
to do so.
See Section 10.5, Marked Content, in the PDF Reference, for information on marked
content and property lists.
A PDEPlace object allows marking a single point in a PDF file with information rather
than marking a group of objects.
The PDEContainer methods include:

PDEContainerCreate Creates a container object.

PDEContainerGetContent Gets the PDEContent for a PDEContainer.

PDEContainerGetDict Gets the marked content dictionary for a


container.
PDEContainerGetMCTag Obtains the marked content tag for a container.

PDEContainerGetXAPMetadata Gets the XMP metadata associated with a


PDEContainer.
PDEContainerSetContent Sets the content for a container.

PDEContainerSetDict Sets Marked Content dictionary for a


PDEContainer.

Acrobat and PDF Library API Overview 379


PDFEdit LayerCreating and Editing Page Content
8
PDEContent

PDEContainerSetMCTag Sets the Marked Content tag for a


PDEContainer.
PDEContainerSetXAPMetadata Sets the XMP metadata associated with a
PDEContainer.

PDEContent
The PDEContent object is the workhorse of the PDFEdit API, since it contains the
modifiable contents of a PDPage.
A PDEContent may be obtained from an existing page or from a form XObject or from a
Type 3 charproc. You can create an empty PDEContent. A PDEContent contains
PDEElements. In addition, a PDEContent may have attributes such as Form matrix and
setcachedevice parameters.
The simplest way to obtain the PDEContent for a page is with the
PDPageAcquirePDEContent method. After your plug-in modifies the content, it can
put it back in the page with PDPageSetPDEContent, using the same filters with which
the page was originally encoded.
Once your plug-in has the pages PDEContent, it can get, add, or remove elements with
PDEContent methods. It can modify individual page elements with the methods for
PDEElements, such as PDEText or PDEPath.
The PDEContent methods include:

PDEContentAddElem Inserts an element into a PDEContent.

PDEContentAddPage Adds the specfied PDPage to the


PDEContent as an XObject form.
PDEContentCreate Creates an empty content object.

PDEContentCreateFromCosObj Creates a content object from a Cos object.

PDEContentFlattenOC Flattens the content, removing any


PDEElements that are not visible in the
given optional-content context, and remov-
ing the optional-content information from
any visible PDEElements.
PDEContentGetAttrs Gets the attributes of a content.

PDEContentGetDefaultColorSpace Gets a default color space from a


PDEContent.
PDEContentGetElem Gets the requested element from a content.

380 Acrobat and PDF Library API Overview


PDFEdit LayerCreating and Editing Page Content
8
PDEDeviceNColors

PDEContentGetNumElems Gets the number of elements in a


PDEContent.
PDEContentGetResources Obtains the number of resources of a
specified type and, optionally, pointers to
the resource objects.
PDEContentRemoveElem Removes an element from a PDEContent.

PDEContentSetContainingStream Sets containing stream and owner stream


for any marked content reference handles
attached to containers within the content.
PDEContentSetPage Sets the page on which marked content is
drawn upon for any marked content refer-
ence handles attached to containers within
the content.
PDEContentSetStreamOwner Sets stream owner for any marked content
reference handles attached to containers
within the content.
PDEContentToCosObj Converts a PDEContent into PDF
contents and resources.

PDEDeviceNColors
A color space with a variable number of device-dependent components. Usually used to
store multiple spot colors in a single color space. The PDEDeviceNColors methods
include, for example:

PDEDeviceNColorsCreate Creates an object that can be used to store


n color components when in a
PDEDeviceNColors color space.
PDEDeviceNColorsGetColorValue Gets the value of a color component of a
PDEDeviceNColors color space.

PDEElement
PDEElement is the base class for elements of a page display list (PDEContent) and for
clip objects. The general PDEElement methods allow you to get and set general element
properties.

Acrobat and PDF Library API Overview 381


PDFEdit LayerCreating and Editing Page Content
8
PDEElement

PDEElement is an abstract superclass from which the PDEContainer, PDEForm,


PDEImage, PDEPath, PDEPlace, PDEText, and PDEXObject classes are derived. Your
plug-in can find the type of an element with the PDEObjectGetType method. It can
then cast and apply the methods in that class to the object. In addition, it can cast any
PDEElement subclass object to a PDEElement and use it anywhere a PDEElement is
called for, such as in PDEElement methods. The PDEElement methods include the
following:

PDEElementCopy Makes a copy of an element.

PDEElementGetAllVisibilities Tests whether all occurrences of the element


are visible in a given content and optional-
content context.
PDEElementGetBBox Obtains the bounding box for an element.

PDEElementGetClip Gets the current clip for an element.

PDEElementGetGState Obtains the graphics state information for an


element.
PDEElementGetMatrix Obtains the transformation matrix for an
element.
PDEElementGetOCMD Gets an optional-content membership
dictionary (OCMD) object associated with the
element.
PDEElementHasGState Gets the graphics state information for an
element.
PDEElementIsAtPoint Tests whether a point is on an element.

PDEElementIsAtRect Tests whether any part of a rectangle is on an


element.
PDEElementIsCurrentlyVisible Tests whether an element is visible in a given
content and optional-content context.
PDEElementMakeVisible Makes an element visible in a given content
and optional-content context, by manipulating
the ON-OFF states of the optional-content
groups.
PDEElementRemoveOCMD Dissociates an optional-content membership
dictionary (OCMD) object from the element.

382 Acrobat and PDF Library API Overview


PDFEdit LayerCreating and Editing Page Content
8
PDEExtGState

PDEElementSetClip Sets the current clip for an element. pdeEle-


ment's previous clip's reference count is decre-
mented (if it had one), and pdeClip's
reference count is incremented.
PDEElementSetGState Sets the graphics state information for an
element.
PDEElementSetMatrix Sets the transformation matrix for an element.

PDEElementSetOCMD Associates an optional-content membership


dictionary (OCMD) object with the element.

PDEExtGState
A PDEExtGState object is a reference to an ExtGState resource used on a page. It
specifies a PDEElements extended graphics state, which is part of its graphics state, as
specified in a PDEGraphicState structure. See Section 4.3.4 in the PDF Reference, for
information on extended graphics states.
// The graphics state controls the various style properties of the text
// including color, weight, and so forth.

memset (&gState, 0, sizeof(PDEGraphicState));


gState.strokeColorSpec.space = gState.fillColorSpec.space =
pdeColorSpace;
gState.miterLimit = fixedTen;
gState.flatness = fixedOne;
gState.lineWidth = fixedOne;
gState.extGState = pdeExtGState;
gState.wasSetFlags = kPDEMiterLimitWasSet | kPDEFlatnessWasSet |
kPDELineWidthWasSet | kPDEExtGStateWasSet;
You can get or set the graphics state associated with a PDEElement or PDEText
object with the PDEElementGetGState or PDEElementSetGState methods.

Setting the Opacity of an Object


With Acrobat 5.0 and PDF 1.4 and higher, every object has an opacity property (default is
opaque) in the extended graphics state. The code snippet below shows how to add the
opacity property to either existing or new elements:
DURING
pdeExtGState = PDEExtGStateCreateNew (PDDocGetCosDoc(pdDoc));
PDEExtGStateSetOpacityFill (pdeExtGState, FloatToFixed(0.5));
PDEExtGStateSetOpacityStroke (pdeExtGState, FloatToFixed(0.5));
HANDLER

Acrobat and PDF Library API Overview 383


PDFEdit LayerCreating and Editing Page Content
8
PDEExtGState

if (pdeExtGState) {
PDERelease ((PDEObject) pdeExtGState);
pdeExtGState = NULL;
}
END_HANDLER
For information on transparency, see Chapter 7 in the the PDF Reference.

PDEExtGState Methods
The PDEExtGState methods include the following:

PDEExtGStateAcquireSoftMask Acquires the soft mask of the extended graphic


state.
PDEExtGStateCreate Creates a new PDEExtGState from a Cos
object.
PDEExtGStateCreateNew Creates a new extended graphics state object.

PDEExtGStateGetAIS Specifies if the alpha is to be interpreted as a


shape or opacity mask.
PDEExtGStateGetBlendMode Sets the blend mode for the color composites
for each object painted.
PDEExtGStateGetCosObj Obtains a Cos object for a PDEExtGState.

PDEExtGStateGetOpacityFill Gets the opacity value for the fill of the


PDEElement.
PDEExtGStateGetOpacityStroke Gets the opacity value for the stroke of the
PDEElement.
PDEExtGStateGetOPFill Determines whether overprint is turned on for
the fill of the PDEElement.
PDEExtGStateGetOPM Gets the overprint mode.

PDEExtGStateGetOPStroke Returns whether overprint is enabled for stroke


painting operations.
PDEExtGStateGetSA Returns whether stroke adjustment is enabled
in the graphics state.
PDEExtGStateGetTK Returns whether text knockout is enabled in the
graphics state.
PDEExtGStateHasSoftMask Returns whether the graphics state contains a
soft mask.

384 Acrobat and PDF Library API Overview


PDFEdit LayerCreating and Editing Page Content
8
PDEFont

PDEExtGStateSetAIS Specifies if the alpha is to be interpreted as a


shape or opacity mask.
PDEExtGStateSetBlendMode Sets the blend mode for the color composites
for each object painted.
PDEExtGStateSetOpacityFill Sets the opacity value for fill operations.

PDEExtGStateSetOpacityStroke Sets the opacity value for stroke operations.


PDEExtGStateSetOPFill Specifies if overprint is enabled for painting
operations other than stroking.
PDEExtGStateSetOPM Sets the overprint mode. Corresponds to the
OPM key within the ExtGState's dictionary.
PDEExtGStateSetOPStroke Sets the overprint value for stroke operations.

PDEExtGStateSetSA Specifies whether stroke adjustment is enabled


in the graphics state.
PDEExtGStateSetSoftMask Sets the soft mask of the extended graphics
state.
PDEExtGStateSetTK Specifies whether text knockout is enabled in
the graphics state.

PDEFont
A PDEFont object is a reference to a font used on a page. It may be equated with a font in
the system. A PDEFont is not the same as a PDFont; a PDEFont is associated with a
particular document.
See Chapter 5 in the PDF Reference for information on fonts.
A PDSysFont object represents a system font and is a distinct object from a PDEFont.
You can create a PDEFont from a system font with the PDEFontCreateFromSysFont
method.

Acrobat and PDF Library API Overview 385


PDFEdit LayerCreating and Editing Page Content
8
PDEFont

Your plug-in can set the font of a text run with the PDETextRunSetFont method. The
PDEFont methods include the following:

PDEFontAddGlyphs Adds Glyphs to a PDEFont object for embedding a


PDEFont.
PDEFontCreate Creates a new PDEFont from specified parameters.

PDEFontCreateFromCosObj Creates a PDEFont corresponding to a Cos object.

PDEFontCreateFromSysFont Gets a PDEFont corresponding to a font in the


system.
PDEFontCreateFromSysFont Create a PDEFont from sysFont and sysEnc.
AndEncoding
PDEFontCreateFromSysFont Creates a PDEFont corresponding to a font in the
Ex system.

PDEFontCreateFromSysFont Used to obtain a PDEFont corresponding to a font


WithParams in the system.

PDEFontCreateToUnicodeNo This function creates the ToUnicode table.


w
PDEFontCreateWidthsNow This function creates width entries for font.

PDEFontCreateWithParams Creates a new PDEFont from parameters.

PDEFontEmbedNow This function embeds font stream.

PDEFontEmbedNowDontSubse Embeds the given PDEFont inside doc without


t creating a subset.

PDEFontGetAttrs Obtains the attributes for a font object.

PDEFontGetCosObj Obtains a Cos object for a PDEFont.

PDEFontGetCreateNeedFlag This function returns flags indicating what needs to


s be done to make PDEFont complete. kPDEFont-
CreateNeedWidths can be cleared by PDE-
FontCreateWidthsNow.
PDEFontGetNumCodeBytes Gets the number of bytes comprising the next code
in a string of single or multi-byte character codes.
PDEFontGetOneByteEncodin Gets an array of delta encodings for the given one
g byte PDEFont.

386 Acrobat and PDF Library API Overview


PDFEdit LayerCreating and Editing Page Content
8
PDEFont

PDEFontGetSysEncoding Gets the system encoding object associated with a


font object.
PDEFontGetSysFont Gets the system font object associated with a font
object.
PDEFontGetWidths Gets the widths for a font object.

PDEFontGetWidthsNow Gets a Type0 font's width information for only the


characters used in the file.
PDEFontIsEmbedded Tests whether a font is an embedded font in the
document in which it was created.
PDEFontIsMultiByte Tests whether a font contains any multi-byte
characters.
PDEFontSetSysEncoding Sets the system encoding object associated with a
font object.
PDEFontSetSysFont Sets the system font object to be used with a font
object that does not currently have a system font
associated with it.
PDEFontSubsetNow Subsets a PDEFont in a CosDoc.

PDEFontSumWidths Gets the sum to the widths of len characters from a


string of single or multi-byte characters.
PDEFontTranslateGlyphIds Translates a string to Unicode values.
ToUnicode

When creating a new PDEFont with PDEFontCreateWithParams, the PDEFont


may be represented as an embedded font (a FontFile value in PDF). To create a
PDEFont that will be stored as an embedded font, the FontFile stream may be passed
as fontStm, and the len1, len2, and len3 parameters contain the Length1, Length2,
and Length3 values of the FontFile. The caller must close the fontStm after calling this
PDEFontCreateWithParams. This method extends PDEFontCreate to support
multibyte fonts.

Acrobat and PDF Library API Overview 387


PDFEdit LayerCreating and Editing Page Content
8
PDEForm

PDEForm
A PDEForm is a PDEElement that contains a form XObject. Form XObjects are described
in Section 4.9, Form XObjects, in the PDF Reference. A PDEContent may be obtained
from a PDEForm to edit the forms display list. The PDEForm methods include:

PDEFormAcquireXGroup Acquires the transparency group dictionary of


the XObject form.
PDEFormCreateClone Creates a new form from an existing form object.

PDEFormCreateFromCosObj Creates a new form from a Cos object.

PDEFormGetContent Obtains a PDEContent object for a form.

PDEFormGetCosObj Obtains a Cos object from a form.

PDEFormHasXGroup Determines whether the XObject form has a


Transparency XGroup
PDEFormSetContent Sets the underlying CosStream of the form using
the specified content object.
PDEFormSetXGroup Sets the transparency group dictionary of the
form XObject.

PDEGroup
An in-memory representation of objects in a PDEContent. It has no state and is not
represented in any way in a PDF content stream (that is, PDEContent).
When used in a PDEClip, this object is used to associate PDEText objects into a single
clipping object. The PDEGroup methods include:

PDEGroupCreate Creates a PDEGroup object.

PDEGroupGetContent Gets the PDEContent for a PDEGroup.

PDEGroupSetContent Sets the PDEContent for a PDEGroup. The existing


PDEContent is released by this method.

PDEImage
A PDEImage is a PDEElement that contains an image XObject or inline image. Image
XObjects and inline images are described in the following sections in the PDF Reference:

388 Acrobat and PDF Library API Overview


PDFEdit LayerCreating and Editing Page Content
8
PDEImage

Section 4.1, Graphic Objects


Section 4.7, External Objects
Section 4.8.6, Inline Images
You can associate data or a stream with an image via PDEImageSetData and
PDEImageSetDataStm methods. PDEImage methods allow your plug-in to get and set
properties of images, such as the color space and filters. Additional PDEImage methods
include:

PDEImageAcquireImageFlate Acquires the PDEImageFlate resource of


the PDEImage content element when the
image filter type is FlateDecode or 0 if it
is not.
PDEImageAcquireImageJPX Acquires the PDEImageJPX resource of
the PDEImage content element when the
image filter type is JPXDecode or 0 if it is
not.
PDEImageCreate Creates an image object from a stream or
buffer of image data.
PDEImageCreateFromCosObj Creates an image object from a Cos object.

PDEImageDataIsEncoded Determines if image data is encoded.

PDEImageFlateAcquireColorSpace Acquires the color space of the flate image,


PDERelease should be used to release
the color space when it is no longer refer-
enced by the caller.
PDEImageFlateGetAttrs Gets the attributes of a flate image.

PDEImageFlateGetCosObj Gets a Cos object for an image.

PDEImageFlateGetDataStm Gets a data stream for a flate compressed


image, PDEImageFlate object.
PDEImageGetAttrs Obtains attributes for an image.

PDEImageGetColorSpace Gets the color space object for an image.

PDEImageGetCosObj Gets a Cos object for an image.

PDEImageGetData Gets an images data.

PDEImageGetDataLen Gets the length of data for an image.

Acrobat and PDF Library API Overview 389


PDFEdit LayerCreating and Editing Page Content
8
PDEImage

PDEImageGetDataStm Gets a data stream for an image.

PDEImageGetDecodeArray Gets the decode array from the attributes of


the image.
PDEImageGetFilterArray Obtains the filter array for an image.

PDEImageGetMatteArray Gets the matte array for the image XObject.

PDEImageGetSMask Gets the soft mask for an image.

PDEImageGetType Returns the type of image as FlateDe-


code, JPXDecode or Unknown when the
image filter is not one of these types.
PDEImageHasSMask Checks whether the image has a soft mask.

PDEImageIsCosObj Determines if an image is represented by a


Cos object.
PDEImageJPXAcquireColorSpace Acquires the PDEColorSpace associated
with the JPX encoded image, if one exists.
PDEImageJPXAcquireJPXColorSpace Acquires a link list of JPXColorSpace
objects defined with the JPX encoded
image.
PDEImageJPXAcquirePalette Acquires the JPXPalette from the JPX
image object
PDEImageJPXGetAttrs Gets the attributes of a JPX encoded
PDEImage.
PDEImageJPXGetCosObj Gets a Cos object for an image.

PDEImageJPXGetDataStm Returns a stream containing the image


data.
PDEImageJPXGetNumColorSpaces Returns the number of JPX color spaces
reference by the JPX encoded image.
PDEImageJPXHasPalette Returns true if the JPX encoded image has a
JPX palette.
PDEImageSetColorSpace Sets the color space of the image.

PDEImageSetData Sets data for an image.

PDEImageSetDataStm Sets a data stream for an image.

PDEImageSetDecodeArray Sets the decode array of an image.

390 Acrobat and PDF Library API Overview


PDFEdit LayerCreating and Editing Page Content
8
PDEObject

PDEImageSetMatteArray Sets the matte array for the image XObject.

PDEImageSetSMask Sets the soft mask.

PDEObject
PDEObject is the abstract superclass of PDFEdit classes. You can find the type of any
object with the PDEObjectGetType method. You can then cast and apply that class
methods to the object. In addition, you can cast any of the PDFEdit objects to a
PDEObject and use it anywhere a PDEObject is called for, such as in the PDEObject
methods. PDEAcquire and PDERelease increment and decrement the reference
counts of a PDEObject.
PDEObject methods include:

PDEAcquire Increments the reference count for an object.

PDEAddTag Adds an identifiervalue pair to an object.

PDEGetTag Obtains an objects value for a given client ID.

PDEObjectDump The object, its children and attributes are dumped.

PDEObjectGetType Gets the type of an element.

PDERemoveTag Removes an objects value for a given client ID.

PDEPath
A PDEPath is a PDEElement that contains a path. It can have fill and stroke attributes. It
also has graphics state attributes. The shape of a PDEPath can be used to represent a
clipping path.
The PDEPath methods allow constructing a path from segments and setting its fill and
stroke attributes. PDEPath methods include:

PDEPathAddSegment Adds a segment to a path.

PDEPathCreate Creates an empty path element.

PDEPathGetData Obtains size of path data and, optionally, path data.

PDEPathGetPaintOp Gets the fill and stroke attributes of a path.

PDEPathSetData Sets new path data for a path element.

Acrobat and PDF Library API Overview 391


PDFEdit LayerCreating and Editing Page Content
8
PDEPattern

PDEPathSetPaintOp Sets fill and stroke attributes of a path.

PDEPattern
A PDEPattern is a reference to a pattern resource used on a page. See Section 4.6 in the
PDF Reference, for information on patterns. PDEPath methods include:

PDEPatternCreate Creates a pattern object.

PDEPatternGetCosObj Obtains a Cos object corresponding to a pattern object.

PDEPlace
A PDEPlace is a PDEElement that marks a place on a page. In a PDF file, a place is
represented by the MP or DP marked content operators.
See Section 10.5, Marked Content, in the PDF Reference, for information on marked
content.
A PDEPlace object allows marking a particular group of objects in a PDF file, rather than
a place, with information.
PDEPlace methods include:

PDEPlaceCreate Creates a place object.

PDEPlaceGetDict Obtains the marked content dictionary for a PDEPlace.

PDEPlaceGetMCTag Gets the Marked Content tag for a PDEPlace.

PDEPlaceSetDict Sets the Marked Content dictionary for a PDEPlace.

PDEPlaceSetMCTag Sets the marked content tag for a PDEPlace.

PDEPS
A PDEPS is a pass-through PostScript object. PDEPS methods include:

PDEPSCreate Creates a PDEPS object.

PDEPSCreateFromCosObj Creates a PDEPS object from a CosObj object.

PDEPSGetAttrs Returns a PDEPS objects attributes.

392 Acrobat and PDF Library API Overview


PDFEdit LayerCreating and Editing Page Content
8
PDEShading

PDEPSGetData Gets all or part of the image data.

PDEPSGetDataStm Gets a stream for the data.

PDEPSSetData Sets the data for a PDEPS object.

PDEPSSetDataStm Sets a stream for the data.

PDEShading
A PDEShading is a PDEElement that represents smooth shading. PDEShading
methods include:

PDEShadingCreateFromCosObj Creates a smooth shading object.

PDEShadingGetCosObj Gets the CosObj for a PDEShading.

PDESoftMask
A PDESoftMask is a reference to a SoftMask resource used to support transparency.
PDESoftMask methods include:

PDESoftMaskAcquireForm Acquires the XObject form of the soft


mask.
PDESoftMaskCreate Creates a new soft mask object.

PDESoftMaskCreateFromCosObj Creates a new soft mask object from its Cos


representation.
PDESoftMaskCreateFromName Create a new soft mask from a name.

PDESoftMaskGetBackdropColor Gets the array of color values of the


backdrop color.
PDESoftMaskGetCosObj Gets the associated CosObj of the soft
mask.
PDESoftMaskGetName Gets the soft mask name.

PDESoftMaskGetTransferFunction Gets the transfer function as a CosObj.

PDESoftMaskSetBackdropColor Sets the backdrop color values.

PDESoftMaskSetTransferFunction Sets the transfer function associated with


the soft mask.

Acrobat and PDF Library API Overview 393


PDFEdit LayerCreating and Editing Page Content
8
PDEText

PDESoftMaskSetXGroup Sets the PDEForm that defines the soft


mask.

PDEText
A PDEText object is a PDEElement that represents text. It is a container for text as show
strings or as individual characters. Each subelement may have different graphics state
properties. However, the same clipping path applies to all sub-elements of a PDEText.
Also, the charpath of a PDEText object can be used to represent a clipping path.
Text consists of text runs, which are runs of characters in a PDF file with the same attributes.
For instance, the text in the string before a Tj operator would constitute a text run or part of
a text run. PDFEdit combines text from multiple Tj operators into a single text run, when
possible.
NOTE: All text is in text runs. Its possible for a text run to be a single character.
Many PDEText methods take an index parameter to indicate a text position. These
methods also take a PDETextFlags parameter to indicate whether a plug-in is accessing
the text by characters or by text runs. If the plug-in uses the kPDETextChar flag, the
index is the character offset from the beginning of the text element. This lets a plug-in
ignore the fact that the PDEText consists of text runs. If a plug-in uses the kPDETextRun
flag, the index is the index of the text run in the text element. Accessing text by text run is
faster than accessing text a character at a time.
A plug-in can get and set attributes (such as the font or text matrix) of a PDEText object
with PDEText methods. PDEText methods include:

PDETextAdd Adds a character or text run to a PDEText object.

PDETextAddGlyphs Adds Unicode text to a PDEText object.

PDETextAddItem Adds a text item to a text element at a given index


position.
PDETextCreate Creates an empty text object.

PDETextGetAdvance Gets the advance width of a character or a text


element.
PDETextGetAdvanceWidth Gets the advance width of a character or a text
element.
PDETextGetBBox Obtains the bounding box of a character or text
run.
PDETextGetFont Gets the font for a text character or element.

394 Acrobat and PDF Library API Overview


PDFEdit LayerCreating and Editing Page Content
8
PDEText

PDETextGetGState Obtains the graphics state of a character or text


run.
PDETextGetItem Obtains a text item from a text element at a given
index position.
PDETextGetMatrix Returns the matrix of a character or a text element.

PDETextGetNumBytes Gets the number of bytes occupied by the


character code or text run.
PDETextGetNumChars Obtains the number of characters in a text object.

PDETextGetNumRuns Gets the number of text runs (show strings) in a


text object.
PDETextGetQuad Gets the quad bounding the specified text run or
character.
PDETextGetRunForChar Gets the index of the text run that contains the nth
character in a text object.
PDETextGetState Returns the text state of a character or a text
element.
PDETextGetStrokeMatrix Gets the stroke matrix of a character or a text run.

PDETextGetText Gets the text for a text run or character.

PDETextGetTextMatrix Gets the matrix of a character or a text run.

PDETextGetTextState Obtains the text state of a character or text run.

PDETextIsAtPoint Tests whether a point is on specified text.

PDETextIsAtRect Tests whether any part of a rectangle is on the


specified text.
PDETextRemove Removes characters or text runs from a text object.

PDETextRemoveItems Removes contiguous text items from a text


element starting at a given index position.
PDETextReplaceChars Replaces characters in a text item.

PDETextRunGetCharOffset Obtains the character offset of the first character of


a text run.
PDETextRunGetNumChars Gets the number of characters in a text run.

PDETextRunSetFont Sets the font of a text run.

PDETextRunSetGState Sets the graphics state of a text run.

Acrobat and PDF Library API Overview 395


PDFEdit LayerCreating and Editing Page Content
8
PDETextItem

PDETextRunSetMatrix Sets the matrix of a text run.

PDETextRunSetState Sets the text state of a text run.

PDETextRunSetStrokeMatrix Sets the stroke matrix of a text run.


PDETextRunSetTextMatrix Sets the text matrix of a text run.

PDETextRunSetTextState Sets the text state of a text run.

PDETextSplitRunAt Splits a text run into two text runs.

PDETextItem
A PDETextItem is a PDEElement representing a text object. PDETextItem methods
include:

PDETextItemCopyText Copies the text from a text item element into a


character buffer.
PDETextItemCreate Creates a text item element containing a
character or text run, which can be added to a
PDEText object.
PDETextItemGetFont Gets the font for a text item.

PDETextItemGetGState Gets the graphics state for a text item.

PDETextItemGetTextLen Gets the text length for a text item.

PDETextItemGetTextMatrix Gets the text matrix for a character in a text


item.
PDETextItemGetTextState Gets the text state of a text item.

PDETextItemRemoveChars Removes contiguous characters from a text


item.
PDETextItemReplaceChars Replaces characters in a text item.

PDETextItemReplaceText Replaces all of the text in a text item.

PDETextItemSetFont Sets the font for a text item.

PDETextItemSetGState Sets the graphics state for a text item.

PDETextItemSetTextMatrix Sets the text matrix for a text item.

PDETextItemSetTextState Sets the text state for a text item.

396 Acrobat and PDF Library API Overview


PDFEdit LayerCreating and Editing Page Content
8
PDEUnknown

PDEUnknown
A PDEUnknown is a PDEElement representing an unknown element. The
PDEUnknownGetOpName method gets the operator name of an unknown operator.

PDEXGroup
A PDEXGroup is a reference to an XGroup resource used to support transparency.
PDEXGroup methods include, for example:

PDEXGroupAcquireColorSpace Acquires the color space of the transparency


group.
PDEXGroupCreate Create a new XGroup of the given type (must be
kPDEXGroupTypeTransparency).
PDEXGroupCreateFromCosObj Creates a new XGroup object from its Cos
representation.
PDEXGroupGetCosObj Gets the CosObj of the transparency group.

PDEXGroupGetIsolated Gets the isolated boolean value of the


transparency group.
PDEXGroupGetKnockout Gets the knockout boolean value of the
transparency group.
PDEXGroupSetColorSpace Sets the PDEXObject that defines the color
space into which colors are converted when
painted into this group.
PDEXGroupSetIsolated Sets the XGroup to be isolated or not.
Corresponds to the I key within the XGroup's
dictionary.
PDEXGroupGetKnockout Gets the knockout boolean value of the
transparency group.

Acrobat and PDF Library API Overview 397


PDFEdit LayerCreating and Editing Page Content
8
PDEXObject

PDEXObject
A PDEXObject object is a PDEElement representing an arbitrary XObject. See Section
4.7, External XObjects, in the PDF Reference, for information on XObjects. PDEXObject
methods include:

PDEXObjectCreate Creates a new PDEXObject from a Cos


object.
PDEXObjectGetCosObj Gets a Cos object corresponding to a PDEXObject.

NOTE: Use the appropriate methods for PDEForm and PDEImage objects. Do not use
PDEXObject methods.

PDSysEncoding
A PDSysEncoding is a subclass of PDEElement that provides system encoding for a
PDF file. PDSysEncoding methods include:

PDSysEncodingCreateFromBaseName Create an encoding object from base


name.
PDSysEncodingCreateFromCMapName Create an encoding object from a PDF
CMap name.
PDSysEncodingCreateFromCodePage Create an encoding object from a code
page.
PDSysEncodingGetWMode Returns the writing mode (0 for
horizontal writing; 1 for vertical).
PDSysEncodingIsIdentity Returns true for Identity-H or
Identity-V encoding; false otherwise.
PDSysEncodingIsMultiByte Returns true for CMap encoding;
false otherwise.

PDSysFont
A PDSysFont is a reference to a font installed on the host system. PDSysFont methods
allow your plug-in to list the fonts available on the host system and to find a font on the
system that matches a PDEFont, if it is present.

398 Acrobat and PDF Library API Overview


PDFEdit LayerCreating and Editing Page Content
8
PDSysFont

The PDSysFont and PDEFont classes are distinct. Your plug-in can create a PDEFont
from a system font with the PDEFontCreateFromSysFont method. It can determine
what system fonts are available using the PDEnumSysFonts and PDFindSysFont
methods.
PDSysFont methods include:

PDEnumSysFonts Enumerates all the system fonts.

PDFindSysFont Finds the system font that matches given attributes.

PDSysFontAcquirePlatformData Acquires platform-specific data for use by user


interface code.
PDSysFontGetAttrs Obtains the attributes of a system font.

PDSysFontGetCIDSystemInfo Derives the registry, ordering, and supplement


information of a multi-byte system font.
PDSysFontGetCreateFlags This function returns a createFlags that can be
passed to
PDEFontCreateFromSysFontAndEncoding.
PDSysFontGetEncoding Obtains encoding of single byte encoded system
font.
PDSysFontGetInfo Derives the registry, ordering, and supplement
information of a multi-byte system font.
PDSysFontGetName Obtains the PostScript or TrueType styled name for
a system font.
PDSysFontGetType0Widths Gets width information from a Type 0 system font.

PDSysFontGetWidths Gets the widths of a single byte encoded system


font.
PDSysFontGetWidthsEx Gets the widths of a single byte encoded system
font.
PDSysFontReleasePlatformData Releases platform-specific data for the specified
PDSysFont.
PDSysFontVerifyEncoding Similar to PDSysFontGetCreateFlags but
avoids compatibility issues with changing PDSys-
FontGetCreateFlags.

Acrobat and PDF Library API Overview 399


PDFEdit LayerCreating and Editing Page Content
8
PDSysFont

400 Acrobat and PDF Library API Overview


9 PDSEdit LayerCreating and
Editing Logical Structure

Introduction
PDF files are well known for representing the physical layout of a document; that is, the
page markings that comprise the page contents. In addition, PDF versions 1.3 and beyond
provide a mechanism for describing logical structure in PDF files. This includes information
such as the organization of the document into chapters and sections, as well as figures,
tables, and footnotes.
Further, PDF 1.4 and Acrobat 5 introduced tagged PDF, which is a particular use of
structured PDF that allows page content to be extracted and used for various purposes
such as reflow of text and graphics, conversion to file formats such as HTML and XML, and
accessibility to the visually impaired.
This chapter describes how to create and access structure information in a PDF document.
The PDSEdit methods in the core API provide access to this capability.
To use PDSEdit effectively in the plug-ins you write, you should understand how logical
structure is represented in a PDF file. For details, see Section 10.6, Logical Structure, in the
PDF Reference.

Why Have Logical Structure?


Text on a page might clearly represent a paragraph or section to a reader, but prior to PDF
1.3 nothing in a PDF file represented such elements. When the original application
generated the PDF file, information on the structure of a documents content was lost. A
PDF file could not distinguish paragraphs nor readily store paragraph style information.
Similarly, the core API prior to Acrobat 4.0 provided no way to extract paragraphs or other
such text structures from a PDF file. The only text objects obtainable at the time were:
Words and text selections, using PDWord and PDTextSelect object methods
provided in the PD layer of the core API.
Text on a page, using PDEText object methods in the PDFEdit API (described in
Chapter 8).
It became increasingly important for users be able to access the meta-information in the
PDF document itself, without going to the original document and application--key reasons
to have a portable document format in the first place.
Figure 9.1 illustrates the relationship of some structural elements on a document page. It
shows a structure hierarchy, namely, an article containing two paragraphs (P) and a
drawing. The PDSEdit methods provide the ability to represent this logical structure.

Acrobat and PDF Library API Overview 401


PDSEdit LayerCreating and Editing Logical Structure
9
Logical Structure in a PDF Document

FIGURE 9.1 Structure in a Document

asdflkjljasldfjljlajsdfljljlajsdlfjlja;sjdf;j;lj
P asdlfkjljasdflkjl;jasdlfjljasldjfljlasjdfljljadsf
alkjasdflkjljasdfljljasldfjljlasjdfljljalsdjfljlasdf
asdflkjljasdflkjlajsdljlajsdflkjlkjasdfljljasdf

asdfljasdfjlkjasdfljl;kjwoiulkajdlknlvaoijsd
lkasdflk;joiwlknbnsdoinowoinoinodinoisiolkclkjsf
lkasdlknboijasldfnlkansduojsdflnalsnfoiusdn
sdfoiulknaslnvaoinolnfdoisadfjlkasdfljljasdlfkjljas
asdfoioasfd
Article P asdoioiuasdf

sdfoijosdfjoijoasdifjoijojsaofdjoj

asdlfkjqwoeinblknalskdfjlkajsdflkjl
asdflkjlasdflkjasdf
Drawing asdflkjljasdflkjlkjasdlfkj
asdflkjljasdflkjlajsdflkjaslkdj

Other motivations behind PDF structure are:


Accessibility for the sight-impaired to PDF documents. Readability of a document is
considerably enhanced if cues are provided indicating the beginning and end of
paragraphs or other natural groupings that the sighted take for granted. Structure
information can indicate what is part of the content and what can be ignored. It can
describe in words what a diagram shows.
Metadata (data about the data), which is useful for purposes such as:
Tracking history to indicate document revisions
Tracking intellectual property
Associating private data embedded in a PDF document with its content.
Reflow of text and graphics.
The following sections explain how logical structure is provided.

Logical Structure in a PDF Document


PDF logical structure is layered on top of a documents page contents using a special
markup language. HTML and XML use a similar layout for logical structure: text enclosed in
a hierarchy of tags. In HTML, each component is wrapped with a set of tags that define its
structure. For example, the text of a top-level header begins with a <h1> tag and ends with
a </h1> tag. PDF provides similar constructs with its msarked content operators.

402 Acrobat and PDF Library API Overview


PDSEdit LayerCreating and Editing Logical Structure
9
Logical Structure in a PDF Document

In fact, HTML logical structure can be preserved in a PDF document. The Web Capture
feature introduced in Acrobat 4.0 allows converting HTML to PDF. Such PDF may optionally
contain structure information from the HTML data. Acrobat 4.0 can generate bookmarks
from this structure data.

The Structure Tree


Logical structure is independent of, though related to, the page content (that is, the actual
marks on the page made by the marking operators).
In a PDF document, logical structure is represented by a tree of elements called a structure
tree. There are pointers from the logical structure to the page contents, and vice versa. The
structure tree provides additional capability to navigate, search, and extract data from PDF
documents. By accessing a PDF document via its structure tree, for instance, you can obtain
logically ordered content independently of the drawing order of the page contents.

Navigating a PDF Document


PDSEdit methods allow navigation of a document according to its structure. Bookmarks
made from structure can go to an individual paragraph or a whole section, rather than just
to a point on a page. PDSEdit also allows searching within structure elemens, for example
searching for a word within elements of a certain type, such as headings. It can be used to
move around a document, to analyze its content, and to traverse its hierarchical structure.

Extracting Data From a PDF Document


The PDSEdit API allows you to extract portions of pages according to their context, such as
all of the headings or tables. The extracted data can be used in different ways, such as
summarizing document information, importing the data into another document, or
creating a new PDF document.

Adding Structure Data To a PDF Document


Authoring applications create documents that can be converted to PDF. When the
document is converted to PDF and viewed, Acrobat does not automatically add structure
to the document.
You can add structural information to any PDF file with the PDSEdit API. Once a file has
logical structure, PDSEdit allows you to use it.

Using pdfmark to Add Structure Data to PDF


Authoring applications may add structure pdfmarks to the PostScript language code
generated when a document is printed. When the Acrobat Distiller application creates a
PDF file from such PostScript code, it generates structure information in the PDF file from

Acrobat and PDF Library API Overview 403


PDSEdit LayerCreating and Editing Logical Structure
9
PDSEdit Classes

the pdfmarks. This approach requires the authoring application to add structure pdfmarks
to the PostScript code it generates, or for some other application to generate the pdfmarks.
See the pdfmark Reference for more information.

PDSEdit Classes
PDSEdit is organized around a set of classes representing structure components.

PDSTreeRoot
All logical structure information is in the structure tree, and the PDSTreeRoot is its root.
There is at most one PDSTreeRoot in each document. PDSTreeRoot methods include:

PDSTreeRootCreateClassMap Creates a PDSClassMap in a structure tree root. .

PDSTreeRootCreateRoleMap Creates and sets a PDSRoleMap of a tree root.

PDSTreeRootGetClassMap Gets the PDSClassMap object for the specified


structure tree root.
PDSTreeRootGetElementFromID Gets the element associated with the given ID, if
any.
PDSTreeRootGetKid Gets the child at an array index in a structure tree
root.
PDSTreeRootGetNumKids Gets the number of kids of the structure tree root.

PDSTreeRootGetRoleMap Gets the PDSRoleMap object for the specified


structure tree root.
PDSTreeRootInsertKid Inserts the specified kid element after the given
position as a kid of the specified structure tree
root.
PDSTreeRootRemoveClassMap Removes the PDSClassMap of the specified
structure tree root element.
PDSTreeRootRemoveKid Removes the specified kid element from the
specified structure tree root.
PDSTreeRootRemoveRoleMap Removes the PDSRoleMap of the specified
structure tree root element.
PDSTreeRootReplaceKid Replaces structural element oldKid with
element newKid as a kid of treeRoot.

404 Acrobat and PDF Library API Overview


PDSEdit LayerCreating and Editing Logical Structure
9
PDSEdit Classes

PDSTreeRootReplaceStreamRef Updates the stream entries (Stm) in marked con-


tent reference dictionaries to reference a new Cos
stream object.

PDSElement
PDSElement is the basic building block of the structure tree. It represents PDF structural
elements, which are nodes in a tree, defining a PDF documents logical structure.
PDSElement methods include:

PDSElementAddAttrObj Associates an attribute object with an


element at the elements current
revision value.
PDSElementAddClass Adds a class name to the element's list
of classes to which it belongs at the ele-
ment's current revision value.
PDSElementClearID Removes an element's ID, if it exists.

PDSElementCreate Creates a new (but empty)


PDSElement.
PDSElementEnumKidsWithUserProperties Enumerates PDSElements beneath
the supplied PDSElement that have
user properties attributes/classes.
PDSElementEnumUserPropertiesAsASText Enumerates the PDSElements user
properties by traversing the list of
attribute objects and class objects, call-
ing the caller-supplied procedure for
each entry in the properties array.
PDSElementEnumUserPropertiesAsCosObj Enumerates the PDSElements user
properties by traversing the list of
attribute objects and class objects, call-
ing the caller-supplied procedure for
each entry in the properties array.
PDSElementFindAncestorWithUserProper Starting at the supplied structure ele-
ties ment, this procedure follows the chain
of parents (see PDSElementGetPar-
ent) until a structure element is found
that has user properties.

Acrobat and PDF Library API Overview 405


PDSEdit LayerCreating and Editing Logical Structure
9
PDSEdit Classes

PDSElementGetActualText Gets the actual text associated with the


specified PDSElement.
PDSElementGetAlt Gets the alternate text associated with
an element.
PDSElementGetAttrObj Gets the attribute object at a specified
array index in the specified element.
PDSElementGetClass Gets the class name of an element.

PDSElementGetCosObj Gets the Cos object corresponding to


the specified element object.
PDSElementGetFirstPage Gets the Cos object for the page of the
first kid of the element.
PDSElementGetID Gets the ID of an element or
CosObjNull if there is no ID set.
PDSElementGetKid Gets the kid at an array index in the
specified element.
PDSElementGetKidEx Functions identically to PDSElement-
GetKid, but for children that are
marked contents can return the mcid as
well as or instead of the actual object.
PDSElementGetKidWithMCInfo Functions identically to PDSElement-
GetKid, but for children that are
marked contents can return the mcid as
well as or instead of the actual object.
PDSElementGetLanguage Gets the language associated with the
specified PDSElement.
PDSElementGetNumAttrObjs Gets the number of attribute objects
directly attached to the specified
element.
PDSElementGetNumClasses Gets the number of classes to which the
specified element belongs.
PDSElementGetNumKids Gets the number of kids of the specified
element.
PDSElementGetParent Gets the immediate ancestor element of
the specified element in the tree.
PDSElementGetRevision Gets the revision number of an element.

406 Acrobat and PDF Library API Overview


PDSEdit LayerCreating and Editing Logical Structure
9
PDSEdit Classes

PDSElementGetStructTreeRoot Gets the structure tree root of the


document containing element.
PDSElementGetTitle Gets the title of the specified element,
returning the number of bytes in the
title.
PDSElementGetType Gets the elements structural element
type.
PDSElementHasActualText Tests whether ActualText is defined for a
given PDSElement.
PDSElementHasAlt Tests whether Alt text is defined for a
given PDSElement.
PDSElementHasLanguage Tests whether a language string is
defined for a given PDSElement.
PDSElementHasUserProperties Returns true if the PDSElement has
attribute objects or class objects with
owner of UserProperties.
PDSElementIncrementRevision Increments an element's revision count
by one.
PDSElementInsertKid Inserts the specified kid PDSElement
object into the specified element after
position insertAfter.
PDSElementInsertMCAsKid Inserts a reference to the specified
PDSMC (marked content) in the speci-
fied element after position inser-
tAfter.
PDSElementInsertMCAsKidEx Extends PDSElementInsertM-
CAsKid, inserting content that is in a
stream other than a page content
stream.
PDSElementInsertMCRefAsKid Takes a marked content reference and
places the content that it identifies in
the structure as a child of the element.
PDSElementInsertOBJAsKid Inserts a reference to the specified PDF
object as a kid into the specified
element.

Acrobat and PDF Library API Overview 407


PDSEdit LayerCreating and Editing Logical Structure
9
PDSEdit Classes

PDSElementInsertStmMCAsKid Inserts a marked content sequence from


a non-page-content stream as a kid of
the specified element.
PDSElementRemoveAllAttrObjs Removes all attribute objects directly
associated with the specified element.
PDSElementRemoveAllClasses Removes all classes from the specified
element.
PDSElementRemoveAttrObj Removes the specified attribute object
from an element.
PDSElementRemoveClass Removes the specified class name from
the element's list of classes to which it
belongs.
PDSElementRemoveKid Removes the specified kid from an
element.
PDSElementRemoveKidMC Removes the specified PDSMC (marked
content) from an element's kids, if it has
any.
PDSElementRemoveKidOBJ Removes an OBJ from among the kids
of a given element.
PDSElementReplaceKid Replaces the specified kid in the
specified element.
PDSElementReplaceKidMC Replaces the specified PDSMC (on old-
CosPage) with a new PDSMC (on new-
CosPage) in the specified element.
PDSElementReplaceKidOBJ Replaces oldObj with newObj on the
specified page in the specified element.
PDSElementSetActualText Sets the actual text representation of
the specified PDSElements contents
to buffer (from 0 to nBytes).
PDSElementSetAlt Sets the alternate text representation of
an element's contents.
PDSElementSetID Sets the ID of an element to the given
Cos string.
PDSElementSetLanguage Sets the language field associated with
the PDSElement to buffer's contents
(from 0 to nBytes).

408 Acrobat and PDF Library API Overview


PDSEdit LayerCreating and Editing Logical Structure
9
PDSEdit Classes

PDSElementSetTitle Sets an elements title.

PDSElementSetType Sets an elements type value to the


specified type.

PDSAttrObj
A PDSAttrObj represents a structure attribute object, which is a Cos dictionary or stream
describing attributes associated with a PDSElement. The attributes data may be
application-specific, suiting the application that adds or extracts logical structure
information. An attribute object can have a revision number to indicate whether other
applications have modified either the associated element or the elements contents since
the application created or modified the element. PDSAttrObj methods include:

PDSAttrObjCreate Creates a new attribute object.

PDSAttrObjCreateFromStream Creates an attribute object from a Cos stream.


PDSAttrObjGetCosObj Gets the Cos object corresponding to the
specified attribute object.
PDSAttrObjGetOwner Gets the value of the key (Owner) in the specified
attribute object.

PDSMC
Portions of a pages contents may be wrapped with marked content operators. A PDSMC
object represents this marked content. A tag and an optional property list may be
associated with a PDSMC. PDSMC is identical to the PDFEdit class PDEContainer.
PDSMCs may be nested. The PDSMC methods include:

PDSMCGetInfo Gets the parent element of the specified marked


content.
PDSMCGetParent Gets the parent element of the specified marked
content.
PDSMCGetPDEContainer Gets the PDE container object for the specified marked
content.
PDSMCIDGetParent Gets the parent element of the specified marked con-
tent, referred to by its containing object and marked-
content identifier.

Acrobat and PDF Library API Overview 409


PDSEdit LayerCreating and Editing Logical Structure
9
PDSEdit Classes

PDSMCRefCreate Creates a reference handle to a piece of marked con-


tent that can be used to associate the content with
structure.
PDSMCRefDestroy Destroys a marked content reference created with
PDSMCRefCreate.

PDSOBJR
An object reference (OBJR) is a reference to a PDF object. A PDSOBJR object references an
entire Cos dictionary or stream. The PDSOBJR object has one method:

PDSOBJGetParent Gets the parent element of the specified marked content.

PDSClassMap
The PDSClassMap (or class map) associates class names with a set of attribute objects. A
structural element may have a list of names identifying the classes to which it belongs.
Associated attributes are shared by all structural elements belonging to a given class. There
is only one class map per document, associated with the PDSTreeRoot. PDSClassMap
methods include:

PDSClassMapAddAttrObj Adds an attribute object to a PDSClassMap.

PDSClassMapGetAttrObj Gets the attribute object associated with a class


name.
PDSClassMapGetNumAttrObjs Gets the number of attribute objects associated
with a class name.
PDSClassMapRemoveAttrObj Removes the specified attribute object from the
specified PDSClassMap.
PDSClassMapRemoveClass Removes a class from a PDSClassMap.

PDSRoleMap
Each structure element must have a structure type. The definition of such types is
application-specific. In addition, PDF 1.3 defines a standard set of structure types for logical
structure in PDF documents. The role map (PDSRoleMap) maps application-specific
element types to the standard element types that have a similar function. There is only one
PDSRoleMap per document, associated with the PDSTreeRoot.

410 Acrobat and PDF Library API Overview


PDSEdit LayerCreating and Editing Logical Structure
9
Relationship of PDSEdit and PDFEdit

PDSRoleMap methods include::

PDSRoleMapCopy Makes a copy of a PDSRoleMap, making it the


PDSRoleMap of the specified StructTreeRoot.
PDSRoleMapDoesMap Determines whether the specified PDSRoleMap
provides any mapping path for two given element
types.
PDSRoleMapGetDirectMap Gets the type, if any, directly mapped in the
specified PDSRoleMap for the given element type.
PDSRoleMapMap Maps an element type src to another element type
dst in the specified PDSRoleMap.
PDSRoleMapUnMapDst Makes the specified element type have no
mapping.
PDSRoleMapUnMapSrc Makes the specified element type have no
mapping.

Relationship of PDSEdit and PDFEdit


A PDSMC object represents marked content in a pages contents stream. Specifically, it
represents the content that is bracketed by BMC/EMC or BDC/EMC marked content
operators.
In the PDFEdit API, PDEContainer objects are also defined as the content delimited by
BMC/EMC or BDC/EMC operators.
This means that PDSMC and PDEContainer objects are identical and may be freely cast
back and forth. You can use the PDFEdit API to create PDEContainer objects, then cast
and use them as PDSMC objects.

Using the PDSEdit API: Examining Structure

Structure Tree Root


The starting point for access to PDF structure is the PDSTreeRoot, the structure tree root.
You can obtain a PDDocs PDSTreeRoot by calling PDDocGetStructTreeRoot. The
return value indicates whether the document has any structure at all. A document has
structure if and only if it has a structure tree root and, hence, a structure tree.

Acrobat and PDF Library API Overview 411


PDSEdit LayerCreating and Editing Logical Structure
9
Using the PDSEdit API: Examining Structure

The structure tree root may contain a role map, which can help you identify elements that
serve common uses in the structure. You should call PDSTreeRootGetRoleMap to get
the tree roots role map.
The structure tree root may also hold a class map, which associates sets of attributes with
elements in the structure tree. You can get the class map with the
PDSTreeRootGetClassMap method.

Structure Elements
The actual structure elements or PDSElements of a document are grouped into subtrees
that are attached to the structure tree root. Each subtrees root is itself a PDSElement to
which other PDSElements may be attached.
Call PDSTreeRootGetNumKids to get the number of elements attached to the tree root.
To obtain each of these elements, use the PDSTreeRootGetKid method.
This example:
Gets the structure tree root
Checks if the tree root has children
Gets the last child

PDSTreeRoot treeRoot;
if (!PDDocGetStructTreeRoot(pdDoc,&treeRoot))
return; /* no structure tree */
ASInt32 numKids;
if ((numKids = PDSTreeRootGetNumKids(treeRoot)) == 0)
return; /* no kids */
PDSElement listElement;
/* get last kid /*
PDSTreeRootGetKid (treeRoot, numKids - 1, &listElement);

Traversing Elements in a Subtree


A PDSElement may have other PDSElements attached to it to form a subtree.
PDSElementGetKid is perhaps the most important access method in PDSEdit. A
structural elementunlike the structure tree rootcan have several different kinds of
children:
Another element (PDSElement)
Marked content (PDSMC)
A reference to an entire PDF object (PDSOBJR)
To allow for this, PDSElementGetKid returns a parameter that indicates the childs type.
If the returned child is a StructElem or PDSOBJR, the child is stored in the parameter
cosObjKid; if the return value is PDSMC, the child is stored in the parameter

412 Acrobat and PDF Library API Overview


PDSEdit LayerCreating and Editing Logical Structure
9
Using the PDSEdit API: Examining Structure

pointerKid. This method optionally provides the page on which an object or marked
content child is located.
Suppose you want to traverse the entire structure tree, looking for an element or a set of
elements that satisfy some search criteria. The PDSTreeRootGetNumKids and
PDSTreeRootGetKid methods allow it to get the elements in the root of the structure
tree. You can then use PDSElementGetNumKids and PDSElementGetKid to traverse
the children of each element it encounters. Since the structure is a tree, it lends itself to
recursive handling.
If a child is a PDSElement, it may have children of its own, which you can examine as
indicated above. Given a PDSElement, you can use PDSElement class methods to
determine the type (also called its tag name), title, and attributes.
If the child is a PDSOBJR, it can be a reference to a Cos dictionary or Cos stream object on a
page. For instance, the object referenced may be an XObject representing an image.
Handling of object references in the structure tree typically is application-specific.
If the child is a marked content element, you can use PDFEdit methods to examine it. For
example, it can see what text the marked content element contains or copy the content to
another document.
NOTE: A marked content object is referred to as type PDSMC in the PDSEdit API, and this is
actually a synonym for the PDFEdit class PDEContainer. Be sure to cast objects
appropriately and observe the conventions for acquiring and releasing PDFEdit
objects.
For more information, see Chapter 8, PDFEdit LayerCreating and Editing Page Content.
The example below:
Gets the children of an element
Looks for a marked content element
Gets the marked content
In this example, the element contains a list of other elements as children, and marked
content may be attached to these children.
/* Get the number of kids*/
ASInt32 listLength = PDSElementGetNumKids(listElement);
if (!listLength)
return; /* no kids */
/* Extract information from each kid */
ASInt32 i; for (i = 0; i < listLength; i++) {
CosObj cosObjKid, cosObjKid1;
PDSMC mcKid;
ASAtom kidType = PDSElementGetKid(listElement, i, &cosObjKid,
(void**)&mcKid, NULL);
if (kidType != ASAtomFromString("StructElem"))
continue; /* Not a structure element */
/* Look at first kid of structure element */
kidType = PDSElementGetKid((PDSElement)cosObjKid,0, &cosObjKid1,
(void**)&mcKid, NULL);

Acrobat and PDF Library API Overview 413


PDSEdit LayerCreating and Editing Logical Structure
9
Using the PDSEdit API: Examining Structure

if (kidType != ASAtomFromString("MC"))
continue; /* Not an MC */
/* Got the MC. Get its content. */
PDEContainer pdeContainer = (PDEContainer)mcKid;
PDEContent markedContent = PDEContainerGetContent(pdeContainer);
/* Process the marked content */
...
}

Object Attributes
An element may have attributes representing application-specific information. Attributes
are Cos dictionaries or Cos streams. You can use PDSElementGetNumAttrObjs and
PDSElementGetAttrObj to iterate through the attribute objects attached to an
element. You can filter these attribute objects according to their revision number (as
mentioned in PDSEdit Classes on page 404) by comparing the returned revision number
from PDSElementGetAttrObj with the revision number of the element returned by
PDSElementGetRevision.
Once you have an attribute object, you may examine the object using standard Cos-level
methods. Note that each attribute object may contain zero or more attributes. The
attributes of an element are the union of the attributes given by all the attribute objects.

Other Object Characteristics


In addition to attributes, an object can have other characteristics associated with it, such as
a title or ID. Use PDSElement accessor functions such as PDSElementGetTitle to get
this information.

Element Types and the Role Map


A structure element is represented by a Cos dictionary. In this dictionary, the Type key
always has the value StructElem. There also is a required Subtype key, and this keys value
indicates what kind of structure element it has. PDSElementGetType returns an
elements type.
Although a plug-in is free to define whatever element types it wishes, PDF defines a
standard list of element types. The role map associates a user-defined element type with
one of the standard types. There is only one role map in a PDF document, as previously
noted in PDSRoleMap on page 410.
Given an elements type, you can consult the structure tree roots role map via
PDSRoleMapDoesMap and PDSRoleMapGetDirectMap to find any standard roles
assigned to an element of this type. For example, you can find out whether an element is
some sort of section or table element in a document. A plug-in can use a well-made role
map to help make sense of a document.

414 Acrobat and PDF Library API Overview


PDSEdit LayerCreating and Editing Logical Structure
9
Using the PDSEdit API: Creating Structure

Classes and the Class Map


A set of attributes may be associated with a class, and an element may belong to one or
more classes. If an element belongs to a class, it has all the attributes associated with the
class. The class map contains this information. There is only one class map in a PDF
document, as previously noted in PDSClassMap on page 410.
Use PDSElementGetNumClasses to get the number of classes an element belongs to,
and call PDSElementGetClass to obtain each class to which the element belongs. Then
you can call PDSClassMapGetNumAttrObjs to get the number of attributes associated
with the class and PDSClassMapGetAttrObj to obtain each attribute in the class.

Using the PDSEdit API: Creating Structure

Structure Tree Root


Before adding structure to a PDF document, you must first create a structure tree root if the
PDDoc does not already have one. To do this, call PDDocGetStructTreeRoot to
determine if the PDDoc has a structure tree root. Call PDDocCreateStructTreeRoot
to create one.
To add structure elements to the tree root, use PDSTreeRootInsertKid.

Structure Elements
Creating structure using PDSEdit is mainly a process of creating elements with
PDSElementCreate, connecting them using PDSElementInsertKid, and attaching
the resulting subtrees to the structure tree root using PDSTreeRootInsertKid. You
can also construct the tree by adding PDSElements to the tree root, then adding children
to these PDSElements. Or you can do a combination of these.
Create a structural element by calling PDSElementCreate. You must set its type with
PDSElementSetType before doing anything else with it. You may optionally set an
elements ID, title, and alternate text representation with the respective methods,
PDSElementSetID, PDSElementSetTitle, and PDSElementSetAlt.
The PDSClassMapAddAttrObj method adds an attribute object to an element.
PDSElementAddClass adds a class to an element.
The example below:
Creates a PDDocs structure tree root if one does not exist

Acrobat and PDF Library API Overview 415


PDSEdit LayerCreating and Editing Logical Structure
9
Using the PDSEdit API: Creating Structure

Adds a structure element to it

PDSTreeRoot treeRoot;
if (!PDDocGetStructTreeRoot(pdDoc, &treeRoot))
PDDocCreateStructTreeRoot(pdDoc, &treeRoot);
PDSElement listElement;
PDSElementCreate(pdDoc, &listElement);
PDSElementSetType(listElement, ASAtomFromString("L"));
/* list element */
#define TEXT_LIST "Text element list"

PDSElementSetTitle(listElement,(const ASUns8*)TEXT_LIST,
strlen(TEXT_LIST));
PDSTreeRootInsertKid(treeRoot, listElement,
PDSTreeRootGetNumKids(treeRoot));

Adding Marked Content to an Element


Use PDFEdit methods to create or obtain marked content to add to a structural element.
You can then cast a PDEContainer object to PDSMC to use it with the PDSEdit API. It can
add marked content to a structure element with PDSElementInsertMCAsKid.
You can add a reference to marked content to only one structure element. A PDSMC can
have only one parent, because of the implementation: marked content points to its parent.
If you need to refer to marked content in more than one place, it can refer to the structure
element that has the PDSMC as a child rather than referring directly to the PDSMC.
This example:
Creates a marked content container
Adds a text element
Casts the container as a PDSMC
Adds the container to a structure element
The example sets the container tag to "LI" so that it is the same as the subtype of the
element containing the marked content. This allows using the New Bookmarks from
Structure... feature introduced with Acrobat 4.0.
PDPage pdPage;
pdPage = PDDocAcquirePage(pdDoc, thisPage);
CosObj pageCos = PDPageGetCosObj(pdPage);
PDEContainer pdeContainer = PDEContainerCreate(ASAtomFromString("LI"),
NULL, false);
PDEContent textContent = PDEContentCreate();
PDEContentAddElem(textContent, k, PDEBeforeFirst, pdeElement);
/* pdeElement is some text element obtained earlier */
PDEContainerSetContent(pdeContainer, textContent);
/* Create structure element; put container in that element as an MC. */

PDSElement listItemElement;

416 Acrobat and PDF Library API Overview


PDSEdit LayerCreating and Editing Logical Structure
9
Using the PDSEdit API: Creating Structure

PDSElementCreate(pdDoc, &listItemElement);
#define TEXT_ELEMENT "A text element"
PDSElementSetType(listItemElement, ASAtomFromString("LI"));
/* list item */
PDSElementSetTitle(listItemElement, (const ASUns8*)TEXT_ELEMENT,
strlen(TEXT_ELEMENT));
/* Put marked content into element */
PDSElementInsertMCAsKid(listItemElement,pageCos,(PDSMC)pdeContainer, 0);
PDPageRelease(pdPage);

Adding an Object Reference to an Element


You can add a PDF object reference to an element with PDSElementInsertOBJAsKid.
The object reference can be added to only one structure element. A PDSOBJR can have
only one parent, because of the implementation: an object points to its parent. If you need
to refer to an object in more than one place, you should refer to the structure element that
has the PDSOBJR as a child, rather than referring directly to the PDSOBJR.
This example adds a PDSOBJR to a structure element.
PDSElement XObjectElement;
PDSElementCreate(pdDoc, &XObjectElement);
PDSElementSetType(XObjectElement, ASAtomFromString("LI"));
/* Insert the reference to the CosObj obj we obtained somewhere else */
PDPage pdPage;
pdPage = PDDocAcquirePage(pdDoc, thisPage);
CosObj pageCos = PDPageGetCosObj(pdPage);
/* Add the object reference */
PDSElementInsertOBJAsKid(XObjectElement, pageCos, obj, 0);
PDPageRelease(pdPage);

Class Map
You can create a class map in the structure tree root with
PDSTreeRootCreateClassMap, which provides the class map created. You can get an
existing class map in a structure tree with PDSTreeRootGetClassMap. There is only
one class map in a PDF document.
To add an attribute for a class to the class map, use PDSClassMapAddAttrObj. If the
class does not already exist in the class map, it is created and the attribute added to it.
PDSClassMapRemoveClass removes a given class from the class map.
PDSClassMapRemoveAttrObj removes an attribute from a given class in the class
map.

Acrobat and PDF Library API Overview 417


PDSEdit LayerCreating and Editing Logical Structure
9
Using the PDSEdit API: Creating Structure

Role Map
PDSTreeRootCreateRoleMap creates a role map in a structure tree and provides the
newly-created role map. PDSTreeRootGetRoleMap obtains an existing role map. A PDF
document has only one role map.
To specify that a user-defined element type has the role of a standard element type, call
PDSRoleMapCopy. For more information, see Section 10.7, Tagged PDF in the PDF
Reference.

418 Acrobat and PDF Library API Overview


10 Cos Layer

The Cos layer provides access to the low-level object types and file structure used in PDF
files. PDF documents are trees of Cos objects. Cos objects represent document components
such as bookmarks, pages, fonts, and annotations, as described in Section 3.6, Document
Structure, in the PDF Reference.
Unlike using the AV and PD layer methods, using Cos layer methods improperlycould result
in an invalid PDF file. Therefore, you should not use Cos methods unless necessary, for
example to add private data to portions of a PDF file that cannot be accessed in other ways.
This chapter describes the Cos object types, data structures, and methods. See the Acrobat
and PDF Library API Reference for detailed information on each method. See Section 3.4,
File Structure, and Section 3.6, Document Structure, in the PDF Reference, for details on
file structure and Cos objects. The Acrobat SDK Plug-in Guide also includes a chapter on
using Cos object methods.

Cos Objects: Direct and Indirect


PDF files contain several types of Cos objects: booleans, numbers, strings, names, arrays,
dictionaries, and streams, plus a special null object.
Your plug-in can create objects of any of these types either as direct objects or indirect
objects; the choice is specified as a parameter to the method that creates the object. For
details on direct and indirect objects, see Section 3.2.9, Indirect Objects, in the PDF
Reference.
When a direct object is created, the object itself is returned. As a result, a direct object can
only be attached to one other Cos object at a time; it cannot, for example, be shared by two
different dictionaries.
When an indirect object is created, something equivalent to a pointer to the object is
returned. As a result, an indirect object can be attached to multiple places in a PDF file
simultaneously; it can, for example, be shared by two different dictionaries.
Attaching a Cos object to another is referred to as putting it into a container object. Core
API methods that put objects into container objects raise an exception if the object to be
put is a direct object that already is contained in another object.
Direct booleans, integers, fixed numbers, and names need not be destroyed when they are
no longer needed. Other object types (and indirect objects of these types) should be
destroyed when they are no longer needed.

Acrobat and PDF Library API Overview 419


Cos Layer
10
File Structure

File Structure
A PDF file consists of four sections:
A one-line header specifying the PDF version.
A body, which is a sequence of objects representing a PDF document.
A cross-reference table containing information allowing access to indirect objects in the
file.
A trailer containing information on certain special objects in the file.
There is one entry in the cross-reference table for each indirect object in a file; the entry
specifies the byte offset of the object from the beginning of the file. When a file is opened, if
Acrobat determines that the offsets are incorrect (indicating that the file has been
damaged in some manner), it attempts to rebuild the cross-reference table as described in
Appendix C.1 in the PDF Reference.
Multiple files may be open simultaneously. Each open file is represented by a document
pointer, and all indirect objects must be associated with a document. However, objects
belonging to one document cannot be stored in objects in another document. The Cos layer
uses ASStm objects to access a files contents.

Cos Objects in the Core API


In the Acrobat core API, there are two defined objects:
CosDoc, which represents an entire PDF file.
CosObj, which represents all the individual object types. There are various methods to
create the different types of Cos objects, as well as getting and setting their values.
Each CosObj can be specified as being one of the other supported types: CosArray,
CosBoolean, CosDict, CosFixed, CosInteger, CosName, CosNull, CosStream,
and CosString.
The Cos layer provides methods to create and modify objects of each of the supported
types, as well as methods to read and write objects to and from a file. Additional utility
methods include those to get the root node of the tree of objects representing a PDF
document, and the info dictionary for a PDF document.

420 Acrobat and PDF Library API Overview


Cos Layer
10
CosDoc

CosDoc
A CosDoc object is the Cos layer representation of an entire PDF file. See Appendix B for an
overview of PDF document structure. See Section 3.6.1, Document Catalog, in the PDF
Reference, for a description of the catalog dictionary.

CosDocClose Closes a Cos document.

CosDocCreate Creates an empty Cos document.

CosDocEnumEOFs Calls the specified procedure for each EOF in a


given CosDoc.
CosDocEnumEOFs64 Calls the specified procedure for each EOF in a
given CosDoc.
CosDocEnumIndirect Enumerates all the indirect objects of a given
CosDoc.
CosDocGetID Returns two ID byte arrays identifying the
CosDoc.
CosDocGetInfoDict Gets the specified documents Info dictionary.

CosDocGetObjByID Gets the indirect CosObj with the latest


generation number.
CosDocGetRoot Gets a documents root Cos object, the catalog
dictionary
CosDocHasFullCompression Tests whether the Cos document is fully
compressed.
CosDocHasPartialCompression Tests whether the Cos document is partially
compressed.
CosDocObjIsWithinRange Tests whether the definition of a specified Cos
object, in the file associated with the object's
CosDoc, begins within any of a set of byte
ranges.
CosDocObjIsWithinRange64 Tests whether the definition of a specified Cos
object, in the file associated with the object's
CosDoc, begins within any of a set of byte
ranges.
CosDocOpenWithParams Opens a Cos document.

CosDocSaveToFile Sets a single element in an array.

Acrobat and PDF Library API Overview 421


Cos Layer
10
CosObj

CosDocSaveWithParams Saves a Cos document, optionally to a new file.

CosDocSetDirty Sets a Cos document's dirty flag to a given


boolean value.

CosObj
A CosObj is a general object in a PDF file, which may be of any Cos object type.
The Cos layer provides several methods that are not specific to any particular object.
Several methods are available to manipulate a Cos object and include:

CosObjAcquire Create a strong reference for an object.

CosObjAddToCollection Adds a Cos object to a collection.

CosObjCmp Compares the two CosObjs.

CosObjCopy Copies a CosObj from one document to


another (or the same document).
CosObjDestroy Destroys a Cos object.

CosObjEnum Enumerates the elements of a Cos object by


calling a user-supplied procedure for each com-
ponent of the object.
CosObjEqual Tests whether two Cos objects are equal.

CosObjGetCollection Gets the CosObjCollection containing the


specified object.
CosObjGetCompressibility Tests whether an object is compressible.

CosObjGetDoc Gets the CosDoc containing the object


(indirect or non-scalar objects only).
CosObjGetGeneration Gets the generation number of an indirect Cos
object.
CosObjGetID Gets the local master index for an indirect
object.
CosObjGetType Gets an objects type.

CosObjHash Gets a 32-bit hash-code for the given CosObj.

CosObjIsCompressed Tests whether an object is compressed that is,


part of a CosObjCollection.

422 Acrobat and PDF Library API Overview


Cos Layer
10
CosObjCollection

CosObjIsIndirect Tests whether an object is indirect. See Section


3.2.9 in the PDF Reference for details on indirect
objects.
CosObjRefreshAfterLinearized In version 6, CosObjRefreshAfterLin-
Save earizedSave updates an indirect Cos object
after a linearized save operation.
CosObjRelease Remove a strong reference for an object.

CosObjRemoveFromCollection Removes a Cos object from the


CosObjCollection to which is belongs.
CosObjSetCompressibility Controls whether a Cos object can be
compressed.

CosObjCollection
The CosObjCollection is an opaque structure representing a set of Cos objects
associated with a particular Cos document. The initial value of a variable of type
ObjCollection is undefined. Use CosNewObjCollection to create a collection.
Any indirect object whose generation number is zero and which is not a stream may be
added to at most one CosObjCollection. When the file is saved, all the objects in a
given collection are stored together in the PDF file, in one or more object streams (see the
PDF Reference), which are normally compressed in order to reduce file size.
Collections allow grouping of objects that are likely to have a similar usage pattern. If one
of them is required (and therefore decompressed), they are likely to all be required, but it is
possible that none will be required. For example, there could be a collection that stores
bookmarks. If the user never opens the bookmarks panel in Acrobat, none of the objects
need to be decoded. If the user opens the bookmarks panel, it is likely they will all be
needed, and having them together in the PDF file reduces the amount of time needed to
load them all.
The CosObjCollection methods allow you to compare collections and iterate over the
objects in a collection. CosObjCollection methods include:

CosNewObjCollection Creates a new object collection for objects in a


document.
CosObjCollectionEnum Enumerates the members of a Cos object collection,
calling a user-supplied procedure for each member
object.
CosObjCollectionEqual Tests whether two Cos object collections are the same
collection.

Acrobat and PDF Library API Overview 423


Cos Layer
10
CosArray

CosObjCollectionIsNull Tests whether an object collection is null.


CosObjCollectionSize Gets the number of objects in an object collection.

CosArray
Cos arrays are one-dimensional collections of objects accessed by a numeric index. Array
indexes are zero based. An arrays elements may be any combination of the Cos data types.
The CosArray methods include:

CosArrayGet Gets a single element from an array.

CosArrayInsert Inserts an element into an array.

CosArrayIsWeakReference Return the state of a weak reference in an array.

CosArrayLength Gets the number of elements in array.

CosArrayPut Sets a single element in an array.

CosArrayRemove Finds the first element, if any, equal to the


specified object and removes it from the array.
CosArrayRemoveNth Checks whether the position is within the array
bounds and then removes it from the array and
moves each subsequent element to the slot with
the next smaller index and decrements the
arrays length by 1.
CosArraySetWeakReference Establishes or removes a weak reference from an
array.
CosNewArray Creates an array.

CosBoolean
Cos boolean objects can have a value of true or false. The CosBoolean methods
include:

CosBooleanValue Gets the value of the specified boolean object.

CosNewBoolean Creates a new boolean object associated with the specified


document and having the specified value.

424 Acrobat and PDF Library API Overview


Cos Layer
10
CosDict

CosDict
A Cos dictionary is an associative table whose elements are pairs of objects:
The first element of a pair is the key, which is always a name object, a sequence of
characters beginning with the forward slash (/) character.
The second element is the Cos object representing the value.
See Section 3.2.6 in the PDF Reference for details.
The CosDict methods include

CosDictGet Gets the value of a dictionary key.

CosDictGetKey Gets the value of the specified key in the specified


dictionary.
CosDictGetKeyString Gets the value of the specified key in the specified
dictionary.
CosDictGetXAPMetadata Gets the XMP metadata associated with a Cos
dictionary or stream.
CosDictIsWeakReference Gets the state of a weak reference.

CosDictKnown Tests whether a specific key is found in the specified


dictionary.
CosDictKnownKey Tests whether a specific key is found in the specified
dictionary.
CosDictKnownKeyString Tests whether a specific key is found in the specified
dictionary.
CosDictPut Sets the value of a dictionary key.

CosDictPutKey Sets the value of a dictionary key, adding the key to


the dictionary if it is not already present.
CosDictPutKeyString Sets the value of a dictionary key, adding the key to
the dictionary if it is not already present.
CosDictRemove Removes a key-value pair from a dictionary.

CosDictRemoveKey Removes a key-value pair from a dictionary.

CosDictRemoveKeyString Removes a key-value pair from a dictionary.

CosDictSetWeakReference Weak references and strong references.


CosDictSetXAPMetadata Sets the XMP metadata associated with a Cos
dictionary or stream.

Acrobat and PDF Library API Overview 425


Cos Layer
10
CosFixed

CosNewDict Creates a dictionary.

CosFixed
Fixed numbers may only be in decimal format. See Section 3.2.2 in the PDF Reference, for
details. The CosFixed methods include:

CosFixedValue Gets the value of the specified fixed number object.

CosNewFixed Creates a new fixed number object associated with the


document, having the specified value.

CosInteger
Integers may be specified by signed or unsigned constants. See Section 3.2.2 in the PDF
Reference, for details. CosInteger methods include:

CosInteger64Value Gets the 64-bit integer value of a specified number object.


CosIntegerValue Gets the integer value of the specified number object.

CosNewInteger Creates a new integer object associated with the document,


having the specified value.
CosNewInteger64 Creates a new 64-bit integer object associated with the spec-
ified document and having the specified value.

CosName
A name is a sequence of non-white space characters. In code, a name is preceded by the
forward slash (/) character indicating that it is a string literal, for example:/AName.
See Section 3.2.4 in the PDF Reference, for details. The CosName methods include:

CosNameValue Gets the value of the specified name object.

CosNewName Creates a new name object associated with the


document, having the specified value.
CosNewNameFromString Creates a new name object associated with the
specified document and having the specified value.

426 Acrobat and PDF Library API Overview


Cos Layer
10
CosNull

CosNull
There is only one NULL object, which is used to fill empty or uninitialized positions in arrays
or dictionaries. See Section 3.2.8 in the PDF Reference for details.
CosNewNull is a method that gets a NULL Cos object.

CosStream
A stream is a sequence of characters that can be read a portion at a time. Streams are used
for objects with large amounts of data, such as images, page content, or private data a
plug-in creates. A stream consists of these elements, which are listed in their relative order
in the stream object, starting at the beginning.
See Section 3.2.7 in the PDF Reference, for a description of the stream object. CosStream
methods include:

CosNewStream Creates a new Cos stream, using data from an existing ASStm.

CosNewStream64 Creates a new Cos stream, using data from an existing ASStm.

CosStreamDict Gets a streams attributes dictionary.

CosStreamLength Gets a streams length.

CosStreamLength64 Gets the length of a Cos stream from the Length key in the
stream's attributes dictionary.
CosStreamOpenStm Creates a new, non-seekable ASStm for reading data from a Cos
stream.
CosStreamPos Gets the byte offset of the start of a Cos streams data in the PDF
file.
CosStreamPos64 Gets the byte offset of the start of a Cos stream's data in the PDF
file.

CosString
A string is a sequences of characters, enclosed in parentheses. See Section 3.2.3 in the PDF
Reference for details. CosString methods include:

CosNewString Creates and returns a new Cos string object.

CosStringGetHexFlag Gets the hex flag of the CosString.

Acrobat and PDF Library API Overview 427


Cos Layer
10
Encryption/Decryption

CosStringSetHexFlag Sets the hex flag of the CosString.


CosStringValue Gets the value of Cos string object, and the strings length.

CosStringValueSafe Copies at most bufferLen bytes from objs string value


into buffer, and stores the actual length of the Cos string in
nBytes.

Encryption/Decryption
The Cos layer provides methods to encrypt and decrypt data in arbitrary memory blocks.
The encryption and decryption uses Acrobats built-in algorithm (RC4 from RSA Data
Security, Inc.) and a key that can be specified. methods include:

CosCryptGetVersion Gets the current version number of the encryption


algorithm supported.
CosDecryptData Decrypts data in a buffer using the specified
encryption key.
CosDecryptGetMaxKeyBytes Gets the maximum number of the decryption key
length, in bytes, for the specified cryptVersion.
CosEncryptData Encrypts data in a buffer using the specified
encryption key.
CosEncryptGetMaxKeyBytes Gets the maximum number of the encryption key
length, in bytes, for the specified cryptVersion.

428 Acrobat and PDF Library API Overview


11 Handlers

Plug-ins and PDF Library applications can add new types of tools, annotations, actions, file
systems, and so on, thereby expanding the number of object types that Acrobat supports.
To accomplish this, plug-ins and PDF Library applications provide a collection of callback
routines called handlers. Handlers perform the necessary functions for the objects, such as
creating and destroy them, drawing, and handling mouse clicks, keyboard events, and
other events as appropriate for their objects.
NOTE: The PDF Library, since it does not have access to AV-layer APIs, can provide handlers
only for a few of the capabilities described in this chapterspecifically, file systems
(see File Systems) and file specification handlers (see File Specification Handlers).
NOTE: These types of handlers are distinct from exception handlers (see Chapter 13,
Handling Errors).
To add a new handler, a plug-in must write the callback routines, create the appropriate
data structure containing the callbacks and other data, and pass the structure to Acrobat
using the appropriate API method. Subsequently, Acrobat automatically calls the correct
callbacks when it encounters an object of the type handled by the handler.
This chapter describes several types of handlers and shows the which data structures,
callbacks and methods are involved in creating them.
It is possible to subclass existing handlers or to create entirely new types of handlers. For
example, a plug-in could subclass the built-in text annotation handler by adding the ability
to hide annotations. To accomplish this, the plug-in would :
Obtain the built-in text annotation handler structure (using
AVAppGetAnnotHandlerByName).
Copy the structure before modifying it (not modifying the original).
Replace the handlers Draw callback with one that calls the built-in Draw callback
(obtained from the structure) if annotations are visible, or simply return without
drawing anything if annotations are hidden.
Register the new handler (using AVAppRegisterAnnotHandler with a new type).
If a handler requires more data than provided in the predefined structures described in this
section, you can append additional data to the predefined structures. To do this, create a
new structure type with the predefined structure as its first member and the additional
data as subsequent members. Before passing the expanded structure to the Acrobat
method, cast the structure to the predefined structure type. Upon return of the structure
from Acrobat, re-cast the structure to its expanded type to access the appended data.
Each handler data structure contains a size field, which specifies the structures size. This
field provides future compatibility. Different versions of the structure have different sizes,
allowing Acrobat to determine which version your plug-in was written to use.

Acrobat and PDF Library API Overview 429


Handlers
11
Action Handlers

NOTE: Regardless of whether your plug-in adds data to the predefined structures, it always
must pass the size of the predefined structure (rather than the size of its expanded
structure) in the size field.

Action Handlers
Support for new action types can be added by defining and registering an action handler.
The Acrobat Weblink plug-in uses this ability to add support for URL links.
To add a new action type, a plug-in must provide a set of callbacks, specify them in the
AVActionHandlerProcs structure, and call AVAppRegisterActionHandler to
register them (see the Acrobat and PDF Library API Reference for details). The callbacks
include ones that:
Perform the action, such as setting the view to that specified by the destination
(AVActionPerformProc).
Allow the user to set the actions properties (necessary only if any properties can be set).
(AVActionDoPropertiesProc).
Initialize an actions dictionary with default values.
(AVActionFillActionDictProc).
Display a string containing brief instructions for the action.
(AVActionGetInstructionsProc).
Display various text strings to be used in dialogs. (AVActionGetButtonTextProc,
AVActionGetStringOneTextProc, AVActionGetStringTwoTextProc).
Copy the action (AVActionCopyProc).
For details on each of the callbacks in an action handler, see the description of
AVAppRegisterActionHandler in the Acrobat and PDF Library API Reference.

Annotation Handlers
Support for new annotation types in Acrobat can be added by defining and registering an
annotation handler. The Acrobat Movie plug-in, for example, uses this to support video
annotations.
To add a new annotation type, a plug-in must provide a set of callbacks, specify them in the
AVAnnotHandler structure, and register them with AVAppRegisterAnnotHandler
(see the Acrobat and PDF Library API Reference for details). The callbacks include ones that:
Draw the annotation (AVAnnotHandlerDrawProc).
Handle mouse clicks in the annotation (AVAnnotHandlerDoClickProc).
Control the cursor shape when the cursor is over the annotation
(AVAnnotHandlerAdjustCursorProc).

430 Acrobat and PDF Library API Overview


Handlers
11
AVCommand Handlers

Determine whether or not a specified point is within the annotation


(AVAnnotHandlerPtInAnnotViewBBoxProc).
Return the rectangle bounding the region the annotation occupies
(AVAnnotHandlerGetAnnotViewBBoxProc).
Highlight (unhighlight) the annotation when it is added to (removed from) the selection
(AVAnnotHandlerNotifyAnnotAddedToSelectionProc,
AVAnnotHandlerNotifyAnnotRemovedFromSelectionProc).
Return the annotations subtype (AVAnnotHandlerGetTypeProc).
Get the annotations layer (AVAnnotHandlerGetLayerProc). See Acrobat SDK Plug-
in Guide for related information.

AVCommand Handlers
Introduced in Acrobat 5.0, an AVCommand represents an action that the user can perform
on the current document or the current selection in the current document. AVCommands
are exposed to Acrobat through AVCommand handlers. A plug-in can add new command
types in Acrobat by defining and registering an AVCommand handler. Commands can be
executed interactively, programmatically, or through batch processing.

Creating an AVCommand Handler


AVCommand handlers consist of a series of callbacks contained in the
AVCommandHandlerRec structure (see AVExpt.h).
To implement a command handler with minimal functionality, a plug-in should
Initialize an instance of the AVCommandHandlerRec structure.
Allocate memory for the structure.
Fill in the size field.
Implement the Work, Cancel, and Reset callbacks.
Register the AVCommandHandlerRec structure with Acrobat using
AVAppRegisterCommandHandler.

Acrobat and PDF Library API Overview 431


Handlers
11
AVCommand Handlers

This is shown in the following example:


static AVCommandHandlerRec gAVCmdHandler;
const char *kCmdName = "MinimalCommand";
static ACCB1 AVCommandStatus ACCB2 DoWorkImpl (AVCommand cmd)
{
// Minimal AVCommand. Does nothing.
return kAVCommandDone;
}
void InitializeCommandHandler()
{
memset (&gAVCmdHandler, 0, sizeof(AVCommandHandlerRec));
gAVCmdHandler.size = sizeof(AVCommandHandlerRec);
gAVCmdHandler.Work = ASCallbackCreateProto (AVCommandWorkProc,
DoWorkImpl);
AVAppRegisterCommandHandler (ASAtomFromString(kCmdName),
&gAVCmdHandler);
}
This procedure implements a valid AVCommand that plug-in clients can access through the
AVCommand methods. For details on how clients can invoke the AVCommands, see
Invoking AVCommands Programmatically on page 270.

Exposing AVCommands to the Batch Framework


Acrobat builds the list of commands that users see in the Batch Sequences and Batch Edit
Sequence dialogs from an internal list of AVCommands referred to as the global command
list.
Adding a Handler to the Global Command List
To expose a command to the batch framework, the AVCommand handler first must add an
instance of the command to this global list using the AVAppRegisterGlobalCommand
method.
AVCommand cmd = AVCommandNew (ASAtomFromString(kCmdName));
AVAppRegisterGlobalCommand (cmd);
Although this step can be performed at any time once the command handler has been
registered, handlers commonly register commands from within the

432 Acrobat and PDF Library API Overview


Handlers
11
AVCommand Handlers

AVCommandRegisterCommandsProc callback (of the AVCommandHandlerRec


structure), for example,
static ACCB1 void ACCB2 RegisterCommandsImpl (ASAtom handlerName)
{
ASAtom cmdName = ASAtomFromString(kCmdName);
AVCommand cmd;
if (NULL == AVAppFindGlobalCommandByName (cmdName)) {
cmd = AVCommandNew (cmdName);
if (cmd)
AVAppRegisterGlobalCommand (cmd);
}
}

Supporting Properties
When building a list of batchable commands, Acrobat iterates through its internal
command list, querying each command for the "CanBatch" and "GroupTitle" properties. To
be exposed through the batch framework user interface, a command must support these
properties (that is, return true and a valid ASText object, respectively, when Acrobat
queries them).
To accomplish this, the AVCommand handler must implement the GetProps callback of
the AVCommandHandlerRec structure.
If an AVCommand supports these properties, Acrobat queries a number of additional
properties as the user interacts with the batch framework. Of these additional properties,
only two are required: Title and "Generic Title". A command must provide the title strings
that will be displayed in the Batch Sequences and Batch Edit Sequence dialogs. See the

Acrobat and PDF Library API Overview 433


Handlers
11
File Format Conversion Handlers

Acrobat and PDF Library API Reference for a complete description of the various AVCommand
properties.
const char *kCmdTitle = "Command Title";
const char *kGroupTitle = "Group Title";
const char *kCmdGenericTitle = "Generic Title";

static ACCB1 AVCommandStatus ACCB2 GetPropsImpl (AVCommand cmd,


ASCab props)
{
ASBool doItAll = false;
ASText text;
if (ASCabNumEntries( props ) == 0)
doItAll = true;
if (doItAll || ASCabKnown (props, kAVCommandKeyGroupTitle))
{
// Create a new text object and insert it into the ASCab
text = ASTextNew();
ASTextSetEncoded (text, kGroupTitle, (
ASHostEncoding)PDGetHostEncoding());
ASCabPutText( props, kAVCommandKeyGroupTitle, text);
}
if (doItAll || ASCabKnown (props, kAVCommandKeyCanBatch))
ASCabPutBool (props, kAVCommandKeyCanBatch, true );
if (doItAll || ASCabKnown (props, kAVCommandKeyGenericTitle))
{
// Create a new text object and insert it into the ASCab
text = ASTextNew();
ASTextSetEncoded (text, kCmdGenericTitle,
(ASHostEncoding)PDGetHostEncoding());
ASCabPutText (props, kAVCommandKeyGenericTitle, text);
}
if (doItAll || ASCabKnown (props, kAVCommandKeyTitle))
{
// Create a new text object and insert it into the ASCab
text = ASTextNew();
ASTextSetEncoded (text, kCmdTitle,
(ASHostEncoding)PDGetHostEncoding());
ASCabPutText (props, kAVCommandKeyTitle, text);
}
}
At this point, the user will be able to use the command in batch sequences.

File Format Conversion Handlers


With Acrobat 5.0 and higher, a plug-in can add file conversion handlers to Acrobat (but not
Adobe Reader) for converting:
To PDF from another file format (import)

434 Acrobat and PDF Library API Overview


Handlers
11
File Specification Handlers

From PDF to another file format (export)


To add a new file conversion handler, a plug-in must provide a set of callbacks, specify
them in the AVConversionToPDFHandler or AVConversionFromPDFHandler
structures, and call AVAppRegisterToPDFHandler or
AVAppRegisterFromPDFHandler to register them (see the Acrobat and PDF Library
API Reference for details). It must specify the types of files it can convert and whether it can
perform synchronous conversion (required for the handler to be accessible from the batch
framework). Upon registration, the conversion handlers are automatically added to the
respective Open... and Save As... dialogs.
The callbacks include ones that:
Provide default settings for the conversion
(AVConversionDefaultSettingsProc).
Provide conversion parameter information (AVConversionParamDescProc).
Display a settings dialog (AVConversionSettingsDialogProc).
Convert a non-PDF file to or from a PDF file (AVConversionConvertToPDFProc or
AVConversionConvertFromPDFProc).

File Specification Handlers


A file specification handler converts between a PDFileSpec and an ASPathName. Each
file specification handler works only with a single file system, which the handler specifies.
To create a new file specification handler, a plug-in or application must provide callbacks
that:
Convert an ASPathName to a PDFileSpec. It is called by
PDFileSpecNewFromASPath.
Convert a PDFileSpec to an ASPathName.
See the description of PDRegisterFileSpecHandlerByName in the Acrobat and PDF
Library API Reference, for details on each of the callbacks in a file specification handler.

Selection Servers
A selection server allows the selection of a certain type of data, such as annotations, text, or
graphics. Plug-ins can create new selection servers to allow the selection of types of data
not already supported. To add a new selection server, a plug-in must provide a set of
callbacks, specify them in the AVDocSelectionServer data structure, and register
them using AVDocRegisterSelectionServer.
The callbacks include ones that:
Return the selection type serviced by the handler (AVDocSelectionGetTypeProc).

Acrobat and PDF Library API Overview 435


Handlers
11
Tools

Highlight or unhighlight a selection


(AVDocSelectionHighlightSelectionProc).
Handle key presses (AVDocSelectionKeyDownProc).
Delete the selection (AVDocSelectionDeleteProc).
Cut the selection to the clipboard (AVDocSelectionCutProc).
Copy the selection to the clipboard (AVDocSelectionCopyProc).
Paste the selection from the clipboard (AVDocSelectionPasteProc).
Select all data of the type they handle (AVDocSelectionSelectAllProc).
Enumerate the items in the current selection
(AVDocSelectionEnumSelectionProc).
Scroll the view so that the current selection is available
(AVDocSelectionShowSelectionProc).
Determine whether or not the Properties menu item is enabled
(AVDocSelectionCanPropertiesProc).
Display the properties dialog for the selection, if the selection type has a properties
dialog (AVDocSelectionPropertiesProc).
For a complete list of the callbacks in a selection server, see the description of
AVDocSelectionServer in the Acrobat and PDF Library API Reference. The
SelectionServer sample plug-in in the Acrobat SDK shows an example of a selection
server.

Tools
To add a new tool, a plug-in must provide a set of callbacks, specify them in the AVTool
data structure, and register them using AVAppRegisterTool..
The callbacks include ones that:
Activate the tool; that is, do whatever is necessary when the tool is selected
(ActivateProcType)
Deactivate the tool; that is, do whatever is necessary when another tool is selected
(DeactivateProcType)
Handle mouse clicks (DoClickProcType).
Handle key presses (DoKeyDownProcType).
Control the shape of the cursor (AdjustCursorProcType).
Return the tools name (GetTypeProcType).
Indicate whether the tool stays active after it is used once
(IsPersistentProcType).

436 Acrobat and PDF Library API Overview


Handlers
11
Window Handlers

Determine whether the tool is enabled. For example, if a tool is meant to be used within
documents, but there are no documents open, it probably makes no sense to activate
the tool (AVComputeEnabledProc).
See the description of AVTool in the Acrobat and PDF Library API Reference for a complete
list of the callbacks.

Window Handlers
When a plug-in creates a window, it can register the window, so that it behaves like other
windows in Acrobat, for example, when the Acrobat is minimized or hidden. For each
window that a plug-in provides, a window handler must be provided.
NOTE: Window handlers are used only in the Macintosh version of the Acrobat. Windows
and UNIX versions of Acrobat instead use the platforms native window handling
mechanisms.
To define a window handler, a plug-in must provide a set of callbacks, specify them in an
AVWindowHandler structure, and pass the structure to AVWindowNew or
AVWindowNewFromPlatformThing.The window handlers callbacks are automatically
called by Acrobat. Default behavior is used for any missing callbacks.
The callbacks include ones that:
Handle mouse clicks in the window (AVWindowMouseDownProc).
Handle keystrokes in the window (AVWindowKeyDownProc).
Draw the windows contents (AVWindowDrawProc).
Permit or prevent closing of the window (AVWindowWillCloseProc).
Clean up after the window has been closed (AVWindowDidCloseProc).
Do anything that must be done when the window is activated or deactivated
(AVWindowDidActivateProc, AVWindowWillDeactivateProc).
Do anything that must be done when the window becomes responsible for handling
keystrokes or loses responsibility for handling keystrokes
(AVWindowDidBecomeKeyProc, AVWindowWillResignKeyProc).
Permit or constrain window size changes (AVWindowWillBeResizedProc).
Determine whether the Cut, Copy, Paste, Clear, SelectAll, and Undo menu items are
enabled (AVWindowCanPerformEditOpProc).
Perform Cut, Copy, Paste, Clear, SelectAll, and Undo operations
(AVWindowPerformEditOpProc).
Control the shape of the cursor when it is within the window
(AVWindowAdjustCursorProc).
For a complete list of callbacks in a window handler, see the description of
AVWindowHandler in the Acrobat and PDF Library API Reference.

Acrobat and PDF Library API Overview 437


Handlers
11
File Systems

File Systems
Plug-ins can add new file systems to Acrobat, to access files on a device that cannot be
accessed as a local hard disk, such as a socket or a modem line.
To add a new file system, a plug-in must provide a set of callbacks and specify them in the
ASFileSysRec structure. This structure is passed as a parameter to calls that require a file
system. Unlike some of the other handlers in this chapters,there is no explicit registration.
The callbacks include ones that:
Open (ASFileSysOpenProc) or close (ASFileSysCloseProc) a file.
Flush a files buffered data to disk (ASFileSysFlushProc).
Get or set the current position in a file (ASFileSysSetPosProc,
ASFileSysGetPosProc) .
Get or set a files logical size (ASFileSysGetEofProc or ASFileSysSetEofProc)
.
Read data from a file (ASFileSysReadProc) .
Write data to a file (ASFileSysWriteProc) .
Delete a file (ASFileSysRemoveProc) .
Rename a file (ASFileSysRenameProc) .
Get a files name (ASFileSysGetNameProc)
Determine the amount of free space on a volume
(ASFileSysGetStorageFreeSpaceProc).
Get a file systems name (ASFileSysGetFileSysNameProc) .
Test whether two files are the same (ASFileSysIsSameFileProc) .
Get a pathname to a temporary file (ASFileSysGetTempPathNameProc) .
Copy a pathname (not the underlying file) (ASFileSysCopyPathNameProc) .
Convert between device-independent and device-dependent pathnames
(ASFileSysDiPathFromPathProc) .
Dispose of a pathname (not the underlying file)
(ASFileSysDisposePathNameProc) .
Flush data on a volume (ASFileSysFlushVolumeProc) .
Handle asynchronous I/O (ASFileSysAsyncReadProc,
ASFileSysAsyncWriteProc) .
Handle multiple read requests (ASFileSysMReadRequestProc) .
For details on each of the callbacks in a file system, see the description of ASFileSysRec
in the Acrobat and PDF Library API Reference.

438 Acrobat and PDF Library API Overview


Handlers
11
Progress Monitors

Progress Monitors
Progress monitors provide feedback to a user on the progress of a time-consuming
operation. Some potentially time-consuming methods in the core API require a progress
monitor as a parameter. Acrobat has a default progress monitor, which generally is
sufficient for plug-ins to use. The built-in progress monitor can be obtained using
AVAppGetDocProgressMonitor.
Plug-ins can use the default progress monitor or implement their own by providing a set of
callbacks, specifying them in the ASProgressMonitorRec data structure, and passing a
pointer to the structure to the methods that require a progress monitor. (There is no explicit
registration method.)
NOTE: Prior to Acrobat 5.0, the ProgressMonitorRec structure was used.
Plug-ins can also use a progress monitor (either the built-in one or their own) to display
progress when they carry out a time-consuming task. To do this, they simply call the
progress monitors callbacks directly.
NOTE: Plug-ins that perform time-consuming tasks should, in general, allow the user to
cancel them (see AVAppGetCancelProc).
The progress monitor callbacks include ones that :
Initialize the progress monitor and display it with a current value of zero
(PMBeginOperationProc).
Draw a full progress monitor, then remove the progress monitor from the display
(PMEndOperationProc).
Set the value that corresponds to a full progress monitor display
(PMSetDurationProc).
Set the current value of the progress monitor and update the display
(PMSetCurrValueProc).
Get the progress monitors maximum value (PMGetDurationProc).
Get the progress monitors current value (PMGetCurrValueProc).
For details, see the description of ASProgressMonitorRec in the Acrobat and PDF
Library API Reference.

Transition Handlers
Transitions allow effects such as dissolves or wipe-downs when displaying a new page. New
transition types can be added by defining and registering a transition handler.
To add a new transition, a plug-in must provide a set of callbacks, specify them in the
AVTransHandler data structure, and register them using
AVAppRegisterTransHandler. The callbacks include ones that:

Acrobat and PDF Library API Overview 439


Handlers
11
Transition Handlers

Get the transition type (AVTransHandlerGetTypeProc).


Perform the transition; that is, do whatever is necessary to change to the next page with
this transition style) (AVTransHandlerExecuteProc).
Fill in the transition dictionary in the PDF file
(AVTransHandlerInitTransDictProc,
AVTransHandlerCompleteTransDictProc).
Provide information for the user interface that sets the attributes of the transition
(AVTransHandlerGetUINameProc).
For a complete list of the callbacks in a transition handler, see the description of
AVTransHandler in the Acrobat and PDF Library API Reference.

440 Acrobat and PDF Library API Overview


12 Document Security

This chapter describes the document security features of the Acrobat core API. It discusses:
Encryption and decryption of PDF files so that only authorized users can read them.
Security handlers, which are the primary mechanism for controlling access to a file. They
contain code that performs user authorization and sets permissions. Acrobat has a built-
in security handler; plug-ins can alter Acrobats security system by adding new security
handlers.
New security features in Acrobat 5.0.

Encryption and Decryption


Encryption is controlled by an encryption dictionary in the PDF file. The Acrobat core API
uses RC4 (a proprietary algorithm provided by RSA Data Security, Inc.) to encrypt document
data, and a standard (proprietary) method to encrypt, decrypt, and verify user passwords to
determine whether or not a user is authorized to open a document. See Section 3.5,
Encryption, in the PDF Reference for more information on the encryption used in PDF files.
Each stream or string object in a PDF file is individually encrypted. This level of encryption
improves performance because objects can be individually decrypted as needed rather
than decrypting an entire file. All objectsexcept for the encryption dictionary (which
contains the security handlers private data)are encrypted using the RC4 algorithm
Adobe licenses from RSA Data Security, Inc. Plug-ins may not substitute another encryption
scheme for RC4.
A plug-in that implements a security handler is responsible for encrypting the values it
places into the encryption dictionary, and it may use any encryption scheme. If the security
handler does not encrypt the values it places into the encryption dictionary, the values are
in plain text.
The core API provides two Cos layer methods to encrypt and decrypt data using the RC4
algorithm from RSA Data Security, Inc: CosEncryptData and CosDecryptData.
Security handlers may use these methods to encrypt data they want to put into the PDF
files encryption dictionary and decrypt data when it is read from the dictionary. Security
handlers may instead choose to ignore these methods and use their own encryption
algorithms.

Acrobat and PDF Library API Overview 441


Document Security
12
Security Handlers

Security Handlers
The code that performs user authorization and sets permissions is known as a security
handler. The core API has one built-in security handler. This security handler supports two
passwords:
A user password that allows a user to open and read a protected document with
whatever permissions the owner chose
An owner password that allows a documents owner to also change the permissions
granted to users
Plug-ins can use the core APIs built-in security handler, or they can write their own security
handlers to perform user authorization in other ways (for example, by the presence of a
specific hardware key or file, or by reading a magnetic card reader). A security handler
provided by a plug-in can use Acrobats built-in dialog boxes for entering passwords and
for changing permissions.
Security handlers are responsible for:
Setting permissions on a file.
Authorizing access to a file.
Setting up a files encryption and decryption keys.
Maintaining the encryption dictionary of the PDF file containing the document.
Security handlers are used when:
A document is opened The security handler must determine whether a user is
authorized to open the file and set up the decryption key that is used to decrypt the PDF
file. See Opening a File on page 445.
A document is saved The security handler must set up the encryption key and write
whatever extra security-related information it wants into the PDF files encryption
dictionary. See Saving a File on page 447.
A user tries to change a documents security settings The security handler must
determine whether or not the user is permitted to do the operation. See Setting a
Documents Security on page 447.
A document may have zero, one, or two security handlers associated with it. A document
has zero security handlers if no security is used on the file. When security is applied to a file,
or the user selects a different security handler for a secured file, the newly-chosen security
handler is not put in place immediately. Instead this new security handler is simply
associated with the document; it is a pending security handler until the document is saved.
The new security handler is not put in place immediately because it is responsible for
decrypting the contents of the documents encryption dictionary, and that dictionary is re-
encrypted in the correct format for the new security handler only when the document is
saved. As a result, a document may have both a current and a new security handler
associated with it.

442 Acrobat and PDF Library API Overview


Document Security
12
Security Handlers

NOTE: In Acrobat 5.0, the Save or Save As... menu item can be used to save the file. On
Acrobat versions prior to 5.0, the file must be saved with Save As for reasons
described in Saving a File on page 447.
A security handler has two names: one that is placed in each PDF file that is saved by the
handler (for example, ADBE_Crypt), and another name that Acrobat can use in any user
interface items in which the security handler appears (for example, Acrobat Developer
Technologies default encryption). This is similar to the two-name scheme used for menu
items: a language-independent name that the code can refer to regardless of the user
interface language, and another name that appears in the user interface. See Chapter 2,
Registering and Using Plug-in Prefixes, in the Acrobat SDK Plug-in Guide for details on plug-
in naming conventions.

Adding a Security Handler


Acrobat has a built-in security handler. Plug-ins can add other security handlers by:
Writing a set of callback routines to perform security-related functions.
Specifying the callbacks in a PDCryptHandlerRec structure. See the description of
PDCryptHandlerRec in the Acrobat and PDF Library API Reference for details on each
of the security handler callbacks.
Registering the handler by passing the structure to PDRegisterCryptHandlerEx
NOTE: PDRegisterCryptHandlerEx was introduced with Acrobat 5.0, and is the
same as PDRegisterCryptHandler but accepts an extra parameter for storing
client data. There are a number of callbacks in the PDCryptHandlerRec structure
which have similar names except for the addition of Ex. In general, the Ex calls are
newer and should be preferred but the older ones are still allowed for for
compatibility. This chapter generally refers to only one of the routines, for
convenience.
Data Used By Security Handlers
The following sections refer to three types of data used by security handlers:
Authorization data is the data the security handler needs to determine the users
authorization level for a particular file (for example, not authorized to open the file,
authorized to access the file with user permissions, authorized to access the file with
owner permissions). Passwords are a common type of authorization data.
Security data is whatever internal data the security handler wants to keep around. It
includes security info, and perhaps internal state variables, internal flags, seed values,
and so on.
Security info is a subset of the security data. Specifically, it is a collection of flags that
contains the information that Acrobat uses to display the current permissions to the
user. This information includes permissions and the users authorization level (user or
owner).

Acrobat and PDF Library API Overview 443


Document Security
12
Security Handlers

Security Handler Callbacks


A security handler must provide callbacks that:
Determine whether a user is authorized to open a particular file and what permissions
the user has once the file is open (PDCryptAuthorizeExProc).
Create and fill an authorization data structure, using whatever user interface is needed
to obtain the data (displaying a dialog into which the user can type a password, for
example) (PDCryptGetAuthDataExProc).
Create, fill, and verify a security data structure (PDCryptNewSecurityDataProc).
Extract the security information from the security data structure
(PDCryptGetSecurityInfoProc) (optional)
Allow the user to request different security settings, usually by displaying a dialog box.
(PDCryptDisplaySecurityDataProc)
Set up the encryption key used to encrypt the file (PDCryptNewCryptDataProc).
Fill (PDCryptFillEncryptDictProc) or read the PDF files encryption dictionary.
Display the current documents permissions (required with the Acrobat 5.0 callbacks
PDCryptAuthorizeExProc and PDCryptGetAuthDataExProc).

New Security Features in Acrobat 5.0


With Acrobat 5.0 and higher, a finer granularity of permissions has been predefined for the
objects supported by a PDF document. Plug-ins can call the PDDocPermRequest
method to request whether a particular operation is authorized to be performed on a
specified object in a document. For details, see Querying PDDoc Permissions on
page 313. Earlier Acrobat versions supported a much more limited set of permissions (an
OR of the PDPerms values listed in the Acrobat and PDF Library API Reference) that a plug-in
could request using the PDDocGetPermissions method.
To support the PDDocPermRequest method, two new callback methods
PDCryptAuthorizeExProc and PDCryptGetAuthDataExProc also were
introduced with Acrobat 5.0. These callbacks replace the PDCryptAuthorizeProc and
PDCryptGetAuthDataProc callbacks, respectively.
NOTE: Acrobat 5.0 continues to support security handlers written with the
PDCryptAuthorizeProc and PDCryptGetAuthDataProc callback
methods. If a security handler does not support the newer methods, Acrobat calls
the older ones and interprets the results.
Acrobat 5.0 also includes optional security handling for batch operations (operations on
one or more files). There are a number of new callbacks (indicated by PDCryptBatch...
) that a security handler should provide to support batch processing. These callbacks are
part of a PDCryptBatchHandler structure. The PDCryptHandlerRec structure
contains a new member CryptBatchHandler, which points to this structure. To support
batch processing, a security handler should provide a non-NULL value for
CryptBatchHandler, and implement the batch callbacks

444 Acrobat and PDF Library API Overview


Document Security
12
Security Handlers

Prior to Acrobat 5.0, the maximum length of the encryption key that Acrobat accepted was
40 bits. Acrobat version 5.0 or higher accommodates an encryption key length of 128 bits.
These length limitations are imposed to comply with export restrictions.

Opening a File
The core API has several methods for opening files. PDDocOpen, or PDDocOpenEx
(introduced with Acrobat 5.0 and containing an additional parameter) is always used to
open PDF files, even when a plug-in calls AV layer methods such as
AVDocOpenFromASFileWithParams. As a result, the sequence of operations is largely
the same regardless of whether the document is being opened from the PD layer or from
the AV layer. The difference is that if you call PDDocOpen directly, you must pass your own
authorization procedure (PDAuthProc), while AV layer methods always use Acrobats
built-in authorization procedure . (See Acrobats Built-in Authorization Procedure on
page 446.)
The authorization procedure must implement the authorization strategy, such as giving the
user three chances to enter a password. The PDAuthProc is not part of a security handler,
but it must call the security handlers methods to authorize the user (for example, to get the
password from the user and to check whether or not the password is valid).
The security-related steps to opening a file are:
1. Acrobat looks for an Encrypt key in the PDF documents trailer, to determine whether or
not the document is encrypted. If there is no Encrypt key, Acrobat opens the document
immediately.
2. If there is an Encrypt key, its value is an encryption dictionary. Acrobat gets the value of
the Filter key in the dictionary to determine which security handler was used when the
file was saved. It looks in the list of registered security handlers (which contains
Acrobats built-in handler and any handlers that plug-ins or applications have
registered) for one whose name matches the name found in the PDF file.
3. If Acrobat finds no match, indicating that the necessary handler could not be found, it
does not open the document.
If it finds a matching security handler, it calls that handlers
PDCryptNewSecurityDataProc callback to extract and decrypt information from
the PDF files encryption dictionary.
4. Acrobat calls the security handlers authorize callback (PDCryptAuthorizeExProc)
with NULL authorization data, and with the requested permissions set to
PDPermReqOprOpen or pdPermOpen (requesting that the user be allowed to open
the file). This allows support for authorization schemes that do not need authorization
data. For details, see Acrobats Built-in Authorization Procedure on page 446.
5. If authorization succeeds, the handlers authorization callback must return the
PDPermReqStatus (when the callback is PDCryptAuthorizeExProc) or
pdPermOpen (when the callback is PDCryptAuthorizeProc) indicating that the
user is permitted to open the file.

Acrobat and PDF Library API Overview 445


Document Security
12
Security Handlers

6. If authorization fails, the authorization procedure passed in the call to open the PDDoc
is called.
NOTE: This authorization procedure is not the same as the security handlers authorize
callback, although it must, at some point, call the security handlers callback. (All
AV layer file opening methods use Acrobats built-in authorization procedure.)
7. If authorization still fails, the file is not opened.
8. If authorization succeeds, Acrobat calls the security handlers
PDCryptNewCryptDataProc callback to create the decryption key that is used to
decrypt the file. The PDCryptNewCryptDataProc callback can construct the
decryption key in any way it chooses, but generally performs some calculation based on
the contents of the security data structure filled previously by the handlers
PDCryptNewSecurityDataProc callback.

Acrobats Built-in Authorization Procedure


Acrobats built-in authorization procedure works as follows:
1. It calls the security handlers authorize callback (which is either
PDCryptAuthorizeExProc, introduced with Acrobat 5.0, or the older
PDCryptAuthorizeProc) to request that the user be allowed to open the file. It
passes NULL authorization data, to handle the case where no authorization data is
needed. It also passes:
PDPermReqObjDoc and PDPermReqOprOpen when calling
PDCryptAuthorizeExProc.
pdPermOpen when calling PDCryptAuthorizeProc.
2. If the authorize callback returns true, the file is opened. Otherwise, the authorization
procedure executes the following steps up to three times, to give the user three chances
to enter a password, or whatever authorization the security handler uses.
It calls the security handlers get authorization data callback
(PDCryptGetAuthDataExProc or the older PDCryptGetAuthDataProc).
This callback should obtain the authorization data using whatever user interface (a
dialog box to obtain a password, for instance) or other means necessary, and then
create and fill the authorization data structure.
It calls the security handlers authorize callback, passing the authorization data
returned by the get authorization data callback. If authorization succeeds, the
authorize callback returns the permissions granted to the user, and the authorization
procedure returns.
NOTE: The security handlers authorize callback should use only the authorization data
passed to it from the get authorization data callback. It should not, for example,
display a dialog box itself to obtain a password from the user.
The authorize callback can access the encrypted PDF document, allowing it to encrypt the
authorization data using a mechanism that depends on the documents contents. By doing
this, someone who knows one documents password cannot easily find out which other

446 Acrobat and PDF Library API Overview


Document Security
12
Security Handlers

documents use the same password. The authorize callback can return permissions that
depend on the password as well as the permissions specified when encryption was set up.
This allows, for example, more rights to be granted to someone who knows a documents
owner password than to someone who knows the documents user password.

Saving a File
When saving a file, it is important to keep in mind that:
When a user selects document encryption for the first time or has selected a different
security handler for an already encrypted file, the newly-selected handler does not take
effect until the document is saved.
To be allowed to save a file, the user must have PDPermReqOprModify (available
with Acrobat 5.0 and higher) or either pdPermEdit or pdPermEditNotes
permission.
In Acrobat 5.0 and above, File->Save As and File->Save both force a complete encrypted
copy of the file to be written.In Acrobat versions prior to 5.0, users must use Save As to
save a file in an encrypted form for the first time, or when a different security handler
was selected for an already encrypted file. Save did an incremental update, so only the
last changes made to the file would be encrypted, and the remainder of the document
would still be usable by anyone (or would not be able to be decrypted by the newly-
selected security handler).
When a secured file is saved:
If the file is being saved in an encrypted form for the first time or if a different security
handler is selected, Acrobat calls the new security handlers
PDCryptNewSecurityDataProc callback. This action creates a new copy of the
new security handlers security data structure.
If the file is being saved in an encrypted form for the first time or if a different security
handler is selected, Acrobat calls the new security handlers
PDCryptUpdateSecurityDataProc callback. This presents whatever user
interface the security handler has for enabling the user to set permissions.
Acrobat calls the new security handlers PDCryptFillEncryptDictProc callback
to encrypt and write into the PDF files encryption dictionary whatever data the security
handler wants to save in the PDF file.
Acrobat writes out the encrypted file.
Acrobat sets the new security handler as the documents current security handler.

Setting a Documents Security


Acrobat calls the new security handlers PDCryptUpdateSecurityDataProc callback
to present whatever user interface the security handler has for allowing the user to set
security, passwords, and so forth.

Acrobat and PDF Library API Overview 447


Document Security
12
Implementation Examples

When security is set, the security handler obtains the permissions and authorization data
(such as passwords) to be used for the file. The settings do not take effect until the file is
saved, as described in the previous item
NOTE: In Acrobat 5.0, users select File-> Document Security... to set security. On Acrobat
versions prior to 5.0, the user set security using the Security button in the Save As...
dialog.

Implementation Examples
This section describes the sequence of callbacks and how they would be used by a plug-in
that uses public-private key technology.

Saving a File With a New Encryption Dictionary


To save a file with a new encryption dictionary, the following callbacks in the
PDCryptHandlerRec are used:
1. PDCryptNewSecurityDataProc creates and initializes a security data structure. It
is called with encryptDict (a Cos object) set either to NULL or to a valid encryption
dictionary, in which case the fields of the encryption dictionary are read and placed into
the security data structure.
2. PDCryptUpdateSecurityDataProc gets the current security data structure by
calling the PDDocGetNewSecurityData method. It then makes a copy of the
structure with which to work. This new copy is freed if an error or cancel condition is
encountered. The user is requested to log in to their PKI infrastructure to access the
users keys and certificates.
If the security data structure was seeded with information from encryptDict, an
internal authorize procedure is called. This procedure decrypts and examines the data
fields in the security data structure copy that are set to indicate the users permissions
and, possibly, information relating to the document symmetric key.
A user interface is provided to enable your plug-in to specify a list of recipients for the
document. If all goes well, the secDataP argument to
PDCryptUpdateSecurityDataProc is set to the copy of the security data
structure, and Acrobat frees the original security data structure.
3. PDCryptFillEncryptDictProc writes data from the security data structure into
the encryption dictionary. When Acrobat is done with the security data structure, it calls
the PDCryptFreeSecurityDataProc.

Opening an Encrypted File


To open an encrypted file, the following callbacks in the PDCryptHandlerRec are used:

448 Acrobat and PDF Library API Overview


Document Security
12
Utility Methods

1. PDCryptNewSecurityDataProc is called as described in the previous section.


2. PDCryptAuthorizeExProc is called and returns NULL since the authorization
permissions have not been determined. This callback should not present any user
interface.
3. PDCryptGetAuthDataExProc. The plug-in does not use the authorization data
structure, but instead only the security data structure. It calls an internal authorization
procedure that determines the authorization level of the logged-in user. This
authorization procedure is the same procedure as is called by
PDCryptUpdateSecurityDataProc in the previous section.
4. PDCryptAuthorizeEx or PDCryptAuthorize. The authorization permissions
have now been established (by the call to get the authorization data) and are returned.
Acrobat will then open the file.

Utility Methods
These user interface utility methods are provided for Acrobat:

AVCryptGetPassword Displays Acrobats standard dialog box that prompts a


user to enter a password. Plug-ins can use this method
to obtain a users password when opening a file.
AVCryptDoStdSecurity Displays a security dialog to the user, allowing the user
to change the documents permissions.

Acrobat and PDF Library API Overview 449


Document Security
12
Utility Methods

450 Acrobat and PDF Library API Overview


13 Handling Errors

Most Acrobat core API methods do not return error codes, but raise exceptions when errors
occur. Exceptions are handled by exception handlers. Acrobat provides a default exception
handler, but this handler is not able to back gracefully out of an unfinished operation.
Therefore, plug-ins should add their own exception handlers to trap and handle various
exceptions, typically performing some cleanup (such as releasing memory) when an
exception occurs. Your exception handler can either absorb the exception or re-raise the
exception to pass it along to the next handler on the exception handler stack.

Exception Handlers
Plug-ins can use the DURING, HANDLER, and END_HANDLER macros to define exception
handlers. The code for which an exception handler is to be active appears between the
DURING and HANDLER macros, while the exception handler code appears between the
HANDLER and END_HANDLER macros. For example, the following code declares an error
handler that is active only during the call to AVDocOpenFromFile:
DURING
avd = AVDocOpenFromFile(asp, NULL, (char *)NULL);
HANDLER
avd = NULL;
errorCode = ERRORCODE;
AVAlertNote("Error opening file");
END_HANDLER
If the method raises an exception, the handler code is executed; otherwise it is not
executed. In the example shown, the handler sets the value of two variables and displays an
error message to the user.
When an exception occurs, your handler can access the exception error code by using the
ERRORCODE macro. The value returned by the ERRORCODE macro does not change until
another exception is raised.
The exception error code contains the following information:
Severity
Exception system
Error number

Acrobat and PDF Library API Overview 451


Handling Errors
13
Exception Handlers

Your exception handler can use all of this information to decide how to respond to the
exception.Your plug-in can extract information from an exception code with macros listed
in the following table:

TABLE 13.1 Exception handling macros

ERROR CODE Defined in Description


ErrGetSeverity AcroErr.h Gets the severity of the error where severity is
one of the following:
ErrNoError - No error
ErrWarning - Warning
ErrSilent - Do not display a message
ErrSuppressable - Display a message if
the user has not suppressed errors
ErrAlways - Always display a message,
even if others are suppressed
ErrGetSystem AcroErr.h Gets the system that raised the exception,
where system is one of the values listed in
Table 13.2.
ErrGetCode AcroErr.h Gets the error number. Acrobats built-in
ErrGetSignedCode exceptions are defined in AcroErr.h. Use
ErrGetSignedCode if the platform
considers error codes to be signed.
ErrBuildCode AcroErr.h Builds an error code, given the severity,
system, and error number
RERAISE CorCalls.h Re-raises the most recently raised exception
and passes it to the next exception handler in
the stack.

TABLE 13.2 Exception system names

Name Description
ErrSysNone General error and out of memory error

ErrSysCos CosStore filters

ErrSysCosSyntax Cos syntax errors

ErrSysPDDoc PDDoc and family, Page tree, outlines

ErrSysPDPage PDPage and family, thumbs, annots

452 Acrobat and PDF Library API Overview


Handling Errors
13
Exception Handlers

TABLE 13.2 Exception system names

Name Description
ErrSysPDMetadata XMP Metadata

ErrSysPDModel Global PD model

ErrSysAcroView AcroView

ErrSysPage Page parsing and RIPing

ErrSysPDFEdit PDFEdit

ErrSysPDSEdit PDSEdit

ErrSysFontSvr Font server

ErrSysRaster Rasterizer

ErrSysASFile ASFile I/O

ErrSysXtn Errors registered by plug-ins are automatically assigned to this


error system
ErrSysXtnMgr Extension Manager

ErrSysMDSystem Platform-specific system errors

ErrSysMDApp Platform-specific application errors

The following code example illustrates an exception handler that simply determines which
system raised an exception and displays that information in a dialog box:
switch(ErrGetSystem(ERRORCODE))
{
case ErrSysNone: strcpy(msg, "No memory");break;
case ErrSysCos: strcpy(msg, "CosStore");break;
case ErrSysCosSyntax: strcpy(msg, "Cos syntax");break;
case ErrSysPDDoc: strcpy(msg, "PDDoc");break;
...
default: strcpy(msg, "Unknown system");break;
}
AVAlertNote(msg);

Acrobat and PDF Library API Overview 453


Handling Errors
13
Raising Exceptions

R ai s i n g E xce p t i o n s
In addition to handling exceptions Acrobat raises, plug-ins can use ASRaise to raise
exceptions. Plug-ins can raise any of the exceptions that Acrobat has defined, or they can
raise their own exceptions.
NOTE: Your plug-in should use the ASRegisterErrorString method to define its
own exceptions.
Use the RERAISE macro (see Table 13.1) when you do not want your exception handler to
handle an exception, but want to pass the exception to the next exception handler on the
stack.
NOTE: If code that calls ASRaise gets control as a result of a non-Acrobat event (such as a
drag and drop event on some platforms), ASRaise fails. There is no Acrobat code in
the stack to handle the exception.

Handling an Exception Later


You may have situations where there is some clean-up code that needs to be executed
regardless of whether an error was raised along the way. Heres a way to handle this:
ASInt32 err = 0;
...
DURING
...
HANDLER
err = ERRORCODE;
END_HANDLER
/* free, clean up, etc. */
...
if (err) ASRaise(err);

Returning From an Exception Handler


To return from a method within a DURING...HANDLER block, do not use a return
statement. Instead, use the following macros (defined in CorCalls.h):
E_RETURN(x) returns the value x
E_RTRN_VOID does not return a value
These macros remove stack entries added to the stack by the DURING macro. (They must
not be used outside a DURING/HANDLER block.) Using return instead would cause the
stack to be in an inconsistent state.

454 Acrobat and PDF Library API Overview


Handling Errors
13
Returning From an Exception Handler

The following code example illustrates the use of the E_RTRN_VOID macro (the error
handler in this example simply displays an alert dialog):
DURING
pdDoc = AVDocGetPDDoc(avDoc);
rootBm = PDDocGetBookmarkRoot(pdDoc);
if(PDBookmarkIsValid(rootBm)){
parentBm = PDBookmarkGetByTitle(rootBm, "Contents", 8, 1);
if(PDBookmarkIsValid(parentBm)){
pdAction = PDBookmarkGetAction(parentBm);
if (!PDActionIsValid(pdAction))
E_RTRN_VOID
dest = PDActionGetDest(pdAction);
if (!PDViewDestIsValid(dest))
E_RTRN_VOID
PDViewDestGetAttr(dest, &fit, &initRect, &zoom);
pageNum = PDViewDestGetPageNumber(dest, pdDoc) + 2;
} else {
AVAlertNote("No Contents Bookmark");
E_RTRN_VOID
}
} else {
AVAlertNote("No Root Bookmark");
E_RTRN_VOID
}
HANDLER
AVAlertNote("Exception raised");
return;
END_HANDLER

The E_RETURN(x) macro must not call a function that might raise an exception. For
example:
E_RETURN(foo())
is dangerous, if theres any possibility that foo could raise an exception. The reason is that
E_RETURN pops an exception frame off the stack before evaluating the expression to be
returned. If this evaluation raises an exception, it does not call your handler. Instead it calls
the next handler up the stack.
Therefore, if you need to call a function, it is best to do it this way:
result = foo();
E_RETURN(result);
This way, if foo raises an exception, your handler will be executed.

Acrobat and PDF Library API Overview 455


Handling Errors
13
API Methods That Raise Exceptions

API Methods That Raise Exceptions


The Acrobat and PDF Library API Reference specifies some of the exceptions that may be
raised by each method. However, it should not necessarily be considered a comprehensive
list.
There are several general rules in determining which exceptions may be raised by methods:
Methods that create new objects or otherwise allocate memory can generally raise out-
of-memory exceptions.
Cos methods can generally raise exceptions if storage is exhausted or file access fails.
ASFile methods generally do not raise exceptions, unless otherwise specified.
When in doubt, assume that a method can raise exceptions and surround it with a
DURING/HANDLER/END_HANDLER construct to handle any exceptions that may be
raised.

Exception Handler Caveats

Do Not Use goto In a DURING...HANDLER Block


Jumping outside a DURING HANDLER block disrupts the stack frame, as in this bad
example:
DURING
...
goto error;
HANDLER

END_HANDLER

error:
This is a bug: the top stack frame has not been popped, so the frame is incorrect. Instead,
the following makes sure the stack frame is set up correctly:
DURING
...
ASRaise(myspecialerrorcode);
...
HANDLER
if ERRORCODE == myspecialerrorcode
goto error;
END_HANDLER

error:

456 Acrobat and PDF Library API Overview


Handling Errors
13
Exception Handler Caveats

Do Not Nest Exception Handlers In a Single Function


In general, do not nest exception handlers within a single function. The exception handling
macros change the call stack, and nesting them can disrupt the stack.
Your plug-in can safely nest an exception handler if the nested handler is in another
function called inside the DURING HANDLER block, as in the following example:
DURING
...
MyFunction();
...
HANDLER
...
END_HANDLER
...
void MyFunction(void) {
...
DURING
...
HANDLER
...
END_HANDLER
...
}
If you insist on nesting exception handlers in a single function, do not return from the inner
exception handler (either through a call to return in a handler or E_RETURN from body
code). This would leave the exception stack out of sync with the call stack. Any errors raised

Acrobat and PDF Library API Overview 457


Handling Errors
13
Exception Handler Caveats

in body code surrounded by the outer exception handler will restore the incorrect calling
environment and lead to unpredictable results. For example:
{
DURING /* Places one frame on the exception stack */
pdoc = AVDocGetPDDoc(avdoc);
DURING /* Places a second frame on the stack */
rootBm = PDDocGetBookmarkRot(pdDoc);
if (!PDBookmarkIsValid(rootBm)){
E_RTRN_VOID
/*
Returning here messes up the exception stack
because two frames have been placed on the stack
and E_RTRN_VOID only clears one of them before
returning
*/
}
pdAction = PDBookMarkGetAction(parentBm);
HANDLER
AVAlertNote("Bad AVDoc");
return (1);
/*
Returning here messes up the exception stack
because there is still a frame on the stack from
the outer DURING macro and it will not be cleared
before the function returns
*/
END_HANDLER
HANDLER
AVAlertNote("Bad PDDoc");
END_HANDLER
}

Be Careful About Register Usage


The DURING and HANDLER macros use the standard C setjmp/longjmp mechanism.
The DURING macro calls setjmp. An exception results in a longjmp to the context that
was saved by the most recent setjmp. When a longjmp occurs, all registers, including
those containing variables the compiler optimized into register variables, are restored to
the values they held when the setjmp occurred.
As a result, the state of local variables that have been optimized into registers is
unpredictable when the exception handler is invoked. To avoid this situation, declare all
variables that are set in the main body of the code and used in the exception handler or
beyond (if the handler lets execution continue) as volatile. This ensures that they are
never optimized into register variables, but are always referenced from memory.
NOTE: Memory access is generally substantially slower than register access, so
performance may be compromised if a variable is referenced frequently. Therefore,

458 Acrobat and PDF Library API Overview


Handling Errors
13
Exception Handler Caveats

plug-ins should only declare as volatile variables whose value is needed in the
exception handler or beyond.
When using volatile, be sure to place the keyword in the correct location, for example:
volatile myStruct* p = 0;
declares the instance of the structure to be volatile, while
myStruct* volatile p = 0;
declares the pointer itself to be volatile. In general, the second form is the one to use.

Acrobat and PDF Library API Overview 459


Handling Errors
13
Exception Handler Caveats

460 Acrobat and PDF Library API Overview


14 Changes To This Document For
Recent Revisions

Changes in This Document for 6.0


Revised Acrobat Software Development Kit Documentation Roadmap
Updated references to the PDF Reference.
Updated to introduce the following major new features that were added to the core API
in Acrobat version 6.0:
Programmatic time and date manipulation (ASDate, ASTimeSpan)
Improved platform-independant path and file addressing (ASPlatformPath)
Programmatic control of undo/redo functionality (AVUndo)
Cos object collections for improved efficiency (CosObjCollection)
Creation and manipulation of optional content (layers) in a PDF (PDOCConfig,
PDOCContext, PDOCG, PDOCMD)

API Changes in Acrobat 6


There were roughly 400 new APIs in Acrobat 6, and many existing APIs were modified. New
APIs in Acrobat 6 fell into the following general categories. See Appendix G, API Changes
for details.
Compound documents Acrobat 6 supports the importing of many different file
formats. Acrobat 6 can serve as a single repository/display mechanism for a rich variety
multimedia types, graphic formats, and fonts. See the PDFBinder plug-in sample.
Layers/optional content Acrobat 6 brings layered content and conditionalized
display of information to Acrobat for the first time. The new PDOCG object and its
associated APIs are used to implement this new optional-content grouping capability.
New text and font handling capabilities Acrobats text manipulation API has been
enhanced with the new PDETextItem API. Text manipulation has also been enhanced
with expanded support for the ASText object (most character strings are now handled
as ASText objects rather than as C-style character strings). Support for Unicode has
been expanded.
Digital signatures A new public security API has been added to enable third-parties
to more effectively use the Acrobat authentication capability. This new API, PubSec, is
actually a layer above DigSig and relies on it. The DigSig API can still be used if
required. Support for Microsofts CryptoAPI (MSCAPI) on Windows provides tight
integration with Microsofts security API. See the DocSign sample plug-in.

Acrobat and PDF Library API Overview 461


Changes To This Document For Recent Revisions
14
Changes in This Document for 7.0

Security/encryption Support for document security has been enhanced from the API
level, mostly through the addition of more cryptographic filters. Certified documents
have their own security model.
Review and commenting Support for annotations has been extended.
Text extraction and manipulation (new Wordy algorithm) More powerful text search
and manipulation capabilities have been added to the API with enhancements to
WordFinder.
Color management The Adobe AcroColor API, while present in earlier versions of
Acrobat, has been exposed in Acrobat 6.
New printing APIs Support for separations and an accompanying API has been added
to Acrobat 6.
Object compression API The PDF file format has been modified to enable powerful
compression techniques to be applied to PDF files, resulting in much smaller file sizes.
Access to these capabilities are provided through the API. The new CosObjCollection API
provides support for this compression.
Document level undo/redo stack The API has been expanded to support multiple
undo/redo.
New metadata calls Support for Acrobats metadata API has been expanded.
Date and time API Acrobat now provides a cross-platform date and time API.
UUID API Support has been included for Universal Unique IDentifiers.
New enterprise installer capabilities Enterprise installation of Acrobat 6 has been
made more flexible, including the ability to allow third parties to have their plug-ins
automatically installed through the Acrobat updater.
Save PDF files as XML A new plug-in enables users to save any PDF file as an XML file.
You must, however, provide your own DTD, which will be selectable from Save As.... See
Using the Save as XML Plug-in.
Help system enhancements Plug-in developers can now write help systems to
support their plug-ins directly from within Acrobat using the How To window. Support
for PDF-based help has been expanded. See Acrobat Help for details.

Changes in This Document for 7.0


NOTE: With version 7, this document now provides an overview of the entire Acrobat/PDF
Library API, including the extended APIs. This corresponds to the revised Acrobat
and PDF Library API Reference, which now also documents the entire API in a single
volume.
Removed Acrobat Software Development Kit Documentation Roadmap
Added material from Acrobat Core API Reference that could not be moved to header files
from the Acrobat 6 version of the document.

462 Acrobat and PDF Library API Overview


Changes To This Document For Recent Revisions
14
Changes in This Document for 7.0

Added material from PDF Library Supplement to the Acrobat Core API Reference that could
not be moved to header files from the Acrobat 6 version of the document.
Added material from AcroColor API Reference, Catalog API Reference, Digital Signature API
Reference, Forms API Reference, PDF Consultant Accessibility Checker, Search API Reference,
Spelling API Reference, and Weblink API Reference that could not be moved to header files
from the Acrobat 6 versions of the documents.
Updated references to the PDF Reference.
Updated individual API tables with comprehensive lists and descriptions of all APIs.
Updated to introduce the following major new features that were added to the API in
Acrobat version 7.0 (see Appendix G, API Changes for details):
Support for 64-bit filesizes
New graphics objects: PDEImageFlate, PDEImageJPX
New Cos-level APIs used to create strings instead of using ASAtoms
New APIs to support thread safety
New APIs to support opening multiple windows on the same document
New APIs to support object data
New member in PDDocSaveParams (numSubFilesToCompact) for use with
new auto-save feature
New callback AVAnnotHandlerGetAccessibilityStringProc for
accessible annotations
New search options in Search extended API (SearchWordOptions adds support
for searching object data and attachments)
Ubiquity permissions are now enforced in Acrobat (previously they were enforced in
Reader only). To handle the permissions issues raised by this, a new API was added:
PDDocPermRequestNoUB.

Acrobat and PDF Library API Overview 463


Changes To This Document For Recent Revisions
14
Changes in This Document for 7.0

464 Acrobat and PDF Library API Overview


A Object Interrelationships

The following figures show how various object types can be obtained from other object
types. Use them to help you find your way among the objects in the Acrobat core API.

FIGURE A.1 File I/O Object Interrelationships

AVDoc

ASGetDefaultFileSys

AVDocOpenFromFile
AVDocOpenFromFileWithParams
AVDocOpenFromASFileWithParams
PDDocOpen
ASFileGetFileSys( )
PDDoc ASFile ASFileSys
PDDocGetFile
ASFileSysOpenFile
ASFileAcquirePathName
ASFileSysCopyPath PDFileSpecGetFileSys
PDFileSpecAcquireASPath
ASPathName PDFileSpec
PDFileSpecNewFromASPath

ASFileSysDIPathFromPath ASFileSysPathFromDIPath PDFileSpecGetCosObj

PDFileSpecFromCosObj
Device-independent CosObj
pathname PDFileSpecGetDIPath

Acrobat and PDF Library API Overview 465


Object Interrelationships
A

FIGURE A.2 Document Object Interrelationships

PDDocCreate CosDoc

PDDocGetCosDoc

PDDocOpen PDDoc
AVDocGetPDDoc
AVDocOpenFromPDDoc
ASFile & AVDocOpenFromPDDocWithParams
ASFileSys
PDDocGetFile

AVDocOpenFromFile AVDoc
AVDocOpenFromFileWithParams
AVDocOpenFromASFileWithParams

AVDocGetAVWindow AVDocGetPageView AVPageViewGetAVDoc

AVPageView
AVWindow

466 Acrobat and PDF Library API Overview


B Portable Document Format

This Appendix provides a brief overview of PDF and the PDF structures. For details, see the
PDF Reference.

Relationship of Acrobat and PDF Versions


The following table shows how Acrobat and PDF versions are linked.

TABLE B.1 PDF to Acrobat Version Compatibility

PDF Version Acrobat Version


1.0 2.0
1.1 2.1
1.2 3.0
1.3 4.0
1.4 5.0
1.5 6.0
1.6 7.0

Introduction To PDF
PDF is a means of representing text and graphics using the imaging model of the PostScript
language. It describes the imaging required to draw a page or a collection of pages. A PDF
file draws a page by placing paint on selected areas. Starting with a blank page, the page
is drawn by using various marking operators to place marks on the page. Each new mark
overlays any previous marks. Marks are painted figures defined by letter shapes (text)
regions defined by combinations of lines and curves (line art), or sampled images
(photographs or images). Unlike PostScript, a full language that is programmable, PDF does
not contain procedures, variables, or control constructs. PDF uses a pre-defined set of
high-level marking operators that can describe pages.
PDF handles images through image compression filters such as JPEG for color and
grayscale images; CCITT Group 3 and Group 4, LZW, and Run Length compression for
monochrome images; and LZW compression for text and graphics.

Acrobat and PDF Library API Overview 467


Portable Document Format
B
PDF Objects

Fonts for text are described by a font descriptor. The font descriptor includes the font name,
character metrics, and style information. This allows the accurate display of any fonts used
in the document that may be missing on the readers system.
The following table shows the objects and structures of a PDF file.

FIGURE B.1 PDF File Structure

Objects
(Basic Objects: Booleans, Numbers, Strings,
Names, Arrays, Dictionaries, Streams, Filters)
Page Description
(PDF Operators
File Structure that describe
(Header, Body, Cross-reference Tables, Trailer) text, graphics,
and images)

Document Structure
(Catalog, Pages Tree, Pages, Imagable Content,
Thumbnail, Annotation, Outline Tree, etc.)

PDF Objects
The object types supported in PDF are similar to those supported by the PostScript
language. There are seven basic types: booleans, numbers, strings, names, arrays,
dictionaries, and streams, as well as a null object. Objects can be labeled and referred to by
an ID (indirect objects).

File Structure
The PDF file structure consists of four sections: header, body, cross-reference table and a
trailer. No line in a PDF file (except for those that are part of stream data) can be longer than
255 characters, and a line is delimited by a carriage return and linefeed, or a carriage return.
The following table illustrates the structure of a PDF file.

468 Acrobat and PDF Library API Overview


Portable Document Format
B
File Structure

FIGURE B.2 File Structure of a PDF File (not updated)

Header

Body

Cross-reference Table

Trailer

The one-line header specifies the version number of the PDF specification used in the file.
The body is a sequence of indirect objects (labeled objects) that describe the document.
The objects are the basic PDF Object types (numbers, strings, dictionaries, etc.). The %
symbol indicates a comment in the PDF file.
The cross-reference table contains information that enables random access to indirect
objects in the file. For each indirect object, there is a one-line entry in the table that gives
the location of the object in the file. To facilitate access to pages in a multi-page document,
the cross-reference table can be used to locate and directly access pages and other objects
in the document file.
The trailer includes the number of entries in the cross-reference table, a pointer to any
other cross-reference sections, a catalog object for the document, and an info dictionary
(optional) for the document.
The PDF file is read from back to front and the trailer information permits the quick location
of the cross-reference table, which in turn enables quick location of any object in the
document.
A PDF file can be updated without rewriting the entire contents of the file. This is done by
appending changes to the end of the file, while leaving the original contents intact.
NOTE: This may mean that a file with deleted elements will be larger than then original
file. When the PDF file is updated, any new or changed objects are appended, an
additional cross-reference table is added, and a new trailer is inserted. An appended
file structure is shown in the following figure.

Acrobat and PDF Library API Overview 469


Portable Document Format
B
Document Structure

FIGURE B.3 File Structure of PDF File (after updating)

Header

Original Body
Original File Structure

Original
Cross-reference Table

Original Trailer

Body Update 1

Update 1
Cross-reference Section 1

Updated Trailer 1

Body Update n

Update n
Cross-reference Section n

Updated Trailer n

Document Structure
A PDF file contains pages with text, graphics, and images, along with other information
such as thumbnails, text annotations, hypertext links, and bookmarks. It is organized into a
catalog of a page tree and bookmark (or outline) tree, along with the pages, page contents
and bookmark entries, as shown in the following figure.

470 Acrobat and PDF Library API Overview


Portable Document Format
B
Page Contents

FIGURE B.4 Document Structure

Catalog

Pages Outline
tree tree

Page Page Outline Outline


entry entry

Imageable
Thumbnail Annotations
content

Page Contents
A PDF page contents is a sequence of graphic operators that generate marks that are
applied to the current page, overlaying any previously made marks. The following table
describes the four graphics objects.

TABLE B.2 Graphics objects

Object Description
Path An arbitrary shape made of straight lines, rectangles, and cubic curves.
Text One or more character strings that can be placed anywhere on the page
and in any orientation.
Image A set of samples using a specified color model.
XObject A PDF object referenced by name. The three types of XObjects are:
Image

Form

PostScript language form

Acrobat and PDF Library API Overview 471


Portable Document Format
B
Page Contents

472 Acrobat and PDF Library API Overview


C Lists

AVCommand Descriptions (Built-in Commands)


Built-in commands are implemented using the AVCommand object. A new AVCommand is
created using the AVCommandNew API. The following tables summarize the more
commonly-used commands. AVCommand definitions are defined in AVCmdDefs.h. Built-
in commands are organized into groups:
Comments Command Group
Document Command Group
JavaScript Command Group
Page Command Group
PDF Consultant Command Group

Comments Command Group

Comment Command Parameters


Delete All Comments None
DeleteAll
Summarize Comments kCommentsCmdKeySortBy : ASInt32, one of:
Summarize kAVSortByPage
kAVSortByAuthor
kAVSortByModDate
kAVSortByType
kCommentsCmdKeyOutputPath : ASPathName
kCommentsCmdKeySaveWithOriginal : ASBool
If true, the command writes the file to the path
specified by the OutputPath parameter.

Acrobat and PDF Library API Overview 473


Lists
C

Document Command Group

Document Command Parameters


Common parameter for all document kDocCmdKeyLeaveAsIs : kASValueCab
commands "LeaveAsIs" rules apply

474 Acrobat and PDF Library API Overview


Lists
C

Document Command Parameters


Accessibility Checker kAccCheckCmdKeyCreateLog : ASBool
AccessibilityCheck Default is true.
If keypages is selected page and kAccCheckCmdKeyCreateComments : ASBool
AVDoc is NULL, the first page is Default is false.
processed.
kAccCheckCmdKeyFileSys : kASValuePointer
kAccCheckCmdKeyPathText : ASText
Log file destination. If FileSys is NULL, the log file is
written to the destination directory. If PathText is not
specified, the log is written to the same directory as the
source document. If FileSys is supplied, the file is
opened through that file system; otherwise the default is
used.
kAccCheckCmdKeyAlternateText : kASValueBool
Default is true.
kAccCheckCmdKeyLanguageSpecified :
kASValueBool
Default is true.
kAccCheckCmdKeyCharEncodings : kASValueBool
Default is true.
kAccCheckCmdKeyCheckStructure : kASValueBool
Default is true.
kAccCheckCmdKeyFieldDescriptions :
kASValueBool
Default is true.
kAccCheckCmdKeyPages : kASValueInteger
Default is all pages. If keypages is selected page and
avdoc is NULL, the first page is processed.
kAccCheckCmdKeyFromPage : kASValueInteger
Default is 0.
kAccCheckCmdKeyToPage : kASValueInteger
Default is 0.
kAccCheckCmdKeyInBatch : kASValueBool
Controls the dialog.

Acrobat and PDF Library API Overview 475


Lists
C

Document Command Parameters


Document Summary kDocInfoCmdKeyTitle : ASText
GeneralInfo kDocInfoCmdKeySubject : ASText
kDocInfoCmdKeyAuthor : ASText
kDocInfoCmdKeyKeywords : ASText
kDocInfoCmdKeyBinding : ASText
kDocCmdKeyLeaveAsIs : ASCab
All values that are to be left untouched. If cabinet is not
present, or a key is not present, it is assumed to be a valid
value in the cab.
Embed All Thumbnails None
CreateAllThumbs
Print None. If UIPolicy is Interactive, the standard print dialog is
Print displayed; otherwise the default print settings are used.

Remove Embedded Thumbnails None


DeleteAllThumbs
Security kDocCmdsKeyCryptHandler : kASValueAtom
DocSecurity Default is ASAtomNull
kDocCmdsKeySecuritySettings : kASValueCab
Format-specific image extraction commands
Extract Images As JPEG kExtractJpegCmdKeyCompression :
ExtractAsJpeg kASValueInteger, one of:
kJpegCompressionLow
kJpegCompressionMediumLow
kJpegCompressionMedium (default)
kJpegCompressionMediumHigh
kJpegCompressionHigh
kExtractJpegCmdKeyFormat : kASValueInteger,
one of:
kJpegFormatBaseline (default)
kJpegFormatOptimized
kJpegFormatProgressive3
kJpegFormatProgressive4
kJpegFormatProgressive5

476 Acrobat and PDF Library API Overview


Lists
C

Document Command Parameters


Extract Images As PNG kExtractPngCmdKeyInterlace :
ExtractAsPng kASValueInteger, one of:
kPngInterlaceNone (default)
kPngInterlaceAdam7
kExtractPngCmdKeyFilter : kASValueInteger,
one of:
kPngFilterNone
kPngFilterSub
kPngFilterUp
kPngFilterAverage
kPngFilterPaeth
kPngFilterAdaptive (default)
Extract Image As TIFF kExtractTiffCmdKeyMonoCompression :
ExtractAsTiff kASValueInteger
kExtractTiffCmdKeyColorCompression :
kASValueInteger, one of:
kTiffCompressionNone
kTiffCompressionCCITT_G3
kTiffCompressionCCITT_G4 (default for mono)
kTiffCompressionLzw (default for color)
kTiffCompressionZip
kTiffCompressionJpegLow
kTiffCompressionJpegMediumLow
kTiffCompressionJpegMedium
kTiffCompressionJpegMediumHigh
kTiffCompressionJpegHigh
Image extraction parameters common to all image formats
Configured kExtractImgCmdKeyConfigured : kASValueBool
Must be set to true to mark the
command parameters as being in
a valid state.
ConversionFormat kExtractImgCmdKeyConvFormat :
Set to the format that you are kASValueInteger, one of:
exporting to. kImgConversionFormatTiff
kImgConversionFormatJpeg
kImgConversionFormatPng
Default is appropriate valueJPEG, TIFF, PNG

Acrobat and PDF Library API Overview 477


Lists
C

Document Command Parameters


Overwrite kExtractImgCmdKeyOverwriteFiles :
Whether files are overwritten. kASValueBool
Default is true. If set to false, Default is true.
and output file is found to exist,
alert is show if in batch; otherwise
the user is given the option to
overwrite.
Batch kExtractImgCmdKeyInBatch : kASValueBool
Used to control the format of the Default is true.
settings dialog. true gets the
dest folder info.
ColorSpace kExtractImgCmdKeyColorSpace :
kASValueInteger, one of:
kColorSpaceAuto = 1 (default)
kColorSpaceRGB
kColorSpaceGrayscale
kColorSpaceMonochrome
Resolution kExtractImgCmdKeyResolution :
kASValueInteger, one of:
kImgResolutionAuto = -1 (default)
kImgResolution72 = 72
kImgResolution96 = 96
kImgResolution150 = 150
kImgResolution300 = 300
kImgResolution600 = 600
DestDirectory kExtractImgCmdKeyDestDirectory :
Must be passed, or command kASValuePathName
returns an error. Default is the kAVSCUser/kAVSFDocuments folder
BaseFileName kExtractImgCmdKeyBaseFileName :
Used to build the output file kASValueString
string. If not set, handler uses the Default is source PDDoc filename
name of the PDDoc parameter.
Must be passed in the inputs
ASCab, not the params.

478 Acrobat and PDF Library API Overview


Lists
C

Document Command Parameters


Set Open Options kOpenOptionsCmdKeyPageNum : kASValueText
OpenInfo For example, "1"
All defaults are LeaveAsIs kOpenOptionsCmdKeyMagnification :
kASValueText
For example, "100%" : Open action
kOpenOptionsCmdKeyPageLayout :
kASValueInteger
For example, PDLayoutSinglePage
kOpenOptionsCmdKeyPageMode : kASValueInteger
For example, PDUseThumbs
kOpenOptionsCmdKeyFullScreen : kASValueBool
kOpenOptionsCmdKeyHideToolbar : kASValueBool
kOpenOptionsCmdKeyHideMenubar : kASValueBool
kOpenOptionsCmdKeyHideWindowUI :
kASValueBool
kOpenOptionsCmdKeyFitWindow : kASValueBool
kOpenOptionsCmdKeyCenterWindow :
kASValueBool
kOpenOptionsCmdKeyDisplayDocTitle :
kASValueBool

JavaScript Command Group

JavaScriptCommand Parameters
Execute JavaScript kExecJavaScriptName : kASValueText
JavaScript Not currently used
kExecJavaScriptCode : kASValueText

Acrobat and PDF Library API Overview 479


Lists
C

Page Command Group

Page Command Parameters


Common parameters for all kPageCmdKeyGroup : kASValueInteger, one of:
page commands kAVPagesAll
kAVPagesSelected
kAVPagesFromTo
kPageCmdKeyEvenOdd : kASValueInteger, one of:
kAVPagesEvenOdd
kAVPagesEven
kAVPagesOdd
kPageCmdKeyFrom : kASValueText
kPageCmdKeyTo : kASValueText
Crop Pages kPageCmdKeyGroup default is kAVPagesAll.
CropPages kPageCmdKeyEvenOdd default is kAVPagesEvenOdd.
If cropping to bounding box, the dimension params are
ignored.
kCropPagesCmdKeyCropType : kASValueInteger, one of:
kAVCropCustom (default)
kAVCropToBoundingBox
kCropPagesCmdKeyLeft : kASValueDouble
Default is 0.0
kCropPagesCmdKeyRight : kASValueDouble
Default is 0.0
kCropPagesCmdKeyTop : kASValueDouble
Default is 0.0
kCropPagesCmdKeyBottom : kASValueDouble
Default is 0.0
Delete Pages No specific parameters.
DeletePages kPageCmdKeyEvenOdd not supported.
kPageCmdKeyGroup default is kAVPagesFromTo.
kAVPagesSelected must be combined with an AVDoc.

480 Acrobat and PDF Library API Overview


Lists
C

Page Command Parameters


Insert Pages kInsertPagesCmdKeyInsertBefore : kASValueBool
InsertPages Default is false, meaning insert after.
kInsertPagesCmdKeyPosition : kASValueInteger, one
of:
kAVPosRelativeToFirst
kAVPosRelativeToLast
kAVPosRelativeToPage (default)
kInsertPagesCmdKeyPageString : kASValueText
Default is 1
kInsertPagesCmdKeySrcFileName : kASValueText
No use other than dialogs.
kInsertPagesCmdKeySourcePathNames : kASValueCab
Contains a series of ASPathNames
Number Pages kPageCmdKeyGroup Default is kAVPagesAll.
NumberPages kPageCmdKeyEvenOdd Default is kAVPagesEvenOdd.
kNumberPagesCmdKeyStyle : kASValueInteger, one of:
kPageLabelStyleNone (default)
kPageLabelStyleDecimal
kPageLabelStyleRomanLower
kPageLabelStyleRomanUpper
kPageLabelStyleAlphaLower
kPageLabelStyleAlphaUpper
kNumberPagesCmdKeyStart : kASValueInteger
Default is 1
kNumberPagesCmdKeyMergePrevious : kASValueBool
Default is false.
kNumberPagesCmdKeyPrefix : kASValueString
Default is ""
Rotate Pages kPageCmdKeyGroup default is kAVPagesAll.
RotatePages kPageCmdKeyEvenOdd default is kAVPagesEvenOdd.
kRotatePagesCmdKeyDegrees : kASValueInteger
Default is pdRotate90
kRotatePagesCmdKeyAction : kASValueInteger one of:
kAVRotateLandscapePages
kAVRotatePortraitPages
kAVRotateEveryPage (default)

Acrobat and PDF Library API Overview 481


Lists
C

PDF Consultant Command Group

PDF Consultant Command Parameters


Detect And Remove kVirusCheckCmdKeyOptions : kASValueCab
VirusCheck Default is stuff.
kVirusCheckCmdKeyNumOptions : kASValueInteger
Default is 5.
kVirusCheckCmdKeyRemove : kASValueBool
Default is false.
Optimize Space kOptSpaceCmdKeyRemoveBmarks : kASValueBool
SpaceReductionAgent Default is true.
kOptSpaceCmdKeyRemoveLinks : kASValueBool
Default is true.
kOptSpaceCmdKeyRemoveDests : kASValueBool
Default is true.
kOptSpaceCmdKeyDestConversionType :
kASValueInteger, one of:
kOptSpaceRemoveUnused (default)
kOptSpaceConvertIfSpaceSaved
kOptSpaceConvertAll

482 Acrobat and PDF Library API Overview


Lists
C

Predefined Cursors

Cursor Design
ARROW_CURSOR
IBEAM_CURSOR
CROSSHAIR_CURSOR
BOX_IBEAM_CURSOR
HAND_CURSOR
FIST_CURSOR
ZOOM_IN_CURSOR
ZOOM_OUT_CURSOR
ZOOM_MAX_CURSOR
LINK_CURSOR
GROW_CURSOR
BAR_IBEAM_CURSOR
WAIT_CURSOR
MOVEPAGE_CURSOR
COPYPAGE_CURSOR
MOVEPAGES_CURSOR
COPYPAGES_CURSOR
REPLACEPAGE_CURSOR
REPLACEPAGES_CURSOR
NOP_CURSOR
THREAD_CURSOR
WORDFINDER_CURSOR
HIDDEN_CURSOR
GROWTOPLEFT_CURSOR
GROWBOTTOMLEFT_CURSOR

Acrobat and PDF Library API Overview 483


Lists
C

Cursor Design
MOVE_CURSOR
HAND_THREAD_UP_CURSOR
HAND_THREAD_END_CURSOR
HAND_THREAD_UP_END_CURSOR
HAND_THREAD_BEGIN_CURSOR
THREAD_CONNECT_CURSOR
THREAD_END_CURSOR
VERT_IBEAM_CURSOR
GROWLEFTRIGHT_CURSOR
HIGHLIGHT_CURSOR
GROWTOPBOTTOM_CURSOR
CROPTOOL_CURSOR
CROPTOOL_SCISSORS_CURSOR
DRAGLEFTRIGHT_CURSOR
DRAGUPDOWN_CURSOR
VERTBEAMNOBAR_CURSOR

484 Acrobat and PDF Library API Overview


Lists
C
Enumerators

E n u m e rato r s

ASCabEnum
ASEnumExtensions
AVAppEnumActionHandlers
AVAppEnumAnnotHandlers
AVAppEnumDocs
AVAppEnumSystemFonts
AVAppEnumTools
AVAppEnumTransHandlers
AVConversionEnumFromPDFConverters
AVConversionEnumToPDFConverters
AVDocEnumSelection
AVDocSelectionEnumPageRanges
AVMenubarAcquireMenuByPredicate
AVMenubarAcquireMenuItemByPredicate
AVToolBarEnumButtons
CosDocEnumEOFs
CosDocEnumEOFs64
CosDocEnumIndirect
CosObjEnum
EnumElementsWithUserPropertiesProc
JPXColorSpaceGetEnumAttrs
PDCharProcEnum
PDDocEnumFonts
PDDocEnumLoadedFonts
PDDocEnumOCGs
PDDocEnumPDSElementsWithUserProperties

Acrobat and PDF Library API Overview 485


Lists
C
Enumerators

PDEAttrEnumTable
PDEEnumElements
PDEClipFlattenedEnumElems
PDEnumDocs
PDEnumSysFonts
PDEObjectDump
PDFontEnumCharProcs
PDFormEnumPaintProc
PDFormEnumResources
PDNameTreeEnum
PDNumTreeEnum
PDPageEnumContents
PDPageEnumInksEx
PDPageEnumResources
PDPathEnum
PDSElementEnumKidsWithUserProperties
PDSElementEnumUserPropertiesAsASTextProc
PDSElementEnumUserPropertiesAsCosObjProc
PDTextEnum
PDTextSelectEnumQuads
PDTextSelectEnumText
PDTextSelectEnumTextUCS
PDWordFinderEnumWords
PDXObjectEnumFilters
PDXObjectGetData

486 Acrobat and PDF Library API Overview


Lists
C
Font Subtypes

Fo nt Sub t y pe s
Methods: PDFontGetSubtype

Subtype Description
CIDFontType0 Type 0 CID font

CIDFontType2 Type 2 CID font

Type0 Type 0 PostScript font

Type1 Type 1 PostScript font

Type3 Type 3 PostScript font

MMType1 Type 1 multiple master PostScript font

TrueType TrueType font

Acrobat and PDF Library API Overview 487


Lists
C
Glyph Names of Word Separators

Gl yp h Na m es o f Wo rd S ep arato r s
Methods: PDDocCreateWordFinder
PDDocCreateWordFinderUCS
PDWordSplitString

ampersand comma greater parenleft registered


asciicircum copyright guillemotleft parenright section
asciitilde currency guillemotright percent semicolon
asterisk dagger guilsinglleft period slash
at daggerdbl guilsinglright periodcentered space
backslash degree hyphen perthousand sterling
bar divide less plus threequarters
braceleft dollar logicalnot plusminus threesuperior
braceright ellipsis multiply question tilde
bracketleft emdash numbersign questiondown trademark
bracketright endash onehalf quotedbl twosuperior
brokenbar equal onequarter quotedblbase underscore
bullet exclam onesuperior quotedblleft yen
cent exclamdown ordfeminine quotedblright
circumflex florin ordmasculine quoteleft
colon fraction paragraph quotesinglbase

488 Acrobat and PDF Library API Overview


Lists
C
Key Codes

Key Co de s
Header file: ASKey.h

Key CodeAll platforms Value


ASKEY_ARROW_D 31

ASKEY_ARROW_L 28

ASKEY_ARROW_R 29

ASKEY_ARROW_U 30

ASKEY_ESCAPE 27

ASKEY_HELP 5

ASKEY_PAGE_D 12

ASKEY_PAGE_U 11

ASKEY_SPACE 32

ASKEY_TAB 9

Key CodeWindows Value


ASKEY_DEL 127

ASKEY_END 1

ASKEY_ENTER 13

ASKEY_HOME 4

ASKEY_MENU 2

Key CodeMacintosh Value


ASKEY_CLEAR 27

ASKEY_CR 13

ASKEY_DEL 8

ASKEY_END 4

Acrobat and PDF Library API Overview 489


Lists
C
Key Codes

Key CodeMacintosh Value


ASKEY_ENTER 3

ASKEY_HOME 1

Key CodeUNIX Value


ASKEY_CLEAR 27

ASKEY_CR 13

ASKEY_DEL 8

ASKEY_END 4

ASKEY_ENTER 10

ASKEY_HOME 1

490 Acrobat and PDF Library API Overview


Lists
C
Language Codes

L a n gu a g e Cod e s
The following codes represent the supported languages in the supported formats (see
AVAppLanguageFormat).
Methods: AVAppGetLanguage
AVAppGetLanguageWithParams

Language LCID ISO4Char RFC1766


Arabic ARA ar-ae ar
ChineseSimplified CHS zh-cn zh-cn
ChineseTraditional CHT zh-tw zh-tw
Czech CZE cs-cz cs
Danish DAN da-dk da
Dutch NLD nl-nl nl
English ENU en-us en
Finnish SUO fi-fi fi
French FRA fr-fr fr
German DEU de-de de
Greek GRE el-gr el
Hebrew HEB he-il he
Hungarian HUN hu-hu hu
Italian ITA it-it it
Japanese JPN ja-jp ja
Korean KOR ko-kr ko
Norwegian NOR no-no no
Polish POL pl-pl pl
PortugeseBrazil PTB pt-br pt-br
Russian RUS ru-ru ru
Spanish ESP es-sp es

Acrobat and PDF Library API Overview 491


Lists
C
Language Codes

Language LCID ISO4Char RFC1766


Swedish SVE sv-se sv
Turkish TUR tr-tr tr

492 Acrobat and PDF Library API Overview


Lists
C
Menu and Menu Item Names

M e n u a n d M e n u I te m N a m e s
The following example dump of the Acrobat Professional 7.0 File Menu shows the
language-independent name of this built-in menu and its menu items , as returned by the
JavaScript command app.listMenuItems().
NOTE: Results will differ according to the Acrobat product on which the JavaScript
command is being executed (Professional vs Standard, etc.).
Methods: AVMenubarAcquireMenuByName
AVMenubarAcquireMenuItemByName

File Menu
[cName:File, oChildren:[
[cName:Open],
[cName:NewDocument,oChildren:[
[cName:NewDocFromFile],
[cName:NewDocFromMultiple],
[cName:Scan],
[cName:Web2PDF:OpnURL],
[cName:ImageConversion:Clipboard]
]],
[cName:Organizer, oChildren:[
[cName:OpenOrganizer],
[cName:],
[cName:AddToOrganizer],
[cName:OrganizerFavorites]
]],
[cName:AcroSendMail:SendMail],
[cName:endSendGroup],
[cName:Close],
[cName:Save],
[cName:SaveAs],
[cName:DIGSIG:SaveAndAuthenticate],
[cName:Revert],
[cName:endSaveGroup],
[cName:ReduceFileSize],
[cName:endOptimizeGroup],
[cName:Annots:SendForReviewMenu, oChildren:[
[cName:SendForReview],
[cName:Annots:BrowserBasedReview]
]],
[cName:Annots:Separator],
[cName:AcroForm:File_FormData, oChildren:[
[cName:AcroForm:FormData_CollectData],
[cName:AcroForm:FormData_CreateSpreadsheet],
[cName:AcroForm:FormData_ImportData],
[cName:AcroForm:FormData_ExportData],

Acrobat and PDF Library API Overview 493


Lists
C
Menu and Menu Item Names

[cName:AcroForm:Separator],
[cName:AcroForm:FormData_HowTo]
]],
[cName:endFormDataGroup],
[cName:GeneralInfo],
[cName:endDocInfoGroup],
[cName:PageSetup],
[cName:Print],
[cName:Annots:PrintWithComments],
[cName:EFIPrintMe],
[cName:endPrintGroup],
[cName:OrganizerHistory, oChildren:[
[cName:],
[cName:],
[cName:],
[cName:],
[cName:],
[cName:],
[cName:],
[cName:Separator],
[cName:OpenOrganizer]
]],
[cName:RecentFile1],
[cName:RecentFile2],
[cName:RecentFile3],
[cName:RecentFile4],
[cName:RecentFile5],
[cName:endRecentFileGroup],
[cName:Quit]
]]

494 Acrobat and PDF Library API Overview


Lists
C
Replaceable Methods

R e p l a ce a b l e M e t h o d s
These methods are replaceable in Adobe Reader, except as noted.

AVAlert
AVAppCanQuit
AVAppHandleAppleEvent
AVDocClose
AVDocDoPrint (not replaceable in Adobe Reader)
AVDocDoSave (not replaceable in Adobe Reader)
AVDocDoSaveAs (not replaceable in Adobe Reader)
AVDocDoSaveAsWithParams (not replaceable in Adobe Reader)
AVDocOpenFromASFileWithParams
AVDocPrintPages
AVDocPrintPagesWithParams
AVPageViewGetNextView
PDDocSave (not replaceable in Adobe Reader)
PDDocSaveWithParams (not replaceable in Adobe Reader)
PDImageSelectAlternate

Acrobat and PDF Library API Overview 495


Lists
C
Selection Types

S el ec t io n Typ es
Selection types that can be specified when calling AVDocSetSelection. The Details
column specifies what should be used for the data parameter.

Selection Type Description Data Type Details


Text Text in the PDTextSelect Use PDDocCreateTextSelect to
document create the selection.
Bitmap Graphics AVGrafSelect Use AVGrafSelectCreate to create
the selection.
Annotation Annotation (text Allocate memory using ASmalloc
annotation, link, (sizeof(PDAnnot)). Copy the
and so on) desired PDAnnot into the allocated
memory and pass a pointer to it. The
annotation selection server assumes
responsibility for freeing the memory.
Thumbnail Thumbnail image ASInt32 Pass the page number (the first page in
a document is page 0).

NOTE: To get information about a selected annotation, use


AVPageViewGetFocusAnnot.

496 Acrobat and PDF Library API Overview


Lists
C
Toolbar and Toolbar Button Names

To o l b a r a n d To o l b a r B u t t o n N a m e s
Methods: AVAppGetToolBarByName
AVToolBarGetButtonByName
The following are the language-independent names of the built-in toolbars and toolbar
buttons, as returned by the JavaScript command app.listToolbarButtons().
[cName:File, oChildren:[
[cName:Open],
[cName:ADBE:SPDR:OpStatTlButton],
[cName:Save],
[cName:SaveFileAs],
[cName:Print],
[cName:AddToOrganizer],
[cName:Organizer],
[cName:AddAttachments, oChildren:[
[cName:AddAttachments],
[cName:Annots:Tool:FileAttachment, oChildren:[
[cName:Annots:Tool:FileAttachment]
]]
]],
[cName:AcroSendMail:SendMail],
[cName:FindDialog],
[cName:endDialogGroup]
]],
[cName:Tasks, oChildren:[
[cName:NewDocumentTask],
[cName:CommentTask],
[cName:Initiate],
[cName:SecureTask],
[cName:SignTask],
[cName:FormTasks]
]],
[cName:BasicTools, oChildren:[
[cName:Hand],
[cName:Select],
[cName:SelectGraphics],
[cName:endSelectToolsGroup]
]],
[cName:Viewing, oChildren:[
[cName:ZoomIn, oChildren:[
[cName:ZoomIn],
[cName:ZoomOut],
[cName:ZoomDrag],
[cName:Loupe]
]],
[cName:Zoom100],
[cName:FitPage],
[cName:FitVisible],
[cName:ZoomViewOut],

Acrobat and PDF Library API Overview 497


Lists
C
Toolbar and Toolbar Button Names

[cName:ZoomTo],
[cName:ZoomViewIn]
]],
[cName:Rotate, oChildren:[
[cName:RotateCW, oChildren:[
[cName:RotateCW],
[cName:RotateCCW]
]],
[cName:endRotateViewGroup]
]],
[cName:HowTo, oChildren:[
[cName:HowTo]
]],
[cName:Find, oChildren:[
[cName:FindEdit]
]],
[cName:WebSearchView, oChildren:[
[cName:WebSearchView]
]],
[cName:Commenting, oChildren:[
[cName:Annots:Tool:Text],
[cName:Annots:Tool:TextEdits],
[cName:Annots:Tool:Stamp],
[cName:Annots:Tool:Highlight, oChildren:[
[cName:Annots:Tool:Highlight],
[cName:Annots:Tool:Underline],
[cName:Annots:Tool:StrikeOut]
]],
[cName:Annots:Tool:FileAttachmentReal, oChildren:[
[cName:Annots:Tool:FileAttachmentReal],
[cName:Annots:Tool:Sound]
]],
[cName:Separator],
[cName:Annots:Tool:Filter]
]]

498 Acrobat and PDF Library API Overview


Lists
C
Tool Names

To o l N a m e s
Methods: AVAppGetToolByName

Tool Name UI Label


Movie Movie Tool (M)
Link Link Tool (L)
Thread Article Tool (A)
Crop Crop Tool (C)
Widget Form Tool (F)
Touch-Up Text Selection TouchUp Text Tool (T)
Object Selection Type TouchUp Object Tool (T) / TouchUp Order Tool (T)
Hand Hand Tool (H)
Zoom Zoom In Tool (Z) / Zoom Out Tool (Z)
Select Text Select Tool (V) / Column Select Tool (V)
BCLC:Table/Formatted_TextZoneTool Table/Formatted Text Select Tool (V)
SelectGraphics Graphics Select Tool (G)
Text Note Tool (S)
FreeText FreeText Tool (S)
Sound Sound Attachment Tool (S)
Stamp Stamp Tool (S)
FileAttachment File Attachment Tool (S)
Ink Pencil Tool (N)
Square Square Tool (N)
Circle Circle Tool (N)
Line Line Tool (N)
Highlight Highlight Tool (U)
StrikeOut Strikeout Tool (U)
Underline Underline Tool (U)
Squiggly Not exposed through UI.
DigSigTool Digital Signature Tool (D)

Acrobat and PDF Library API Overview 499


Lists
C
Type/Creator Codes

Typ e/ Cre ato r Co de s


Type/Creator codes for ASFileSysSetTypeAndCreator method.

Creators
kAcrobatCreatorCode ASFourCharCode('CARO') Acrobat Creator Code
kPhotoshopCreatorCode ASFourCharCode('8BIM') Photoshop Creator Code
kImageReadyCreatorCode ASFourCharCode('MeSa') ImageReady Creator Code
kIllustratorCreatorCode ASFourCharCode('ART5') Illustrator Creator Code

Acrobat Types Creator=kAcrobatCreatorCode


kPDFTypeCode ASFourCharCode('PDF ') Portable Document Format
kFDFTypeCode ASFourCharCode('FDF ') Forms Data Format
kXFDFTypeCode ASFourCharCode('XFDF') XML Forms Data Format
kPrefsTypeCode ASFourCharCode('PREF') Preferences File
kPDXTypeCode ASFourCharCode('PDX ') Acrobat Catalog Index file
kRMFTypeCode ASFourCharCode('RMF ') WebBuy Rights Management
File
kAPFTypeCode ASFourCharCode('APF ') Acrobat Profile Format
(PPKLite)
kSequenceTypeCode SFourCharCode('SEQU') Acrobat Sequence File
kDictionaryTypeCode ASFourCharCode('DICT') Spelling Dictionary File
kWHATypeCode ASFourCharCode('WHA ') Web-Hosted Apps File
kLocaleTypeCode ASFourCharCode('LANG') Locale File
kPluginTypeCode ASFourCharCode('XTND') client File

500 Acrobat and PDF Library API Overview


Lists
C
Type/Creator Codes

Acrobat Types Creator=kAcrobatCreatorCode


kPluginNewTypeCode ASFourCharCode('XTNc') client File (Preferred,
supported by 5.0.5 and later.)
Using this filetype allows a
client developer to ship a
Carbonized client that will not
try to load and show an error
when installed under Acrobat
4 or earlier.

Photoshop Types Creator=kPhotoshopCreatorCode


kPSDTypeCode ASFourCharCode('8BIM') Photoshop PSD File
kPICTTypeCode ASFourCharCode('PICT') Mac PICT File
kTIFFTypeCode ASFourCharCode('TIFF') TIFF File
kGIFTypeCode ASFourCharCode('GIFf') GIF File
kJPEGTypeCode ASFourCharCode('JPEG') JPEG File
kPNGTypeCode ASFourCharCode('PNGf') PNG File

Illustrator Types Creator=kIllustratorCreatorCode


KAITypeCode ASFourCharCode('TEXT') Illustrator AI File
kEPSTypeCode ASFourCharCode('EPSF') EPS File

Other Types/Creators
kTextTypeCode ASFourCharCode('TEXT') Text File
kTextCreatorCode ASFourCharCode('ttxt') SimpleText
kQuickTimeTypeCode ASFourCharCode('MooV') QuickTime File
kQuickTimeCreatorCode ASFourCharCode('TVOD') QuickTime Player
kHTMLTypeCode ASFourCharCode('TEXT') HTML File
kHTMLCreatorCode ASFourCharCode('MSIE') Microsoft IE

Acrobat and PDF Library API Overview 501


Lists
C
View Destination Fit Types

View D es t in at io n Fit Ty pe s

XYZ Destination specified as upper-left corner point and a zoom factor.

Fit Fits the page into the window, corresponding to the Acrobat viewers
FitPage menu item.
FitH Fits the widths of the page into the window, corresponding to the
Acrobat viewers Fit Width menu item.
FitV Fits the height of the page into a window.

FitR Fits the rectangle specified by its upper-left and lower-right corner
points into the window.
FitB Fits the rectangle containing all visible elements on the page (known as
the bounding box) into the window, corresponds to the Acrobat
viewers Fit Visible menu item.
FitBH Fits the width of the bounding box into the window.

FitBV Fits the height of the bounding box into the window.

502 Acrobat and PDF Library API Overview


Lists
C
View Destination Fit Types

Acrobat and PDF Library API Overview 503


Lists
C
View Destination Fit Types

504 Acrobat and PDF Library API Overview


Lists
C
View Destination Fit Types

Acrobat and PDF Library API Overview 505


Lists
C
View Destination Fit Types

506 Acrobat and PDF Library API Overview


Lists
C
View Destination Fit Types

Acrobat and PDF Library API Overview 507


Lists
C
View Destination Fit Types

508 Acrobat and PDF Library API Overview


Lists
C
View Destination Fit Types

Acrobat and PDF Library API Overview 509


Lists
C
View Destination Fit Types

510 Acrobat and PDF Library API Overview


Lists
C
View Destination Fit Types

Acrobat and PDF Library API Overview 511


Lists
C
View Destination Fit Types

512 Acrobat and PDF Library API Overview


D Errors

Error Systems

ErrSysAcroView AcroView

ErrSysASFile ASFile I/O

ErrSysCos CosStore, filters

ErrSysCosSyntax Cos syntax

ErrSysFontSvr Font Server

ErrSysMDSystem Platform-specific system

ErrSysMDApp Platform-specific application

ErrSysNone General error and out of memory

ErrSysPage Page parsing and RIPping

ErrSysPDDoc PDDoc and family, Page tree, bookmarks

ErrSysPDSEdit PDFEdit

ErrSysPDMetadata PDMetadata

ErrSysPDModel Global PD

ErrSysPDPage PDPage and family, thumbs, annots

ErrSysPDSEdit PDSEdit

ErrSysRaster Rasterizer

ErrSysXtnMgr Extension manager.

Severities

ErrAlways Always display error, even if others are suppressed.

ErrSilent Never display a message.

ErrSuppressable Display a message if the user has not suppressed errors.

Acrobat and PDF Library API Overview 513


Errors
D

ErrWarning Display a warning.

ErrNoError No error occurred.

ErrSysAcroView
System: ErrSysAcroViewAcroView (AV) level errors
Severity: ErrAlways
Platforms: All

avErrActionExternal This action cannot be performed from


within an external window.
avErrActionFullScreen This action cannot be performed during
full-screen mode.
avErrActionRestricted This action can not be performed.

avErrBadActionCopy No AVActionCopyProc is registered in


an action handler and an action copy
request occurred.
avErrBadAnnotationCopy No AVAnnotHandlerCopyProc
registered in an annotation handler and an
annotation copy request occurred.
avErrCantOpenDialog Acrobat can not open this file. There is a
modal dialog open.
avErrCantOpenMoreThanTenDocs No more than ten documents can be
opened at a time.
avErrCantOpenPrinting Acrobat can not open this file while
printing another document.
avErrNoError No error.

avErrNoText There is no text.

avErrPrintJobTooBig There are too many pages to print.

avErrTooManyChars There is too much text to display. Cannot


display more than 32,000 characters.

514 Acrobat and PDF Library API Overview


Errors
D

ErrSysASFile
Error System: ErrSysASFileASFile I/O errors
Severity: ErrAlways
Platforms: All

fileErrAlreadyOpen This file is already open or in use by another


application.
fileErrBusy This file is busy and cannot be deleted.

fileErrBytesNotReady Bytes requested by the viewer have not yet


arrived. Occurs only over slow file systems.
fileErrDirFull The directory is full.

fileErrDiskFull The documents disk or the disk used for


temporary files is full.
fileErrEOF End of file was reached unexpectedly.

fileErrExists Another file already exists under the same name.

fileErrFNF This file cannot be found.

fileErrGeneral A file error has occurred.

fileErrIO A file I/O error has occurred.

fileErrIOTimeout A file I/O error has occurred. The file connection


timed out.
fileErrLocked This file is locked.

fileErrNoErr No error.

fileErrNSV The disk containing this file is not available.

fileErrOpenFailed File open failed.

fileErrPerm You do not have access to this file.

fileErrRead A file read error has occurred.

fileErrTooBig This file is too big for the current operation.

fileErrUserRequestedStop User requested stop.

fileErrVLocked This disk is locked and cannot be written to.

fileErrWrite A file write error has occurred.

Acrobat and PDF Library API Overview 515


Errors
D

fileErrWrPerm You do not have permission to write to this file.

516 Acrobat and PDF Library API Overview


Errors
D

ErrSysCos
Error System: ErrSysCosCosStore, filter errors
Severities: ErrSuppressable, ErrAlways
Platforms: All

cosErrAfterSave Implementation failure: this document is now


invalid.
cosErrArrayBounds Array out-of-bounds error.

cosErrBadFilterName A stream specifies an unknown filter.

cosErrBadIndex Bad master index.

cosErrBadSyntax Syntax error.

cosErrCancelSave A Save operation was canceled.

cosErrCantOpenTempFile A temporary file could not be opened.

cosErrCCFError Error in CCITT fax data filter.

cosErrDCTError Error in JPEG data filter.

cosErrDictKeyNotName Dictionary key must be a name object.

cosErrDocTableFull Cos document table full.

cosErrEncryptionErr Error in encryption filter.


This error occurs if the:
RC4 encryption code fails to initialize.

RC4 encryption code fails to update its state


when requested.
Documents security handler has been changed
since the document was last saved, and the
length of the cryptData passed internally is
too small to hold the new cryptData.
cosErrExpectedArray Expected an array object.

cosErrExpectedBoolean Expected an ASBool object.

cosErrExpectedDict Expected a dictionary object.

cosErrExpectedDirect Expected a direct object.

cosErrExpectedName Expected a name object.

Acrobat and PDF Library API Overview 517


Errors
D

cosErrExpectedNull Expected a NULL object.

cosErrExpectedNumber Expected a number object.

cosErrExpectedStream Expected a stream object.

cosErrExpectedString Expected a string object.

cosErrInt16OutOfRange A number is out of range.

cosErrInvalidAssignment This direct object already has a container.

cosErrInvalidObj Desired operation cannot be performed on this


object.
cosErrListOverflow Operation or data is too complex.

cosErrLZWError Error in LZW data filter.

cosErrNeedFullSave This file must be saved with a full save.

cosErrNeedRebuild The file needs to be repaired.

cosErrNoError No error.

cosErrOldLinFormat Obsolete format: treating file as non-linearized.

cosErrReadError Read error.

cosErrRebuildFailed Could not repair file.

cosErrStreamTooShort Stream source is shorter than specified length.

cosErrTempFileFull The temporary file is full or nearly full. Close or save


any modified documents.
cosErrTempTooShort Temporary file unexpectedly short.

cosErrWriteError Write error.

518 Acrobat and PDF Library API Overview


Errors
D

ErrSysCosSyntax
Error System: ErrSysCosSyntaxCos syntax errors
Severity: ErrSuppressable
Platforms: All

cosSynErrBadArrayDict Expected dictionary or array.

cosSynErrBadCharInHexString Non-hex character in a hex string.

cosSynErrBadDict Error reading dictionary.

cosSynErrBadFRef Bad foreign object reference.

cosSynErrBadLinearized Error reading linearized hint data.

cosSynErrBadObject Error reading object.

cosSynErrBadObjectLabel Object label badly formatted.


This error occurs when the Acrobat viewer
tries to read a Cos object in a file. It occurs if
the objects:
Object number is not an integer.

Object number does not match the object


number the viewer expected.
Generation number is not an integer.

Generation number does not match the


generation number the viewer expected.
Object/generation number line does not
end with obj.
One common cause of this error is incorrect
offsets in the xref table. For example, if the
offset to object 16 is one byte too high,
Acrobat sees it as being object number 6
instead of 16and raises this exception.
cosSynErrBadTrailerStart Trailer dictionary start missing <<.

cosSynErrBadXref Missing xref.

cosSynErrBadXrefEntry Error reading xref entry.

cosSynErrBadXrefHeader Xref header should be two integers.

cosSynErrExtraEndStream Unexpected endstream.

cosSynErrImageNeverEnded End of image not found.

Acrobat and PDF Library API Overview 519


Errors
D

cosSynErrNoEndStream Missing endstream.

cosSynErrNoEOF Missing %%EOF.

cosSynErrNoError No error.

cosSynErrNoHeader File does not begin with %PDF-.

cosSynErrNoStartAddress Value of startxref address not an integer.

cosSynErrNoStartXRef Could not find startxref address.

cosSynErrPStackUnderflow Parse stack underflow while reading object.

cosSynErrStringTooLong String too long.

cosSynErrTokenTooLong Token too long.

cosSynErrUnexpectedArray Unexpected end of array.

cosSynErrUnexpectedDict Unexpected end of dictionary.

cosSynErrUnexpectedType Unexpected token type.

cosSynErrUnknownName Unrecognized object name.


This error occurs if the Acrobat viewer is
reading a Cos object and encounters a token
that is not a number, name, or string, and
which is not one of the keywords: true, false,
null,
[, ], <<, >>, stream, ID, endobj, startxref,
endstream, and R. This error also occurs if the
Acrobat viewer encounters one of these
keywords in an unexpected place, for example
a ] without a preceding [.
cosSynErrUnknownTokenType Unrecognized token type.

cosSynErrUnterminatedString Un-terminated string.

520 Acrobat and PDF Library API Overview


Errors
D

ErrSysFontSvr
Error System: ErrSysFontSvrFont server errors
Severity: ErrAlways
Platforms: All

fsErrBadParameter Bad parameter passed to font server.

fsErrDownloadAborted Font download aborted.

fsErrDownloadFailed Font download failed.

fsErrInitFailed Initialization of the font server module failed.

fsErrNeedNewATM A new version of Adobe Type Manager is required.

fsErrNoATM Adobe Type Manager was not found.

fsErrNoError No error.

fsErrNoMMFonts No multiple master fonts were found.

fsErrNoT1ZapfDingbats The Type 1 font Zapf Dingbats must be installed.

Acrobat and PDF Library API Overview 521


Errors
D

ErrSysMDSystem
MacOS
System: ErrSysMDSystemMacOS-specific system errors
Severity: ErrAlways
Platforms: MacOS

cfMacfBsyErr This file is busy and cannot be deleted.


(fBsyErr)
cfMacdirFulErr The directory is full. (dirFulErr).

cfMacdskFulErr The documents disk or the disk used for


temporary files is full. (dskFulErr).
cfMacdsMemFullErr Out of memory (-26). (dsMemFullErr)

cfMacdupFNErr Another file already exists under the same


name. (dupFNErr)
cfMaceofErr End of file was reached unexpectedly.
(eofErr)
cfMacfLckdErr This file is locked. (fLckdErr)

cfMacGenPSErr A Postscript error has occurred (-8133).

cfMaciIOAbort An I/O error has occurred (-27). (iIOAbort)

cfMacioErr A file I/O error has occurred. (ioErr)

cfMaciPrSavPFil Error saving print file (-1).

cfMacmemFullErr Out of memory (-108). (memFullErr)

cfMacNoErr No error. (noErr).

cfMacnoMacDskErr This disk is not a Macintosh disk.


(noMacDskErr)
cfMacnsvErr There is no such volume available. (nsvErr).

cfMacopWrErr This file is already open or in use by another


application. (opWrErr)
cfMacpermErr You do not have permission to open this file.
(permErr)

522 Acrobat and PDF Library API Overview


Errors
D

cfMacresNotFound Tried to get a nonexistent resource (-192).


(resNotFound)
cfMacServerLostConnection This files server connection has closed down.
(-1070) (aspParamErr)
cfMacvLckdErr This volume is locked and cannot be written to.
(vLckdErr)
cfMacvolOffLinErr This files volume is not available.
(volOffLinErr)
cfMacwrPermErr You do not have permission to write to this file.
(wrPermErr)

Windows
Error System: ErrSysMDSystemWindows-specific system errors
Severity: ErrAlways
Platforms: Windows

WinAccessErr Access denied.

WinBadDiskErr Badly formatted disk.

WinBadDriveErr Invalid drive.

WinBadFileErr The file does not exist.

WinBadHdlErr Bad file handle.

WinBadPathErr The path does not exist.

WinDeviceErr Device does not exist.

WinExistsErr File already exists.

WinGeneralErr General failure.

WinLockErr Lock violation.

WinMemErr Not enough memory.

WinNotDosErr Not an MS-DOS disk.

WinShareErr Sharing violation.

WinTooManyErr Too many open files.

WinWrPermErr You do not have write permission.

Acrobat and PDF Library API Overview 523


Errors
D

ErrSysMDApp
Error System: ErrSysMDAppMacOS-specific application errors
Severity: ErrAlways
Platforms: MacOS

mdAppCantPrintToPDFWriter Cannot print to Acrobat PDFWriter.

mdAppErrNoError No error.

mdAppNoDAsWhilePrint Close all Desk Accessories before printing.

mdAppNoPrinter Printing is not possible until you have chosen a


Printer using the Chooser.

524 Acrobat and PDF Library API Overview


Errors
D

ErrSysNone
Error System: ErrSysNoneGeneral system and out-of-memory errors
Severity: ErrAlways
Platforms: All

genErrBadParm Bad parameter.

genErrBadUnlock Attempt to release an unlocked object.

genErrExceptionStackOverflow Exception stack overflow.


genErrGeneral An internal error occurred.

genErrListOverflow Operation or data is too complex.

genErrMethodNotImplemented Attempted to call a method that has not been


implemented.
genErrNoError No error.

genErrNoMemory Out of memory.

genErrResourceLoadFailed Failed to load an application resource (internal


error).

Acrobat and PDF Library API Overview 525


Errors
D

ErrSysPage
Error System: ErrSysPageMacOS-specific application errors
Severities: ErrSuppressable, ErrSilent
Platforms: All

pageErrArrayLenWrong Array length is out of range.

pageErrBadColorSpace Invalid colorspace.

pageErrBadContents The page contents object has the wrong


type.
pageErrBadDecodeArray Bad decode array.

pageErrBadEGS Invalid extended graphics state.

pageErrBadEPSColorSpace An image uses a color space that will not


separate correctly in some applications.
pageErrBadForm Invalid form.

pageErrBadFunction Invalid function resource.

pageErrBadPattern Invalid pattern.

pageErrBadType3Font Invalid Type 3 font.

pageErrBadTypeInXTextArray Bad object type within a text operator


array.
pageErrColorOutOfRange A color value is out-of-range.

pageErrColorSpaceNotFound Could not find the specified color space.

pageErrEGStateNotFound Could not find the specified extended


graphics state.
pageErrErrorReadingPage There was an error reading page near the
contents.
pageErrFontNotSet Font has not been set.

pageErrFormNotFound Could not find the form named %s.

pageErrErrorParsingImage There was an error while trying to parse


an image.
pageErrExpectedEndOfColor Expected end of color space.

526 Acrobat and PDF Library API Overview


Errors
D

pageErrExpectedHexOrASC85 Expected ASCIIHexadecimal or ASCII85


string.
pageErrImageExpectedEI Expected EI while parsing an image.

pageErrImageExpectedNumber Expected a number while parsing an


image.
pageErrFontNotInResDict Could not find a font in the Resources
dictionaryusing Helvetica instead.
pageErrFontNotInResources A font is not in the Resources dictionary.

pageErrFormTypeNotAvailable Specified form type is not supported.

pageErrIllegalOpInPath Illegal operation inside a path.

pageErrIllegalOpInTextObj Illegal operation inside a text object.

pageErrIllegalOpInTextOutline Illegal operator inside a text outline


object.
pageErrIllegalTextOp Illegal operation outside text object.

pageErrImageTooBig Image in form, Type 3 font, or pattern is


too big.
pageErrInvalidDash Dash arguments are invalid.

pageErrInvalidGRestore Invalid restore.

pageErrInvalidImageMaskDepth An image is specified as an image mask


with more than 1 bit per pixel.
pageErrMissingKey Dictionary is missing the key %s

pageErrMissingResource A resource is missing.

pageErrNoError No error.

pageErrNumberOutOfRange A number value is out of range.

pageErrParseContextError Error while parsing a form, Type 3 font, or


pattern.
pageErrReadLessImageData Read less image data than expected.

pageErrSeveralParsingErrors There were several parsing errors on this


page.
pageErrTooFewPathOps Too few operands in path.

pageErrOperandTooLarge An operand is too large.

Acrobat and PDF Library API Overview 527


Errors
D

pageErrOpTooLarge Operand too large.

pageErrPatternNotFound Could not find the pattern with the


specified name.
pageErrPatternTypeNotAvailable Pattern type is not supported.

pageErrReadLessImageColor Read less image color data than


expected.
pageErrReadLessImageData Read less image data than expected.

pageErrRecursiveMachine Internal errormachine called


recursively.
pageErrTokenTypeNotRec Token type not recognized.

pageErrTooFewArgs There were too few arguments.

pageErrTooFewOps Too few operands.

pageErrTooManyArgs There were too many arguments.

pageErrUnexpectedOpInDisplay Found an unexpected operator in the


display list.
pageErrUnknownColorSpace Unknown color space.

pageErrUnknownFilterName Unknown filter name.

pageErrUnknownXObjectType Unknown XObject type.

pageErrUnrecognizedToken An unrecognized token %s was found.

pageErrWrongArgsForSetColor Wrong number of arguments for a


setcolor operator.
pageErrWrongNumOpsInCurve A curve operator has the wrong number
of operands.
pageErrWrongOperand Wrong operand typeexpected type
%s.
pageErrWrongOpType Wrong operand type.

pageErrXObjectNotFound Could not find the XObject named %s.

528 Acrobat and PDF Library API Overview


Errors
D

ErrSysPDDoc
Error System: ErrSysPDDocPDDoc and family, page tree, bookmark errors
Severities: ErrSuppressable, ErrAlways
Platforms: All

pdErrAbortNotes Creation of the notes file was canceled.

pdErrAfterSave This document was successfully saved,


but an error occurred after saving the
document. Please close and reopen the
document.
pdErrAlreadyOpen This file is already open.

pdErrATMMemory ATM is running out of memory. Text in


font %s may not render properly.
pdErrBadAction Invalid action object.

pdErrBadAnnotation Invalid annotation object.

pdErrBadAnnotColor Invalid annotation color (only RGB colors


are allowed).
pdErrBadBaseObj The base pages object is missing or
invalid.
pdErrBadBead Invalid article element.

pdErrBadBookmark Invalid bookmark object.

pdErrBadCMap The font contains a bad CMap /Encoding.

pdErrBadFileSpec Invalid file specification object.

pdErrBadFont Bad font object or font descriptor object.

pdErrBadFontBBox The font %s contains a bad /BBox.

pdErrBadFontDescMetrics The font %s contains bad


/FontDescriptor metrics.
pdErrBadFontFlags The font %s contains bad /Flags.

pdErrBadFontWidths The font %s contains bad /Widths.

pdErrBadOutlineObj The outlines object is missing or invalid.

pdErrBadPageObj A page object is missing or invalid.

Acrobat and PDF Library API Overview 529


Errors
D

pdErrBadPageTree The documents page tree contains an


invalid node.
pdErrBadResMetrics Invalid or corrupt font metrics in the
resource file.
pdErrBadRootObj The root object is missing or invalid.

pdErrBadThread Invalid article object.

pdErrBookmarksError There is an error in the bookmarks.

pdErrCancelSave A Save operation was canceled.

pdErrCannotBeBlankPage The page number cannot be left blank.

pdErrCannotDeleteAllPages You cannot delete all pages. At least one


page must remain.
pdErrCannotMergeWithSubsetFonts Documents contain subset fonts that
have the same name and cannot be
merged.
pdErrCannotOpenMoreBkMark Cannot open more bookmarks.

pdErrCannotOpenNotes An error occurred while creating the


document notes file.
pdErrCannotReopenDoc This document was successfully saved,
but an error occurred after saving the
document. Close and reopen the
document.
pdErrCantUseNewVersion This file contains information not
understood by the viewer. It cannot be
used for this operation.
pdErrCopyPageFailed The copy of a page failed.

pdErrEmbeddingFont Error while trying to embed a font.

pdErrExceedEncryptionLength Supported encryption key length


exceeded.
pdErrExceedEncryptionVersion Encryption version not supported by
current header.
pdErrHostEncodingNotSet The application has not set the host
encoding.
pdErrInvalidPageNumber %s is an invalid page number.

530 Acrobat and PDF Library API Overview


Errors
D

pdErrIsFileLocked Unable to open file for writing. It may be


locked or unavailable.
pdErrMissingGlyphs Unable to find a substitution font with all
the characters used by the font named
%s. Some characters may not be
displayed or printed.
pdErrMissingSubsetFont A font required for font substitution is
missing.
pdErrNeedCryptHandler Cannot execute this command on an
unsecured document.
pdErrNeedExtendedLang An error has occurred that may be fixed
by installing the latest version of the
Extended Language Support package.
pdErrNeedJapanese An error has occurred that may be fixed
by installing the latest version of the
Japanese Language Support package.
pdErrNeedKorean An error has occurred that may be fixed
by installing the latest version of the
Korean Language Support package.
pdErrNeedPassword This document requires a password.

pdErrNeedRebuild This file is damaged.

pdErrNeedSimpChinese An error has occurred that may be fixed


by installing the latest version of the
Traditional Chinese Language Support
package.
pdErrNeedTradChinese An error has occurred that may be fixed
by installing the latesta version of the
Traditional Chinese Language Support
package.
pdErrNoCryptHandler The security client required by this
command is unavailable (that is, the
necessary security handler is not
registered).
pdErrNoError No error.

pdErrNoNotes This document has no notes.

pdErrNoPDDocForCosDoc There is no PDDoc associated with this


CosDoc.

Acrobat and PDF Library API Overview 531


Errors
D

pdErrNotEnoughMemoryToOpenDoc There is not enough memory available to


open the document.
pdErrNotEnoughSpaceForTempFile There is not enough temporary disk
space for this operation.
pdErrNotValidPage There is no page numbered %s in this
document.
pdErrOldATMVersion The font %s cannot be displayed with
the installed version of ATM.
pdErrOldEncryption This viewer cannot decrypt this
document.
pdErrOpNotPermitted This operation is not permitted. Acrobat
security does not allow content copying
or extraction. These operations should
be permitted when the documents
master password is used.
pdErrOptMemory There is not enough memory to optimize
this file.
pdErrPagesLockedNotDeleted One or more pages are in use and could
not be deleted.
pdErrRequireTrustedMode Only Adobe-certified Acrobat clients are
allowed while viewing this document.
pdErrStartLessThanEnd The starting page number must be less
than or the same as the ending page
number.
pdErrTextStringTooShort There are not enough bytes in text string
for multibyte character code.
pdErrThreadProcessing Error while processing articles.

pdErrThumbError Error while processing thumbnail.

pdErrTooManyPagesForInsert Inserting this file would result in a


document with too many pages.
pdErrTooManyPagesForOpen This file cannot be opened because it
contains too many pages.
pdErrTrySaveAs This file can only be saved using Save As.

pdErrUnableToCloseDueToRefs Unable to close document due to


outstanding references.

532 Acrobat and PDF Library API Overview


Errors
D

pdErrUnableToExtractFont Unable to extract the embedded font


%s. Some characters may not display or
print correctly.
pdErrUnableToExtractFontErr Unable to extract embedded font.

pdErrUnableToFindFont Unable to find or create the font %s.


Some characters may not display or print
correctly.
pdErrUnableToOpenDoc This file could not be opened.

pdErrUnableToRead Unable to read file.

pdErrUnableToRecover Unable to recover original file.

pdErrUnableToRenameTemp Unable to rename temporary file to Save


As name.
pdErrUnableToWrite Unable to write file.

pdErrUnableToXlateText Some text in the font and character %s


could not be displayed or printed
correctly. The font could not be re-
encoded.
pdErrUnknownAction Unknown action type.

pdErrUnknownCryptFilter This file is encrypted with an


unsupported cryptograhpic algorithm.
pdErrUnknownFileType This is not a valid Portable Document File
(PDF) document. It cannot be opened.
pdErrUnknownProcsets Information needed to print a page is
unavailable.
pdErrWhileRecoverInsertPages There was an error while inserting or
extracting pages and another error while
trying to recover.
pdErrZeroPageFile This file cannot be opened because it has
no pages.

Acrobat and PDF Library API Overview 533


Errors
D

ErrSysPDFEdit
Error System: ErrSysPDFEditPDFEdit errors
Severity: ErrAlways
Platforms: All

peErrBadBlockHeader Bad block header for Type 1 embedded stream.

peErrCantCreateFontSubset Unable to create embedded font subset.

peErrCantEmbedFont This font is licensed and cannot be embedded.

peErrCantGetAttrs Unable to get attributes for font.

peErrCantGetImageDict Unable to get image dictionary.

peErrCantGetWidths Unable to get widths for font.

peErrCantReadImage Unable to read image data.

peErrFontToEmbedNotOnSys Unable to find font to embed on this system.

peErrNoError No error.

peErrPStackUnderflow PDFEdit parse stack underflow while reading


object.
peErrUnknownPDEColorSpace Unknown PDEColorSpace value.

peErrUnknownResType Unknown PDEObject resource type.

peErrWrongPDEObjectType Incorrect PDEObject type.

534 Acrobat and PDF Library API Overview


Errors
D

ErrSysPDMetadata
Error System: ErrSysPDMetadataPD metadata errors
Severity: ErrAlways
Platforms: All

pdMetadataErrBadXAP The XMP metadata supplied was not


syntactically correct RDF.
pdMetadataErrBadPDF XMP metadata processing found a
syntax error in PDF.
pdMetadataErrCouldntCreateMetaXAP Could not create internal
representation of XMP metadata.
pdMetadataErrInternalError An internal error occurred while
processing XMP metadata.

Acrobat and PDF Library API Overview 535


Errors
D

ErrSysPDModel
Error System: ErrSysPDModelGlobal PD-level errors
Severity: ErrAlways
Platforms: All

pdModErrDuplicateCryptName A security handler is already registered with


this name.
pdModErrEncTablesFailed Unable to initialize font encoding tables.

pdModErrNoError No error.

536 Acrobat and PDF Library API Overview


Errors
D

ErrSysPDPage
Error System: ErrSysPDDocPDPage and family, thumbnail, annotion errors
Severities: ErrSuppressable, ErrAlways, ErrSilent
Platforms: All

pdPErrBadType3Font Invalid Type 3 font.

pdPErrFormTooComplex Form is too complex to print.

pdPErrNoError No error.

pdPErrPageDimOutOfRange The dimensions of this page are out-of-


range.
pdPErrType3TooComplex Type 3 font is too complex to print.

pdPErrUnableToCreateRasterPort Creation of a raster port failed.

Acrobat and PDF Library API Overview 537


Errors
D

ErrSysPDSEdit
Error System: ErrSysPDSEditPDSEdit errors
Severity: ErrAlways
Platforms: All

pdsErrAlreadyExists There is already a table entry with the same


name.
pdsErrBadPDF An incorrect structure was found in the PDF file.

pdsErrCantDo Some software required to perform this


operation is not present in this version of Adobe
Acrobat.
pdsErrRequiredMissing A required field was missing from a dictionary.

pdsErrWrongTypeEntry Dictionary entry has wrong Cos type.

pdsErrWrongTypeParameter Wrong type parameter supplied to a PDS


procedure.

538 Acrobat and PDF Library API Overview


Errors
D

ErrSysRaster
Error System: ErrSysRasterRasterizer errors
Severity: ErrAlways
Platforms: All

rasErrCreatePort Creation of rasterizer port failed.

rasErrDraw A rasterizer error occurred.

rasErrInitFailed Initialization of the rasterizer module failed.

rasErrNoError No error.

Acrobat and PDF Library API Overview 539


Errors
D

ErrSysXtnMgr
Error System: ErrSysXtnMgrExtension manager errors. Errors registered by clients (see
ASRegisterErrorString) are automatically assigned to this error system.
Severity: ErrAlways
Platforms: All (some system-specific as noted)

xmErr68KOnly Only the 68K Viewer can load this client


(MacOS only).
xmErrCalledObsoleteProc An obsolete function was called.

xmErrCannotReplaceSelector Attempt to replace an selector that cannot be


replaced.
xmErrDuplicatePluginName Two clients are attempting to register with the
same name.
xmErrInitializationFailed The client failed to initialize.

xmErrNoError No error.

xmErrNoPLUGResource The client lacks a PLUG resource of ID 1 (MacOS


only)
xmErrNotPrivileged The Adobe Reader cannot load this client.

xmErrOutOfDateHFT The client was compiled with an out-of-date


HFT.
xmErrPluginIncompatible The client is incompatible with this version of
the Acrobat viewer.
xmErrPluginLoadFailed The client failed to load.

xmErrPPCOnly Only the PowerPC Viewer can load this client


(MacOS only).

540 Acrobat and PDF Library API Overview


E Macros

A4_GLOBALS
A4_GLOBALS
Description
(Macintosh only) Together with A5_GLOBALS, this specifies the address register off of
which a client references its globals. They are used only for 68xxx Macintosh clients, not for
PowerPC clients. Either A4_GLOBALS or A5_GLOBALS must be defined to be 1, and the
other undefined.
Both A4_GLOBALS and A5_GLOBALS are set automatically by PIPrefix.h.
Header File
PIPrefix.h
Related Macros
A5_GLOBALS

Acrobat and PDF Library API Overview 541


Macros
E

A5_GLOBALS
A5_GLOBALS
Description
(Macintosh only) Together with A4_GLOBALS, this specifies the address register off of
which a client references its globals. They are used only for 68xxx Macintosh clients, not for
PowerPC clients. Either A4_GLOBALS or A5_GLOBALS must be defined to be 1, and the
other undefined.
Both A4_GLOBALS and A5_GLOBALS are set automatically by PIPrefix.h.
Header File
PIPrefix.h
Related Macros
A4_GLOBALS

542 Acrobat and PDF Library API Overview


Macros
E

ACCB1
ACCB1
Description
Macro used when declaring callback functions. Its definition is platform-dependent. Use
this macro in every callback function you declare.
Use ACCB1 before the return value in a function declaration, as shown in the Example.
Header File
MacPlatform.h
WINPLTFM.H
Related Macros
ACCB2
ACCBPROTO1
ACCBPROTO2
Example
static ACCB1 ASAtom ACCB2 SnapZoomToolGetType(AVTool tool){

}

Acrobat and PDF Library API Overview 543


Macros
E

ACCB2
ACCB2
Description
Macro used when declaring callback functions. Its definition is platform-dependent. Use
this macro in every callback function you declare.
Use ACCB2 after the return value in a function declaration, as shown in the Example.
Header File
MacPlatform.h
WINPLTFM.H
Related Macros
ACCB1
ACCBPROTO1
ACCBPROTO2
Example
static ACCB1 ASAtom ACCB2 SnapZoomToolGetType(AVTool tool){

}

544 Acrobat and PDF Library API Overview


Macros
E

ACCBPROTO1
ACCBPROTO1
Description
Macro used when declaring function prototypes. Its definition is platform-dependent. Use
this macro in every function prototype you declare.
Use ACCBPROTO1 before the return value in a function prototype, as shown in the
Example.
Header File
MacPlatform.h
WINPLTFM.H
Related Macros
ACCBPROTO2
ACCB1
ACCB2
Example
static ACCBPROTO1 void (ACCBPROTO2
*DrawImageSelectionCallback)(AVPageView pageView, AVRect* updateRect,
void *data);

Acrobat and PDF Library API Overview 545


Macros
E

ACCBPROTO2
ACCBPROTO2
Description
Macro used when declaring function prototypes. Its definition is platform-dependent. Use
this macro in every function prototype you declare.
Use ACCBPROTO2 after the return value in a function prototype, as shown in the Example.
Header File
MacPlatform.h
WINPLTFM.H
Related Macros
ACCB1
ACCB2
ACCBPROTO1
Example
static ACCBPROTO1 void (ACCBPROTO2
*DrawImageSelectionCallback)(AVPageView pageView, AVRect* updateRect,
void *data);

546 Acrobat and PDF Library API Overview


Macros
E

ACROASSERT
ACROASSERT
Description
A platform-independent version of the ANSI assert function.
Header File
acroassert.h

Acrobat and PDF Library API Overview 547


Macros
E

ASFileSysCreatePathFromCString
ASFileSysCreatePathFromCString(asfs, cPath)
Description
Helper macro for the ASFileSysCreatePathName method. See this method for more
information.
NOTE: This macro uses a local variable named scratchFourBytes (void*
scratchFourBytes). PDF Library users need to provide this variable in order to
utilize the macro; the variable must be local to the client application, not to the
library. Any client can use this macro provided he also has code similar to the
following in the same source file that uses the macro:
static void* scratchFourBytes;
Parameters

asfs (May be NULL) The file system through which the ASPathName is
obtained.
cPath A C string containing the path for which the ASPathName is
obtained.

Header File
ASExpT.h
Related Macros
ASFileSysCreatePathFromDIPath
ASFileSysCreatePathFromFSSpec
ASFileSysCreatePathWithFolderName

548 Acrobat and PDF Library API Overview


Macros
E

ASFileSysCreatePathFromDIPath
ASFileSysCreatePathFromDIPath(asfs, cDIPath, aspRelativeTo)
Description
Helper macro for the ASFileSysCreatePathName method. See this method for more
information.
Parameters

asfs (May be NULL) The file system through which the ASPathName is
obtained.
cDIPath A C string containing the device-independent path for which the
ASPathName is obtained.
aspRelativeTo (May be NULL) An ASPathName that cDIPath will be evaluated
against if it contains a relative path.

Header File
ASExpT.h
Related Macros
ASFileSysCreatePathFromCString
ASFileSysCreatePathFromFSSpec
ASFileSysCreatePathWithFolderName

Acrobat and PDF Library API Overview 549


Macros
E

ASFileSysCreatePathFromFSSpec
ASFileSysCreatePathFromFSSpec(asfs, cPath)
Description
Helper macro for the ASFileSysCreatePathName method. See this method for more
information.
Parameters

asfs (May be NULL) The file system through which the ASPathName is
obtained.
cPath The FSSpec for which the ASPathName is obtained.

Header File
ASExpT.h
Related Macros
ASFileSysCreatePathFromCString
ASFileSysCreatePathFromDIPath
ASFileSysCreatePathWithFolderName

550 Acrobat and PDF Library API Overview


Macros
E

ASFileSysCreatePathWithFolderName
ASFileSysCreatePathWithFolderName(asfs, aspFolder, cFileName)
Description
Helper macro for the ASFileSysCreatePathName method. See this method for more
information.
Parameters

asfs (May be NULL) The file system through which the ASPathName is
obtained.
aspFolder ASPathName contained the path of the folder.
cFileName A C string containing the name of the file. The returned
ASPathName contains the result of appending cFileName to
aspFolder.

Header File
ASExpT.h
Related Macros
ASFileSysCreatePathFromCString
ASFileSysCreatePathFromDIPath
ASFileSysCreatePathFromFSSpec

Acrobat and PDF Library API Overview 551


Macros
E

ASFixedRoundToInt16
ASFixedRoundToInt16(f)
Description
Converts a fixed point number to an ASInt16, rounding the result.
Parameters

f The fixed point number to convert.

Header File
ASExpT.h
Related Macros
Fixed Numbers
ASFixedRoundToInt32
ASFixedTruncToInt16
ASFixedTruncToInt32
ASInt16ToFixed
ASInt32ToFixed

552 Acrobat and PDF Library API Overview


Macros
E

ASFixedRoundToInt32
ASFixedRoundToInt32(f)
Description
Converts a fixed point number to an ASInt32, rounding the result.
Parameters

f The fixed point number to convert.

Header File
ASExpT.h
Related Macros
Fixed Numbers
ASFixedRoundToInt16
ASFixedTruncToInt16
ASFixedTruncToInt32
ASInt16ToFixed
ASInt32ToFixed

Acrobat and PDF Library API Overview 553


Macros
E

ASFixedTruncToInt16
ASFixedTruncToInt16(f)
Description
Converts a fixed point number to an ASInt16, truncating the result.
Parameters

f The fixed point number to convert.

Header File
ASExpT.h
Related Macros
Fixed Numbers
ASFixedRoundToInt16
ASFixedRoundToInt32
ASFixedTruncToInt32
ASInt16ToFixed
ASInt32ToFixed

554 Acrobat and PDF Library API Overview


Macros
E

ASFixedTruncToInt32
ASFixedTruncToInt32(f)
Description
Converts a fixed point number to an ASInt32, truncating the result.
Parameters

f The fixed point number to convert.

Header File
ASExpT.h
Related Macros
Fixed Numbers
ASFixedRoundToInt16
ASFixedRoundToInt32
ASFixedTruncToInt16
ASInt16ToFixed
ASInt32ToFixed

Acrobat and PDF Library API Overview 555


Macros
E

ASInt16ToFixed
ASInt16ToFixed(i)
Description
Converts an ASInt16 to a fixed point number.
Parameters

i The ASInt16 to convert.

Header File
ASExpT.h
Related Macros
Fixed Numbers
ASFixedRoundToInt16
ASFixedRoundToInt32
ASFixedTruncToInt16
ASFixedTruncToInt32
ASInt32ToFixed

556 Acrobat and PDF Library API Overview


Macros
E

ASInt32ToFixed
ASInt32ToFixed(i)
Description
Converts an ASInt32 to a fixed point number.
Parameters

i The ASInt32 to convert.

Header File
ASExpT.h
Related Macros
Fixed Numbers
ASFixedRoundToInt16
ASFixedRoundToInt32
ASFixedTruncToInt16
ASFixedTruncToInt32
ASInt16ToFixed

Acrobat and PDF Library API Overview 557


Macros
E

CALL_REPLACED_PROC
CALL_REPLACED_PROC(hft, sel, replacer)(args...)
Description
Calls the previous implementation of a replaced method (that is, the code that would have
been executed before the method was replaced using REPLACE).
Parameters

hft The HFT containing the replaced method to execute, for example,
gAcroViewHFT. See HFT Values in the Acrobat and PDF Library
API Reference for a list of the Acrobat viewers built-in HFTs.
sel The selector for the replaced method to execute. The name must
have the characters SEL appended, for example, AVAlertSEL.
replacer The callback whose previous implementation is called. Recall that a
method may be replaced more than once, and all replacements for a
particular method are kept in a linked list. proc must be an element
in that linked list, and the entry before proc is the one that is called.
args... The argument list to pass to the procedure being called.

Header File
ASCalls.h
Related Macros
REPLACE
Related Methods
HFTGetReplacedEntry
Example
CALL_REPLACED_PROC(gAcroViewHFT, AVAlertSEL, myAlertCallback)(iconType,
gsm, button1, button2, button3, beep);

558 Acrobat and PDF Library API Overview


Macros
E

CastToPDAnnot
CastToPDAnnot(a)
Description
Casts a link annotation or a text annotation to a generic annotation.
Parameters

a The link annotation or text annotation to cast.

Header File
PDExpT.h
Related Macros
CastToPDLinkAnnot
CastToPDTextAnnot

Acrobat and PDF Library API Overview 559


Macros
E

CastToPDLinkAnnot
CastToPDLinkAnnot(a)
Description
Casts a generic annotation or a text annotation to a link annotation.
Parameters

a The generic annotation or text annotation to cast.

Header File
PDExpT.h
Related Macros
CastToPDAnnot
CastToPDTextAnnot

560 Acrobat and PDF Library API Overview


Macros
E

CastToPDTextAnnot
CastToPDTextAnnot(a)
Description
Casts a link annotation or a generic annotation to a text annotation.
Parameters

a The link annotation or generic annotation to cast.

Header File
PDExpT.h
Related Macros
CastToPDAnnot
CastToPDLinkAnnot

Acrobat and PDF Library API Overview 561


Macros
E

DEBUG
DEBUG
Description
Enables and disables compile-time type-checking in various declarations.
Define DEBUG as 1 to enable type-checking (when developing and testing clients) and as 0
to disable type-checking (before shipping your client).
Header File
MacPlatform.h
WINPLTFM.H
Related Methods and Callbacks
ASCallbackCreateNotification
ASCallbackCreateProto
ASCallbackCreateReplacement
Example
#define DEBUG 1

562 Acrobat and PDF Library API Overview


Macros
E

DURING
DURING
Description
Begins the section of code where Acrobat APIs may throw an exception. After calling an
Acrobat API method, execution may jump into the HANDLER clause. This macro is similar to
the TRY clause in the C++ language.
Header File
CorCalls.h
Related Macros
END_HANDLER
E_RETURN
E_RTRN_VOID
HANDLER

Acrobat and PDF Library API Overview 563


Macros
E

END_HANDLER
END_HANDLER
Description
Ends a DURING/HANDLER/END_HANDLER clause.
Header File
CorCalls.h
Related Macros
DURING
E_RETURN
E_RTRN_VOID
HANDLER

564 Acrobat and PDF Library API Overview


Macros
E

E_RETURN
E_RETURN
Description
Returns a value from an enclosing function when nested inside a DURING/HANDLER clause.
Header File
CorCalls.h
Related Macros
DURING
END_HANDLER
E_RTRN_VOID
HANDLER

Acrobat and PDF Library API Overview 565


Macros
E

ERRORCODE
ERRORCODE
Description
Macro defined to call ASGetExceptionErrorCode. Returns an ASInt32 containing
exception error code. See Appendix D, Errors.
Header File
CorCalls.h
Related Macros
DURING
END_HANDLER
E_RETURN
HANDLER

566 Acrobat and PDF Library API Overview


Macros
E

E_RTRN_VOID
E_RTRN_VOID
Description
Returns from an enclosing function when nested inside a DURING/HANDLER clause,
without returning a value.
Header File
CorCalls.h
Related Macros
ErrGetCode
ErrGetSeverity
ErrGetSignedCode
ErrGetSystem

Acrobat and PDF Library API Overview 567


Macros
E

ErrBuildCode
ErrBuildCode(xseverity, xsys, xerror)
Description
Builds an error code for the specified severity, system, and error number. Error codes are
used in exception handling. The ASRaise method takes an error code for its argument;
ASRegisterErrorString returns an error code.
An error code has three components:
Severity: none, warning, severe; 4 bits
System: Cos, PDDoc, and so on; 8 bits
Error: FileOpen, Syntax, and so on; 16 bits
Parameters

xseverity Severity of the error. One of Severities.

xsys Error system. Must be one of Error Systems.

xerror Error number in the error system, xsys.

Header File
AcroErr.h
Related Macros
ErrGetCode
ErrGetSeverity
ErrGetSignedCode
ErrGetSystem
Related Methods
ASRaise
ASRegisterErrorString
Example
myErrorCode = ErrBuildCode(ErrAlways, ErrSysAcroView,
avErrActionRestricted);

568 Acrobat and PDF Library API Overview


Macros
E

ErrGetCode
ErrGetCode(xcode)
Description
Gets the error number from an error code.
Parameters

xcode Error code.

Header File
AcroErr.h
Related Macros
ErrBuildCode
ErrGetSeverity
ErrGetSignedCode
ErrGetSystem
Related Methods
ASGetErrorString
ASGetExceptionErrorCode
ASRegisterErrorString
Example
errorNumber = ErrGetCode(errorCode);

Acrobat and PDF Library API Overview 569


Macros
E

ErrGetSeverity
ErrGetSeverity(xcode)
Description
Gets the error severity from an error code. Returns one of Severities.
Parameters

xcode Error code.

Header File
AcroErr.h
Related Macros
ErrBuildCode
ErrGetCode
ErrGetSignedCode
ErrGetSystem
Related Methods
ASGetErrorString
ASGetExceptionErrorCode
ASRegisterErrorString
Example
errorSeverity = ErrGetSeverity(errorCode);

570 Acrobat and PDF Library API Overview


Macros
E

ErrGetSignedCode
ErrGetSignedCode(xcode)
Description
Gets a signed error number from an error code.
Parameters

xcode Error code.

Header File
AcroErr.h
Related Macros
ErrBuildCode
ErrGetCode
ErrGetSeverity
ErrGetSystem
Related Methods
ASGetErrorString
ASGetExceptionErrorCode
ASRegisterErrorString
Example
errorSignedNumber = ErrGetSignedCode(errorCode);

Acrobat and PDF Library API Overview 571


Macros
E

ErrGetSystem
ErrGetSystem(xcode)
Description
Gets the error system from an error code. Returns one of Error Systems.
Parameters

xcode Error code.

Header File
AcroErr.h
Related Macros
ErrBuildCode
ErrGetCode
ErrGetSeverity
ErrGetSignedCode
Related Methods
ASGetErrorString
ASGetExceptionErrorCode
ASRegisterErrorString
Example
errorSystem = ErrGetSystem(errorCode);

572 Acrobat and PDF Library API Overview


Macros
E

Fixed Numbers
Description
A variety of predefined fixed-point constants.

fixedZero fixedFive
fixedHundredth fixedSix
fixedSixteenth fixedSeven
fixedTenth fixedEight
fixedEighth fixedNine
fixedQuarter fixedTen
fixedHalf fixedEleven
fixedThreeQuarters fixedTwelve
fixedPi4 fixedSixteen
fixedSevenEighths fixedThirtyTwo
fixedOne1 fixedFifty
fixedOne fixedSeventyTwo
fixedOneAndQuarter fixedNinety
fixedFourThirds fixedHundred
fixedSqrtTwo fixedHundredFifty
fixedThreeHalves fixedOneEighty
fixedOneAnd3Qtr fixedTwoSeventy
fixedPi2 fixedFiveHundred
fixedGolden fixedThousand
fixedTwo fixedTenThousand
fixedThree fixedNegativeInfinity
fixedFour fixedPositiveInfinity

Header File
ASExpT.h

Acrobat and PDF Library API Overview 573


Macros
E

Related Macros
ASFixedTruncToInt16
ASFixedTruncToInt32
ASFixedRoundToInt16
ASFixedRoundToInt32
ASFixedTruncToInt16
ASInt16ToFixed
ASInt32ToFixed

574 Acrobat and PDF Library API Overview


Macros
E

HANDLER
HANDLER
Description
Follows a DURING macro. Code inserted between HANDLER and END_HANDLER macros
will be executed only if an Acrobat function or other function THROWs. This macro is similar
to the CATCH clause in the C++ language.
Header File
CorCalls.h
Related Macros
DURING
END_HANDLER
E_RETURN
E_RTRN_VOID

Acrobat and PDF Library API Overview 575


Macros
E

MAC_PLATFORM
MAC_PLATFORM
Description
(Macintosh only, previously known as MAC_ENV) Defined if the client is being compiled for a
Macintosh, undefined otherwise. MAC_PLATFORM, WIN_PLATFORM, and
UNIX_PLATFORM should be used by client developers to conditionally compile platform-
dependent code.
MAC_PLATFORM is automatically set by the header files.
Header File
Environ.h (based on a value set in MacPlatform.h)
Related Macros
UNIX_PLATFORM
WIN_PLATFORM

576 Acrobat and PDF Library API Overview


Macros
E

MAC68K
MAC68K
Description
(Macintosh only) Together with POWER_PC, specifies which processor architecture a client
is targeted for. Either POWER_PC or MAC68K must be defined as 1, the other as 0.
POWER_PC and MAC68K are automatically set by PIPrefix.h.
Header File
PIPrefix.h
Related Macros
POWER_PC

Acrobat and PDF Library API Overview 577


Macros
E

PI_ACROSUPPORT_VERSION
PI_ACROSUPPORT_VERSION
Description
Specifies the version of the Acrobat support level HFT.
This is automatically set by PIRequir.h.
Header File
PIRequir.h
Errors
If the HFT version is higher that the viewer loading the client supports, it displays an alert
box with the message There was an error while loading the client '<plug-in name>'. The
client is incompatible with this version of the Viewer.
Related Macros
PI_ACROVIEW_VERSION
PI_CORE_VERSION
PI_COS_VERSION
PI_MACINTOSH_VERSION
PI_PDMODEL_VERSION
PI_UNIX_VERSION
PI_WIN_VERSION

578 Acrobat and PDF Library API Overview


Macros
E

PI_ACROVIEW_VERSION
PI_ACROVIEW_VERSION
Description
Specifies the version of the Acrobat viewer level HFT.
This is automatically set by PIRequir.h.
Header File
PIRequir.h
Errors
If the HFT version is higher that the viewer loading the client supports, it displays an alert
box with the message There was an error while loading the client '<plug-in name>'. The
client is incompatible with this version of the Viewer.
Related Macros
PI_ACROSUPPORT_VERSION
PI_CORE_VERSION
PI_COS_VERSION
PI_MACINTOSH_VERSION
PI_PDMODEL_VERSION
PI_UNIX_VERSION
PI_WIN_VERSION

Acrobat and PDF Library API Overview 579


Macros
E

PI_CORE_VERSION
PI_CORE_VERSION
Description
Specifies the version of the HFT.
This is automatically set by PIRequir.h.
Header File
PIRequir.h
Errors
If the HFT version is higher that the viewer loading the client supports, it displays an alert
box with the message There was an error while loading the client '<plug-in name>'. The
client is incompatible with this version of the viewer.
Related Macros
PI_ACROSUPPORT_VERSION
PI_ACROVIEW_VERSION
PI_COS_VERSION
PI_MACINTOSH_VERSION
PI_PDMODEL_VERSION
PI_UNIX_VERSION
PI_WIN_VERSION

580 Acrobat and PDF Library API Overview


Macros
E

PI_COS_VERSION
PI_COS_VERSION
Description
Specifies the version of the Cos-level HFT.
This is automatically set by PIRequir.h.
Header File
PIRequir.h
Errors
If the HFT version is higher that the viewer loading the client supports, it displays an alert
box with the message There was an error while loading the client '<plug-in name>'. The
client is incompatible with this version of the Viewer.
Related Macros
PI_ACROSUPPORT_VERSION
PI_ACROVIEW_VERSION
PI_CORE_VERSION
PI_MACINTOSH_VERSION
PI_PDMODEL_VERSION
PI_UNIX_VERSION
PI_WIN_VERSION

Acrobat and PDF Library API Overview 581


Macros
E

PI_MACINTOSH_VERSION
PI_MACINTOSH_VERSION
Description
Specifies the version of the Macintosh-only methods HFT.
This is automatically set by PIRequir.h.
Header File
PIRequir.h
Errors
If the HFT version is higher that the viewer loading the client supports, it displays an alert
box with the message There was an error while loading the client '<plug-in name>'. The
client is incompatible with this version of the Viewer.
Related Macros
PI_ACROSUPPORT_VERSION
PI_ACROVIEW_VERSION
PI_CORE_VERSION
PI_COS_VERSION
PI_PDMODEL_VERSION
PI_UNIX_VERSION
PI_WIN_VERSION

582 Acrobat and PDF Library API Overview


Macros
E

PI_PDMODEL_VERSION
PI_PDMODEL_VERSION
Description
Specifies the version of the PD level HFT.
This is automatically set by PIRequir.h.
Header File
PIRequir.h
Errors
If the HFT version is higher that the viewer loading the client supports, it displays an alert
box with the message There was an error while loading the client '<plug-in name>'. The
client is incompatible with this version of the Viewer.
Related Macros
PI_ACROSUPPORT_VERSION
PI_ACROVIEW_VERSION
PI_CORE_VERSION
PI_COS_VERSION
PI_MACINTOSH_VERSION
PI_UNIX_VERSION
PI_WIN_VERSION

Acrobat and PDF Library API Overview 583


Macros
E

PI_UNIX_VERSION
PI_UNIX_VERSION
Description
Specifies the version of the UNIX-only methods HFT.
This is automatically set by PIRequir.h.
Header File
PIRequir.h
Errors
If the HFT version is higher that the viewer loading the client supports, it displays an alert
box with the message There was an error while loading the client '<plug-in name>'. The
client is incompatible with this version of the Viewer.
Related Macros
PI_ACROSUPPORT_VERSION
PI_ACROVIEW_VERSION
PI_CORE_VERSION
PI_COS_VERSION
PI_MACINTOSH_VERSION
PI_PDMODEL_VERSION
PI_WIN_VERSION

584 Acrobat and PDF Library API Overview


Macros
E

PI_WIN_VERSION
PI_WIN_VERSION
Description
Specifies the version of the Windows-only methods HFT.
This is automatically set by PIRequir.h.
Header File
PIRequir.h
Errors
If the HFT version is higher that the viewer loading the client supports, it displays an alert
box with the message There was an error while loading the client '<plug-in name>'. The
client is incompatible with this version of the Viewer.
Related Macros
PI_ACROSUPPORT_VERSION
PI_ACROVIEW_VERSION
PI_CORE_VERSION
PI_COS_VERSION
PI_MACINTOSH_VERSION
PI_PDMODEL_VERSION
PI_UNIX_VERSION

Acrobat and PDF Library API Overview 585


Macros
E

PLATFORM
PLATFORM
Description
Defines the platform-specific header file. Must be "MacPlatform.h" in Mac OS,
"WINPLTFM.H" in Windows.
PLATFORM is automatically set by the header file.
Header File
PIPrefix.h (Macintosh)
ENVIRON.H (Windows)

586 Acrobat and PDF Library API Overview


Macros
E

POWER_PC
POWER_PC
Description
(Macintosh only) Together with MAC68K, specifies which processor architecture a client is
targeted for. Either POWER_PC or MAC68K must be defined as 1, the other as 0.
POWER_PC and MAC68K are automatically set by PIPrefix.h.
Header File
PIPrefix.h
Related Macros
MAC68K

Acrobat and PDF Library API Overview 587


Macros
E

PRODUCT
PRODUCT
Description
Defines the platform-specific header file. Must be Plugin.h in Mac OS and Windows.
PRODUCT is automatically set by the header file.
Header File
PIPrefix.h (Macintosh)
ENVIRON.H (Windows)

588 Acrobat and PDF Library API Overview


Macros
E

REGISTER_NOTIFICATION
REGISTER_NOTIFICATION(nselName, proc, rock)
Description
Macro to register a notification. Uses AVAppRegisterNotification.
Header File
PICommon.h

Acrobat and PDF Library API Overview 589


Macros
E

REPLACE
REPLACE(hft, sel, proc)
Description
Replaces one of the Acrobat viewers built-in methods. The method being replaced must be
one of the Replaceable Methods. The methods HFTEntryReplaceable flag is
automatically set, allowing it to be subsequently replaced.
All clients, and the Acrobat viewer itself, share a single copy of each HFT. As a result, when a
client replaces the implementation of a method, all other clients and the Acrobat viewer
also use the new implementation of that method. In addition, once a methods
implementation has been replaced, there is no way to remove the new implementation
without restarting the Acrobat viewer.
NOTE: The CALL_REPLACED_PROC macro is available to call the previous HFT entry
function that was replaced.
Parameters

hft The HFT containing the method to replace, for example,


gAcroViewHFT. See HFT Values in the Acrobat and PDF Library
API Reference for a list of the Acrobat viewers built-in HFTs.
sel The selector for the method to replace. The name must have the
characters SEL appended, for example, AVAlertSEL.
proc A callback containing the replacement method. The callback must
have been created using ASCallbackCreateReplacement.

Header File
PICommon.h
Related Macros
CALL_REPLACED_PROC
Related Methods
ASCallbackCreateReplacement
HFTReplaceEntry
Examples
myAlertCallback = ASCallbackCreateReplacement(AVAlertSEL, myAlert);
REPLACE(gAcroViewHFT, AVAlertSEL, myAlertCallback);

590 Acrobat and PDF Library API Overview


Macros
E

RERAISE
RERAISE
Description
Re-raises the most recently raised exception and passes it to the next exception handler in
the stack.
Parameters
None
Header File
CorCalls.h
Related Macros
ErrGetCode
ErrGetSeverity
ErrGetSignedCode
ErrGetSystem
Related Methods
ASRaise

Acrobat and PDF Library API Overview 591


Macros
E

UNIX_PLATFORM
UNIX_PLATFORM
Description
(UNIX only) Defined if the client is being compiled for a UNIX platform, undefined
otherwise. MAC_PLATFORM, WIN_PLATFORM, and UNIX_PLATFORM should be
used by client developers to conditionally compile platform-dependent code.
UNIX_PLATFORM must be defined in the arguments to the C compiler. The make files for
the sample clients in the Acrobat SDK do this automatically.
Header File
Environ.h (based on a value set in UNIXPlatform.h)
Related Macros
MAC_PLATFORM
WIN_PLATFORM

592 Acrobat and PDF Library API Overview


Macros
E

WIN_PLATFORM
WIN_PLATFORM
Description
(Windows only, previously known as WIN_ENV) Defined if the client is being compiled for a
Windows machine, undefined otherwise. MAC_PLATFORM, WIN_PLATFORM, and
UNIX_PLATFORM should be used by client developers to conditionally compile platform-
dependent code.
WIN_PLATFORM must be defined in the arguments to the C compiler. The make files for
the sample clients in the Acrobat SDK do this automatically.
Header File
Environ.h (based on a value set in WinPltfm.h)
Related Macros
MAC_PLATFORM
UNIX_PLATFORM

Acrobat and PDF Library API Overview 593


Macros
E

594 Acrobat and PDF Library API Overview


Macros
E

Acrobat and PDF Library API Overview 595


Macros
E

596 Acrobat and PDF Library API Overview


F Platform Support Provided by Each
API

This Appendix consists of a single comprehensive table showing every API and the
platform(s) supported by each.

API Where? PDFL? Pro? Std? Rdr?


ACApplyTransform CORE YES YES YES NO

ACEngineCount CORE YES YES YES NO

ACEngineInfo CORE YES YES YES NO

ACGetSettingsProfile CORE YES YES YES NO

ACGetSettingsString CORE YES YES YES NO

ACGetSettingsUnsigned32 CORE YES YES YES NO

ACGetWorkingSpaceProfile CORE YES YES YES NO

ACLoadSettings CORE YES YES YES NO

ACMakeBufferProfile CORE YES YES YES NO

ACMakeCalGray CORE YES YES YES NO

ACMakeCalLab CORE YES YES YES NO

ACMakeCalRGB CORE YES YES YES NO

ACMakeColorTransform CORE YES YES YES NO

ACMakePresetList CORE YES YES YES NO

ACMakeProfileList CORE YES YES YES NO

ACMakeSettings CORE YES YES YES NO

ACMakeString CORE YES YES YES NO

ACMonitorProfile CORE YES YES YES NO

ACPresetFileToName CORE YES YES YES NO

ACPresetListCount CORE YES YES YES NO

ACPresetListItemFile CORE YES YES YES NO

Acrobat and PDF Library API Overview 597


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


ACProfileColorSpace CORE YES YES YES NO

ACProfileData CORE YES YES YES NO

ACProfileDescription CORE YES YES YES NO

ACProfileFromCode CORE YES YES YES NO

ACProfileFromDescription CORE YES YES YES NO

ACProfileListCount CORE YES YES YES NO

ACProfileListItemCode CORE YES YES YES NO

ACProfileListItemDescrip- CORE YES YES YES NO


tion
ACProfileSize CORE YES YES YES NO

ACProfilesMatch CORE YES YES YES NO

ACSetEngine CORE YES YES YES NO

ACStringASCII CORE YES YES YES NO

ACStringLocalized CORE YES YES YES NO

ACStringUnicode CORE YES YES YES NO

ACUnReferencePresetList CORE YES YES YES NO

ACUnReferenceProfile CORE YES YES YES NO

ACUnReferenceProfileList CORE YES YES YES NO

ACUnReferenceSettings CORE YES YES YES NO

ACUnReferenceString CORE YES YES YES NO

ACUnReferenceTransform CORE YES YES YES NO

ASAtomExistsForString CORE YES YES YES YES

ASAtomFromString CORE YES YES YES YES

ASAtomGetString CORE YES YES YES YES

ASCabCopy CORE YES YES YES YES

ASCabDestroy CORE YES YES YES YES

ASCabDestroyEmpties CORE YES YES YES YES

598 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


ASCabDetachBinary CORE YES YES YES YES

ASCabDetachCab CORE YES YES YES YES

ASCabDetachPathName CORE YES YES YES YES

ASCabDetachPointerRaw CORE YES YES YES YES

ASCabDetachString CORE YES YES YES YES

ASCabDetachText CORE YES YES YES YES

ASCabDup CORE YES YES YES YES

ASCabEnum CORE YES YES YES YES

ASCabEqual CORE YES YES YES YES

ASCabFromEntryList CORE YES YES YES YES

ASCabGetAtom CORE YES YES YES YES

ASCabGetBinary CORE YES YES YES YES

ASCabGetBinaryCopy CORE YES YES YES YES

ASCabGetBool CORE YES YES YES YES

ASCabGetCab CORE YES YES YES YES

ASCabGetDouble CORE YES YES YES YES

ASCabGetInt CORE YES YES YES YES

ASCabGetInt64 CORE YES YES YES YES

ASCabGetPathNameCopy CORE YES YES YES YES

ASCabGetPointerDestroyProc CORE YES YES YES YES

ASCabGetPointerRaw CORE YES YES YES YES

ASCabGetPointerType CORE YES YES YES YES

ASCabGetString CORE YES YES YES YES

ASCabGetStringCopy CORE YES YES YES YES

ASCabGetText CORE YES YES YES YES

ASCabGetType CORE YES YES YES YES

Acrobat and PDF Library API Overview 599


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


ASCabGetUns CORE YES YES YES YES

ASCabGetUns64 CORE YES YES YES YES

ASCabKnown CORE YES YES YES YES

ASCabMakeEmpty CORE YES YES YES YES

ASCabMunge CORE YES YES YES YES

ASCabNew CORE YES YES YES YES

ASCabNumEntries CORE YES YES YES YES

ASCabPutAtom CORE YES YES YES YES

ASCabPutBinary CORE YES YES YES YES

ASCabPutBool CORE YES YES YES YES

ASCabPutCab CORE YES YES YES YES

ASCabPutDouble CORE YES YES YES YES

ASCabPutInt CORE YES YES YES YES

ASCabPutInt64 CORE YES YES YES YES

ASCabPutNull CORE YES YES YES YES

ASCabPutPathName CORE YES YES YES YES

ASCabPutPointerRaw CORE YES YES YES YES

ASCabPutString CORE YES YES YES YES

ASCabPutText CORE YES YES YES YES

ASCabPutUns CORE YES YES YES YES

ASCabPutUns64 CORE YES YES YES YES

ASCabReadFromStream CORE YES YES YES YES

ASCabRemove CORE YES YES YES YES

ASCabRename CORE YES YES YES YES

ASCabValueEqual CORE YES YES YES YES

ASCabWriteToStream CORE YES YES YES YES

600 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


ASCalendarTimeSpanAddWith- CORE YES YES YES YES
Base
ASCalendarTimeSpanCompare CORE YES YES YES YES

ASCalendarTimeSpanDiff CORE YES YES YES YES

ASCallbackCreate CORE YES YES YES YES

ASCallbackDestroy CORE YES YES YES YES

ASConstCabEnum CORE NO YES YES YES

ASCStringToFixed CORE YES YES YES YES

ASDateAddCalendarTimeSpan CORE YES YES YES YES

ASDateAddTimeSpan CORE YES YES YES YES

ASDateCalendarDiff CORE YES YES YES YES

ASDateClear CORE YES YES YES YES

ASDateCompare CORE YES YES YES YES

ASDateCopy CORE YES YES YES YES

ASDateDestroy CORE YES YES YES YES

ASDateDup CORE YES YES YES YES

ASDateExactDiff CORE YES YES YES YES

ASDateGetLocalTime CORE YES YES YES YES

ASDateGetTimeString CORE YES YES YES YES

ASDateGetUTCTime CORE YES YES YES YES

ASDateNew CORE YES YES YES YES

ASDateSetLocalTimeOffset CORE YES YES YES YES

ASDateSetTimeFromRec CORE YES YES YES YES

ASDateSetTimeFromString CORE YES YES YES YES

ASDateSetToCurrentLocalTime CORE YES YES YES YES

ASDateSetToCurrentUTCTime CORE YES YES YES YES

Acrobat and PDF Library API Overview 601


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


ASDateSubtractCalendarT- CORE YES YES YES YES
imeSpan
ASDateSubtractTimeSpan CORE YES YES YES YES

ASDebug CORE YES YES YES YES

ASEnumExtensions CORE YES YES YES YES

ASExtensionGetFileName CORE YES YES YES YES

ASExtensionGetRegistered- CORE YES YES YES YES


Name
ASExtensionMgrGetHFT CORE YES YES YES YES

ASFileAcquirePathName CORE YES YES YES YES

ASFileCanSetEOF CORE YES YES YES YES

ASFileClearOutstandingM- CORE YES YES YES YES


Reads
ASFileClose CORE YES YES YES YES

ASFileFlush CORE YES YES YES YES

ASFileFromMDFile CORE YES YES YES YES

ASFileGetEOF CORE YES YES YES YES

ASFileGetEOF64 CORE YES YES YES YES

ASFileGetFileSys CORE YES YES YES YES

ASFileGetFileSysByName CORE YES YES YES YES

ASFileGetMDFile CORE YES YES YES YES

ASFileGetOpenMode CORE YES YES YES YES

ASFileGetPos CORE YES YES YES YES

ASFileGetPos64 CORE YES YES YES YES

ASFileGetURL CORE YES YES YES YES

ASFileHardFlush CORE YES YES YES YES

ASFileHasOutstandingMReads CORE YES YES YES YES

602 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


ASFileIsSame CORE YES YES YES YES

ASFileMReadRequest CORE YES YES YES YES

ASFilePushData CORE YES YES YES YES

ASFileRead CORE YES YES YES YES

ASFileRegisterFileSys CORE YES YES YES YES

ASFileReopen CORE YES YES YES YES

ASFileSetEOF CORE YES YES YES YES

ASFileSetEOF64 CORE YES YES YES YES

ASFileSetMode CORE YES YES YES YES

ASFileSetPos CORE YES YES YES YES

ASFileSetPos64 CORE YES YES YES YES

ASFileStmRdOpen CORE YES YES YES YES

ASFileStmWrOpen CORE YES YES YES YES

ASFileSysAcquireFileSysPath CORE YES YES YES YES

ASFileSysAcquireParent CORE YES YES YES YES

ASFileSysAcquirePlatform- CORE YES YES YES YES


Path
ASFileSysCanPerformOpOnItem CORE YES YES YES YES

ASFileSysConvertCabToItem- CORE YES YES YES YES


Props
ASFileSysConvertItemProp- CORE YES YES YES YES
sToCab
ASFileSysCopyPath CORE YES YES YES YES

ASFileSysCreateFolder CORE YES YES YES YES

ASFileSysCreatePathName CORE YES YES YES YES

ASFileSysDestroyFolderIter- CORE YES YES YES YES


ator
ASFileSysDIPathFromPath CORE YES YES YES YES

Acrobat and PDF Library API Overview 603


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


ASFileSysDIPathFromPathEx CORE YES YES YES YES

ASFileSysDisplayASTextFrom- CORE YES YES YES YES


Path
ASFileSysDisplayStringFrom- CORE YES YES YES YES
Path
ASFileSysFirstFolderItem CORE YES YES YES YES

ASFileSysFlushVolume CORE YES YES YES YES

ASFileSysGetFilePosLimit CORE YES YES YES YES

ASFileSysGetItemProps CORE YES YES YES YES

ASFileSysGetItemPropsAsCab CORE YES YES YES YES

ASFileSysGetNameFromPath CORE YES YES YES YES

ASFileSysGetNameFromPathA- CORE YES YES YES YES


sASText
ASFileSysGetNameFromPath- CORE YES YES YES YES
ForDisplay
ASFileSysGetStorage- CORE YES YES YES YES
FreeSpace
ASFileSysGetTempPathName CORE YES YES YES YES

ASFileSysGetTypeAndCreator CORE YES YES YES YES

ASFileSysNextFolderItem CORE YES YES YES YES

ASFileSysOpenFile CORE YES YES YES YES

ASFileSysOpenFile64 CORE YES YES YES YES

ASFileSysPathFromDIPath CORE YES YES YES YES

ASFileSysPathFromDIPathEx CORE YES YES YES YES

ASFileSysPerformOpOnItem CORE YES YES YES YES

ASFileSysReleasePath CORE NO YES YES YES

ASFileSysReleasePathName CORE YES YES YES YES

ASFileSysReleasePlatform- CORE YES YES YES YES


Path

604 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


ASFileSysRemove CORE YES YES YES YES

ASFileSysRemoveFile CORE NO YES YES YES

ASFileSysRemoveFolder CORE YES YES YES YES

ASFileSysSetTypeAndCreator CORE YES YES YES YES

ASFileSysURLFromPath CORE YES YES YES YES

ASFileUnregisterFileSys CORE YES YES YES YES

ASFileWrite CORE YES YES YES YES

ASFixedDiv CORE YES YES YES YES

ASFixedMatrixConcat CORE YES YES YES YES

ASFixedMatrixInvert CORE YES YES YES YES

ASFixedMatrixTransform CORE YES YES YES YES

ASFixedMatrixTransformRect CORE YES YES YES YES

ASFixedMul CORE YES YES YES YES

ASFixedToCString CORE YES YES YES YES

ASFixedToFloat CORE YES YES YES YES

ASfree CORE YES YES YES YES

ASGetConfiguration CORE YES YES YES YES

ASGetDefaultFileSys CORE YES YES YES YES

ASGetErrorString CORE YES YES YES YES

ASGetExceptionErrorCode CORE YES YES YES YES

ASGetRamFileSys CORE YES YES YES YES

ASGetSecs CORE YES YES YES YES

ASGetTempFileSys CORE YES YES YES YES

ASHostMBLen CORE YES YES YES YES

ASIsValidUTF8 CORE YES YES YES YES

ASmalloc CORE YES YES YES YES

Acrobat and PDF Library API Overview 605


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


ASMemStmRdOpen CORE YES YES YES YES

ASPathFromPlatformPath CORE YES YES YES YES

ASPlatformPathGetCFURLRe- CORE YES YES YES YES


fRecPtr
ASPlatformPathGetCstringPtr CORE YES YES YES YES

ASPlatformPathGetFSRefPtr CORE YES YES YES YES

ASPlatformPathGetFSRefWith- CORE YES YES YES YES


CFStringRefRecPtr
ASPlatformPathGetFSSpecPtr CORE YES YES YES YES

ASPlatformPathGetPOSIX- CORE YES YES YES YES


PathPtr
ASPopExceptionFrame CORE YES YES YES YES

ASProcStmRdOpen CORE YES YES YES YES

ASProcStmRdOpenEx CORE YES YES YES YES

ASProcStmWrOpen CORE YES YES YES YES

ASPushExceptionFrame CORE YES YES YES YES

ASRaise CORE YES YES YES YES

ASRamFileSysSetLimitKB CORE YES YES YES YES

ASrealloc CORE YES YES YES YES

ASRegisterErrorString CORE YES YES YES YES

ASScriptFromHostEncoding CORE YES YES YES YES

ASScriptToHostEncoding CORE YES YES YES YES

ASSetTempFileSys CORE YES YES YES YES

ASStmClose CORE YES YES YES YES

ASStmFlush CORE YES YES YES YES

ASStmRead CORE YES YES YES YES

ASStmWrite CORE YES YES YES YES

606 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


ASTextCaseSensitiveCmp CORE YES YES YES YES

ASTextCat CORE YES YES YES YES

ASTextCatMany CORE YES YES YES YES

ASTextCmp CORE YES YES YES YES

ASTextCopy CORE YES YES YES YES

ASTextDestroy CORE YES YES YES YES

ASTextDup CORE YES YES YES YES

ASTextEval CORE YES YES YES YES

ASTextFilter CORE YES YES YES YES

ASTextFromEncoded CORE YES YES YES YES

ASTextFromInt32 CORE YES YES YES YES

ASTextFromPDText CORE YES YES YES YES

ASTextFromScriptText CORE YES YES YES YES

ASTextFromSizedEncoded CORE YES YES YES YES

ASTextFromSizedPDText CORE YES YES YES YES

ASTextFromSizedScriptText CORE YES YES YES YES

ASTextFromSizedUnicode CORE YES YES YES YES

ASTextFromUnicode CORE YES YES YES YES

ASTextFromUns32 CORE YES YES YES YES

ASTextGetBestEncoding CORE YES YES YES YES

ASTextGetBestScript CORE YES YES YES YES

ASTextGetCountry CORE YES YES YES YES

ASTextGetEncoded CORE YES YES YES YES

ASTextGetEncodedCopy CORE YES YES YES YES

ASTextGetLanguage CORE YES YES YES YES

ASTextGetPDTextCopy CORE YES YES YES YES

Acrobat and PDF Library API Overview 607


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


ASTextGetScriptText CORE YES YES YES YES

ASTextGetScriptTextCopy CORE YES YES YES YES

ASTextGetUnicode CORE YES YES YES YES

ASTextGetUnicodeCopy CORE YES YES YES YES

ASTextIsEmpty CORE YES YES YES YES

ASTextMakeEmpty CORE YES YES YES YES

ASTextNew CORE YES YES YES YES

ASTextNormalizeEndOfLine CORE YES YES YES YES

ASTextReplace CORE YES YES YES YES

ASTextReplaceASCII CORE YES YES YES YES

ASTextReplaceBadChars CORE YES YES YES YES

ASTextSetCountry CORE YES YES YES YES

ASTextSetEncoded CORE YES YES YES YES

ASTextSetLanguage CORE YES YES YES YES

ASTextSetPDText CORE YES YES YES YES

ASTextSetScriptText CORE YES YES YES YES

ASTextSetSizedEncoded CORE YES YES YES YES

ASTextSetSizedPDText CORE YES YES YES YES

ASTextSetSizedScriptText CORE YES YES YES YES

ASTextSetSizedUnicode CORE YES YES YES YES

ASTextSetUnicode CORE YES YES YES YES

ASTimeSpanAdd CORE YES YES YES YES

ASTimeSpanCompare CORE YES YES YES YES

ASTimeSpanCopy CORE YES YES YES YES

ASTimeSpanDestroy CORE YES YES YES YES

ASTimeSpanDiff CORE YES YES YES YES

608 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


ASTimeSpanDup CORE YES YES YES YES

ASTimeSpanGetASInt32 CORE YES YES YES YES

ASTimeSpanNegate CORE YES YES YES YES

ASTimeSpanNew CORE YES YES YES YES

ASTimeSpanSet CORE YES YES YES YES

ASTimeSpanSetFromASInt32 CORE YES YES YES YES

ASTimeSpanSetFromString CORE YES YES YES YES

ASUUIDFromCString CORE YES YES YES YES

ASUUIDGenFromHash CORE YES YES YES YES

ASUUIDGenFromName CORE YES YES YES YES

ASUUIDGenUnique CORE YES YES YES YES

ASUUIDToCString CORE YES YES YES YES

AVAcquireSpecialFilePath- CORE NO YES YES YES


Name
AVAcquireSpecialFilePath- CORE NO YES YES YES
NameWithASText
AVAcquireSpecialFolderPath- CORE NO YES YES YES
Name
AVActionHandlerGetProcs CORE NO YES YES YES

AVActionHandlerGetType CORE NO YES YES YES

AVActionHandlerGetUIName CORE NO YES YES YES

AVAlert CORE NO YES YES YES

AVAlertConfirm CORE NO YES YES YES

AVAlertGetPref CORE NO YES YES YES

AVAlertNote CORE NO YES YES YES

AVAlertResetPrefs CORE NO YES YES YES

AVAlertSetPref CORE NO YES YES YES

Acrobat and PDF Library API Overview 609


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


AVAlertWithParams CORE NO YES YES YES

AVAnnotHandlerDeleteInfo CORE NO YES YES YES

AVAnnotHandlerGetInfo CORE NO YES YES YES

AVAppAutoShowHowToPanel CORE NO YES YES YES

AVAppBeginFullScreen CORE NO YES YES YES

AVAppBeginModal CORE NO YES YES YES

AVAppCanQuit CORE NO YES YES YES

AVAppChooseFolderDialog CORE NO YES YES YES

AVAppCreateIconBundle6 CORE NO YES YES YES

AVAppDidOrWillSwitchForDia- CORE NO YES YES YES


log
AVAppDoingFullScreen CORE NO YES YES YES

AVAppEndFullScreen CORE NO YES YES YES

AVAppEndModal CORE NO YES YES YES

AVAppEnumActionHandlers CORE NO YES YES YES

AVAppEnumAnnotHandlers CORE NO YES YES YES

AVAppEnumDocs CORE NO YES YES YES

AVAppEnumSystemFonts CORE NO YES YES YES

AVAppEnumTools CORE NO YES YES YES

AVAppEnumTransHandlers CORE NO YES YES YES

AVAppFindCommandHandler- CORE NO YES YES YES


ByName
AVAppFindGlobalCommand- CORE NO YES YES YES
ByName
AVAppGetActionHandlerByType CORE NO YES YES YES

AVAppGetActiveDoc CORE NO YES YES YES

AVAppGetActiveTool CORE NO YES YES YES

610 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


AVAppGetAnnotHandlerByName CORE NO YES YES YES

AVAppGetCancelProc CORE NO YES YES YES

AVAppGetDefaultTool CORE NO YES YES YES

AVAppGetDocProgressMonitor CORE NO YES YES YES

AVAppGetHowToPanelAutoShow CORE NO YES YES YES

AVAppGetLanguage CORE NO YES YES YES

AVAppGetLanguageEncoding CORE NO YES YES YES

AVAppGetLanguageWithParams CORE NO YES YES YES

AVAppGetLastActiveTool CORE NO YES YES YES

AVAppGetMenubar CORE NO YES YES YES

AVAppGetName CORE NO YES YES YES

AVAppGetNumDocs CORE NO YES YES YES

AVAppGetPMPageFormat CORE NO YES YES YES

AVAppGetPMPrintSettings CORE NO YES YES YES

AVAppGetPrefAtom CORE NO YES YES YES

AVAppGetPrefBool CORE NO YES YES YES

AVAppGetPrefCab CORE NO YES YES YES

AVAppGetPrefDouble CORE NO YES YES YES

AVAppGetPreference CORE NO YES YES YES

AVAppGetPrefInt CORE NO YES YES YES

AVAppGetPrefPathName CORE NO YES YES YES

AVAppGetPrefString CORE NO YES YES YES

AVAppGetPrefText CORE NO YES YES YES

AVAppGetReportProc CORE NO YES YES YES

AVAppGetToolBar CORE NO YES YES YES

AVAppGetToolBarByName CORE NO YES YES YES

Acrobat and PDF Library API Overview 611


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


AVAppGetToolByName CORE NO YES YES YES

AVAppGetTransHandlerByType CORE NO YES YES YES

AVAppGetUUID CORE NO YES YES YES

AVAppGetVersion CORE NO YES YES YES

AVAppHandleAppleEvent CORE NO YES YES YES

AVAppHandlePlatformEvent CORE NO YES YES YES

AVAppHelpSearch CORE NO YES YES YES

AVAppHelpShowContents CORE NO YES YES YES

AVAppHelpShowIndex CORE NO YES YES YES

AVAppIsIdle CORE NO YES YES YES

AVAppModalWindowIsOpen CORE NO YES YES YES

AVAppOpenDialog CORE NO YES YES YES

AVAppOpenHelpFile CORE NO YES YES YES

AVAppOpenHelpFileWithParams CORE NO YES YES YES

AVAppRegisterActionHandler CORE NO YES YES YES

AVAppRegisterAnnotHandler CORE NO YES YES YES

AVAppRegisterCommandHandler CORE NO YES YES YES

AVAppRegisterForContextMen- CORE NO YES YES YES


uAddition
AVAppRegisterForPageViewAd- CORE NO YES YES YES
justCursor
AVAppRegisterForPageView- CORE NO YES YES YES
Clicks
AVAppRegisterForPageView- CORE NO YES YES YES
Drawing
AVAppRegisterForPageV- CORE NO YES YES YES
iewKeyDown
AVAppRegisterForPageVie- CORE NO YES YES YES
wRightClicks

612 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


AVAppRegisterFromPDFHandler CORE NO YES YES NO

AVAppRegisterGlobalCommand CORE NO YES YES YES

AVAppRegisterHowToPanel CORE NO YES YES YES

AVAppRegisterIdleProc CORE NO YES YES YES

AVAppRegisterLateInitProc CORE NO YES YES YES

AVAppRegisterNotification CORE NO YES YES YES

AVAppRegisterTool CORE NO YES YES YES

AVAppRegisterToolBarPosi- CORE NO YES YES YES


tion
AVAppRegisterToPDFHandler CORE NO YES YES NO

AVAppRegisterTransHandler CORE NO YES YES YES

AVAppSaveDialog CORE NO YES YES YES

AVAppSetActiveTool CORE NO YES YES YES

AVAppSetHowToPanelAutoShow CORE NO YES YES YES

AVAppSetHowToPanelAutoShow- CORE NO YES YES YES


Text
AVAppSetHowToPanelCompute- CORE NO YES YES YES
VisibleProc
AVAppSetPreference CORE NO YES YES YES

AVAppShouldKeyDeleteObject CORE NO YES YES YES

AVAppUnregisterForPageView- CORE NO YES YES YES


AdjustCursor
AVAppUnregisterForPageView- CORE NO YES YES YES
Clicks
AVAppUnregisterForPageView- CORE NO YES YES YES
Drawing
AVAppUnregisterForPageView- CORE NO YES YES YES
DrawingEx

Acrobat and PDF Library API Overview 613


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


AVAppUnregisterForPageV- CORE NO YES YES YES
iewKeyDown
AVAppUnregisterForPageVie- CORE NO YES YES YES
wRightClicks
AVAppUnregisterGlobalCom- CORE NO YES YES YES
mand
AVAppUnregisterIdleProc CORE NO YES YES YES

AVAppUnregisterNotification CORE NO YES YES YES

AVAppYieldToOtherApps CORE NO YES YES YES

AVAuthOpen CORE NO YES YES YES

AVCommandCancel CORE NO YES YES YES

AVCommandDestroy CORE NO YES YES YES

AVCommandExecute CORE NO YES YES YES

AVCommandGetAVDoc CORE NO YES YES YES

AVCommandGetCab CORE NO YES YES YES

AVCommandGetCancelProc CORE NO YES YES YES

AVCommandGetConfig CORE NO YES YES YES

AVCommandGetInputs CORE NO YES YES YES

AVCommandGetName CORE NO YES YES YES

AVCommandGetParams CORE NO YES YES YES

AVCommandGetPDDoc CORE NO YES YES YES

AVCommandGetProgressMonitor CORE NO YES YES YES

AVCommandGetProps CORE NO YES YES YES

AVCommandGetReportProc CORE NO YES YES YES

AVCommandGetStatus CORE NO YES YES YES

AVCommandGetUIPolicy CORE NO YES YES YES

AVCommandNew CORE NO YES YES YES

614 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


AVCommandPutCab CORE NO YES YES YES

AVCommandReset CORE NO YES YES YES

AVCommandSetConfig CORE NO YES YES YES

AVCommandSetInputs CORE NO YES YES YES

AVCommandSetParams CORE NO YES YES YES

AVCommandShowDialog CORE NO YES YES YES

AVCommandWork CORE NO YES YES YES

AVConversionConvertFromPDF- CORE NO YES YES NO


WithHandler
AVConversionConvertStream- CORE NO YES YES NO
FromPDFWithHandler
AVConversionConvertStream- CORE NO YES YES NO
FromStructNodeWithHandler
AVConversionConvertStream- CORE NO YES YES NO
ToPDF
AVConversionConvertStream- CORE NO YES YES NO
ToPDFWithHandler
AVConversionConvertToPDF CORE NO YES YES NO

AVConversionConvertToPDF- CORE NO YES YES NO


WithHandler
AVConversionEnumFromPDFCon- CORE NO YES YES NO
verters
AVConversionEnumToPDFCon- CORE NO YES YES NO
verters
AVCryptDoStdSecurity CORE NO YES YES YES

AVCryptGetPassword CORE NO YES YES YES

AVDestInfoDestroy CORE NO YES YES YES

AVDocAlert CORE NO YES YES YES

AVDocAlertConfirm CORE NO YES YES YES

Acrobat and PDF Library API Overview 615


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


AVDocAlertNote CORE NO YES YES YES

AVDocAlertYesNo CORE NO YES YES YES

AVDocBeginUndoOperation CORE NO YES YES YES

AVDocClearSelection CORE NO YES YES YES

AVDocClearUndos CORE NO YES YES YES

AVDocClose CORE NO YES YES YES

AVDocCopyAction CORE NO YES YES YES

AVDocCopyActionCommon CORE NO YES YES YES

AVDocCopyAdditionalActions CORE NO YES YES YES

AVDocCopyAnnot CORE NO YES YES YES

AVDocCopyAnnotCommon CORE NO YES YES YES

AVDocCopySelection CORE NO YES YES YES

AVDocDeleteSelection CORE NO YES YES YES

AVDocDoActionPropsDialog CORE NO YES YES YES

AVDocDoAnnotProperties CORE NO YES YES YES

AVDocDoCopyAs CORE NO YES YES YES

AVDocDoPrint CORE NO YES YES YES

AVDocDoSave CORE NO YES YES YES

AVDocDoSaveAs CORE NO YES YES YES

AVDocDoSaveAsWithParams CORE NO YES YES YES

AVDocDoSelectionProperties CORE NO YES YES YES

AVDocEndUndoOperation CORE NO YES YES YES

AVDocEnumSelection CORE NO YES YES YES

AVDocFromPDDoc CORE NO YES YES YES

AVDocGetActiveTool CORE NO YES YES YES

AVDocGetAVWindow CORE NO YES YES YES

616 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


AVDocGetBookmarks CORE NO YES YES YES

AVDocGetClientName CORE NO YES YES YES

AVDocGetLastActiveTool CORE NO YES YES YES

AVDocGetNthPageView CORE NO YES YES YES

AVDocGetNthWindow CORE NO YES YES YES

AVDocGetNumPageViews CORE NO YES YES YES

AVDocGetNumWindows CORE NO YES YES YES

AVDocGetPageText CORE NO YES YES YES

AVDocGetPageView CORE NO YES YES YES

AVDocGetPDDoc CORE NO YES YES YES

AVDocGetSelection CORE NO YES YES YES

AVDocGetSelectionServerBy- CORE NO YES YES YES


Type
AVDocGetSelectionType CORE NO YES YES YES

AVDocGetServerType CORE NO YES YES YES

AVDocGetSplitterPosition CORE NO YES YES YES

AVDocGetTopUndo CORE NO YES YES YES

AVDocGetTopUndoAndRedo CORE NO YES YES YES

AVDocGetViewDef CORE NO YES YES YES

AVDocGetViewDefEx CORE NO YES YES YES

AVDocGetViewMode CORE NO YES YES YES

AVDocIsDead CORE NO YES YES YES

AVDocIsExternal CORE NO YES YES YES

AVDocIsReadOnly CORE NO YES YES YES

AVDocIsSlow CORE NO YES YES YES

AVDocOpenFromASFileWith- CORE NO YES YES YES


Params

Acrobat and PDF Library API Overview 617


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


AVDocOpenFromASFileWith- CORE NO YES YES YES
ParamString
AVDocOpenFromFile CORE NO YES YES YES

AVDocOpenFromFileWithParams CORE NO YES YES YES

AVDocOpenFromFileWithParam- CORE NO YES YES YES


String
AVDocOpenFromPDDoc CORE NO YES YES YES

AVDocOpenFromPDDocWith- CORE NO YES YES YES


Params
AVDocOpenFromPDDocWith- CORE NO YES YES YES
ParamString
AVDocPerformAction CORE NO YES YES YES

AVDocPerformActionEx CORE NO YES YES YES

AVDocPermRequest CORE NO YES YES YES

AVDocPrintPages CORE NO YES YES YES

AVDocPrintPagesWithParams CORE NO YES YES YES

AVDocPrintSeparations CORE NO YES NO NO

AVDocRegisterSelection- CORE NO YES YES YES


Server
AVDocSelectionEnumPag- CORE NO YES YES YES
eRanges
AVDocSendAuxData CORE NO YES YES YES

AVDocSetActiveTool CORE NO YES YES YES

AVDocSetClientName CORE NO YES YES YES

AVDocSetDead CORE NO YES YES YES

AVDocSetReadOnly CORE NO YES YES YES

AVDocSetSelection CORE NO YES YES YES

AVDocSetSplitterPosition CORE NO YES YES YES

AVDocSetViewDef CORE NO YES YES YES

618 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


AVDocSetViewDefEx CORE NO YES YES YES

AVDocSetViewMode CORE NO YES YES YES

AVDocShowSelection CORE NO YES YES YES

AVExtensionAcquireInfo CORE NO YES YES YES

AVExtensionGetNumPlugIns CORE NO YES YES YES

AVExtensionMgrRegisterNoti- CORE YES YES YES YES


fication
AVExtensionMgrUnregisterNo- CORE YES YES YES YES
tification
AVExtensionReleaseInfo CORE NO YES YES YES

AVGrafSelectCreate CORE NO YES YES YES

AVGrafSelectDestroy CORE NO YES YES YES

AVGrafSelectGetBoundingRect CORE NO YES YES YES

AVHasAuxDataHandler CORE NO YES YES YES

AVIdentityGetText CORE NO YES YES YES

AVIdentitySetText CORE NO YES YES YES

AVMenuAcquire CORE NO YES YES YES

AVMenuAcquireMenuItemByIn- CORE NO YES YES YES


dex
AVMenuAddMenuItem CORE NO YES YES YES

AVMenubarAcquireMenuByIndex CORE NO YES YES YES

AVMenubarAcquireMenuByName CORE NO YES YES YES

AVMenubarAcquireMenuByPred- CORE NO YES YES YES


icate
AVMenubarAcquireMenuItem- CORE NO YES YES YES
ByName
AVMenubarAcquireMenuItem- CORE NO YES YES YES
ByPredicate
AVMenubarAddHiddenMenu CORE NO YES YES YES

Acrobat and PDF Library API Overview 619


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


AVMenubarAddMenu CORE NO YES YES YES

AVMenubarGetMenuIndex CORE NO YES YES YES

AVMenubarGetNumMenus CORE NO YES YES YES

AVMenubarHide CORE NO YES YES YES

AVMenubarShow CORE NO YES YES YES

AVMenuClone CORE NO YES YES YES

AVMenuDoPopUp CORE NO YES YES YES

AVMenuGetMenuItemIndex CORE NO YES YES YES

AVMenuGetName CORE NO YES YES YES

AVMenuGetNumMenuItems CORE NO YES YES YES

AVMenuGetParentMenubar CORE NO YES YES YES

AVMenuGetParentMenuItem CORE NO YES YES YES

AVMenuGetTitle CORE NO YES YES YES

AVMenuGetTitleAsASText CORE NO YES YES YES

AVMenuIsHiddenOnMenubar CORE NO YES YES YES

AVMenuItemAcquire CORE NO YES YES YES

AVMenuItemAcquireSubmenu CORE NO YES YES YES

AVMenuItemClone CORE NO YES YES YES

AVMenuItemExecute CORE NO YES YES YES

AVMenuItemGetLongOnly CORE NO YES YES YES

AVMenuItemGetName CORE NO YES YES YES

AVMenuItemGetParentMenu CORE NO YES YES YES

AVMenuItemGetShortcut CORE NO YES YES YES

AVMenuItemGetTitle CORE NO YES YES YES

AVMenuItemGetTitleAsASText CORE NO YES YES YES

AVMenuItemIsEnabled CORE NO YES YES YES

620 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


AVMenuItemIsMarked CORE NO YES YES YES

AVMenuItemIsVisible CORE NO YES YES YES

AVMenuItemNew CORE NO YES YES YES

AVMenuItemNewWithASText CORE NO YES YES YES

AVMenuItemRelease CORE NO YES YES YES

AVMenuItemRemove CORE NO YES YES YES

AVMenuItemSetComputeEn- CORE NO YES YES YES


abledProc
AVMenuItemSetComputeMarked- CORE NO YES YES YES
Proc
AVMenuItemSetComputeVisi- CORE NO YES YES YES
bleProc
AVMenuItemSetExecuteProc CORE NO YES YES YES

AVMenuItemSetTitle CORE NO YES YES YES

AVMenuItemSetTitleWithAS- CORE NO YES YES YES


Text
AVMenuNew CORE NO YES YES YES

AVMenuNewWithASText CORE NO YES YES YES

AVMenuRelease CORE NO YES YES YES

AVMenuRemove CORE NO YES YES YES

AVPageViewAcquireMachineP- CORE NO YES YES YES


ort
AVPageViewAppearanceGetAV- CORE NO YES YES YES
Matrix
AVPageViewBeginOperation CORE NO YES YES YES

AVPageViewClearFocusAnnot CORE NO YES YES YES

AVPageViewDevicePointToPage CORE NO YES YES YES

AVPageViewDeviceRectToPage CORE NO YES YES YES

Acrobat and PDF Library API Overview 621


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


AVPageViewDeviceRect- CORE NO YES YES YES
ToPageRZ
AVPageViewDeviceToInfo CORE NO YES YES YES

AVPageViewDoPopupMenu CORE NO YES YES YES

AVPageViewDragOutNewRect CORE NO YES YES YES

AVPageViewDragOutNewRect- CORE NO YES YES YES


Snapped
AVPageViewDragRect CORE NO YES YES YES

AVPageViewDragRectSnapped CORE NO YES YES YES

AVPageViewDragRectSnappedEx CORE NO YES YES YES

AVPageViewDrawAnnotSequence CORE NO YES YES YES

AVPageViewDrawCosObj CORE NO YES YES YES

AVPageViewDrawCosObjEx CORE NO YES YES YES

AVPageViewDrawNow CORE NO YES YES YES

AVPageViewDrawNowWithTran- CORE NO YES YES YES


sition
AVPageViewDrawPolygon CORE NO YES YES YES

AVPageViewDrawPolygonOut- CORE NO YES YES YES


line
AVPageViewDrawRect CORE NO YES YES YES

AVPageViewDrawRectOutline CORE NO YES YES YES

AVPageViewDrawRectOutline- CORE NO YES YES YES


WithHandles
AVPageViewEndOperation CORE NO YES YES YES

AVPageViewFilterKeyDownFor- CORE NO YES YES YES


FocusAnnot
AVPageViewFocusAnnotPerfor- CORE NO YES YES YES
mOp
AVPageViewGetActiveBead CORE NO YES YES YES

622 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


AVPageViewGetAnnotRect CORE NO YES YES YES

AVPageViewGetAperture CORE NO YES YES YES

AVPageViewGetAVDoc CORE NO YES YES YES

AVPageViewGetAVWindow CORE NO YES YES YES

AVPageViewGetColor CORE NO YES YES YES

AVPageViewGetDevToPageMa- CORE NO YES YES YES


trix
AVPageViewGetFirstVisibleP- CORE NO YES YES YES
ageNum
AVPageViewGetFocusAnnot CORE NO YES YES YES

AVPageViewGetGrayRect CORE NO YES YES YES

AVPageViewGetLastVisibleP- CORE NO YES YES YES


ageNum
AVPageViewGetLayoutMode CORE NO YES YES YES

AVPageViewGetMousePosition CORE NO YES YES YES

AVPageViewGetMousePosition- CORE NO YES YES YES


Snapped
AVPageViewGetNextView CORE NO YES YES YES

AVPageViewGetNumVisibleInks CORE NO YES NO NO

AVPageViewGetPage CORE NO YES YES YES

AVPageViewGetPageNum CORE NO YES YES YES

AVPageViewGetPageToDevMa- CORE NO YES YES YES


trix
AVPageViewGetPageToDevScal- CORE NO YES YES YES
ing
AVPageViewGetPixelInforma- CORE NO YES NO NO
tionAtPoint
AVPageViewGetSelectedAn- CORE NO YES YES YES
notPageNum

Acrobat and PDF Library API Overview 623


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


AVPageViewGetThreadIndex CORE NO YES YES YES

AVPageViewGetVisibleAn- CORE NO YES YES YES


notPage
AVPageViewGetVisibleInks CORE NO YES NO NO

AVPageViewGetWireframeDraw- CORE NO YES YES YES


ing
AVPageViewGetZoom CORE NO YES YES YES

AVPageViewGetZoomType CORE NO YES YES YES

AVPageViewGhostRectOutline CORE NO YES YES YES

AVPageViewGoBack CORE NO YES YES YES

AVPageViewGoForward CORE NO YES YES YES

AVPageViewGoTo CORE NO YES YES YES

AVPageViewHighlightText CORE NO YES YES YES

AVPageViewInfoToDevice CORE NO YES YES YES

AVPageViewInfoToPoint CORE NO YES YES YES

AVPageViewInsetRect CORE NO YES YES YES

AVPageViewInvalidateRect CORE NO YES YES YES

AVPageViewInvalidateText CORE NO YES YES YES

AVPageViewInvertQuad CORE NO YES YES YES

AVPageViewInvertRect CORE NO YES YES YES

AVPageViewInvertRectOutline CORE NO YES YES YES

AVPageViewIsAnnotAtPoint CORE NO YES YES YES

AVPageViewIsAnnotOfTypeAt- CORE NO YES YES YES


Point
AVPageViewIsBeadAtPoint CORE NO YES YES YES

AVPageViewIsFocusAnnot CORE NO YES YES YES

AVPageViewPageNumIsVisible CORE NO YES YES YES

624 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


AVPageViewPointInText CORE NO YES YES YES

AVPageViewPointToDevice CORE NO YES YES YES

AVPageViewPointToInfo CORE NO YES YES YES

AVPageViewReadPageDown CORE NO YES YES YES

AVPageViewReadPageUp CORE NO YES YES YES

AVPageViewRectToDevice CORE NO YES YES YES

AVPageViewReleaseMachineP- CORE NO YES YES YES


ort
AVPageViewResumeOffscreen- CORE NO YES YES YES
Drawing
AVPageViewScrollTo CORE NO YES YES YES

AVPageViewScrollToAnnot CORE NO YES YES YES

AVPageViewScrollToRect CORE NO YES YES YES

AVPageViewSetAnnotLocation CORE NO YES YES YES

AVPageViewSetColor CORE NO YES YES YES

AVPageViewSetFocusAnnot CORE NO YES YES YES

AVPageViewSetInkPreview CORE NO YES NO NO

AVPageViewSetLayoutMode CORE NO YES YES YES

AVPageViewSetPageNum CORE NO YES YES YES

AVPageViewSetVisibleInks CORE NO YES NO NO

AVPageViewSetWireframeDraw- CORE NO YES YES YES


ing
AVPageViewShowControl CORE NO YES YES YES

AVPageViewSnapPoint CORE NO YES YES YES

AVPageViewSnapPointEx CORE NO YES YES YES

AVPageViewSnapRect CORE NO YES YES YES

AVPageViewStartReadingTh- CORE NO YES YES YES


read

Acrobat and PDF Library API Overview 625


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


AVPageViewSuspendOffscreen- CORE NO YES YES YES
Drawing
AVPageViewToDestInfo CORE NO YES YES YES

AVPageViewToViewDest CORE NO YES YES YES

AVPageViewTrackText CORE NO YES YES YES

AVPageViewTransformRectRZ CORE NO YES YES YES

AVPageViewUpdateInfoPanel CORE NO YES YES YES

AVPageViewUseDestInfo CORE NO YES YES YES

AVPageViewUseThisDestina- CORE NO YES YES YES


tion
AVPageViewZoomTo CORE NO YES YES YES

AVRectHandleHitTest CORE NO YES YES YES

AVRectToRect CORE NO YES YES YES

AVRegisterAuxDataHandler CORE NO YES YES YES

AVStartDrag CORE NO YES YES YES

AVSweetPeaGetBasicSuiteP CORE NO YES YES YES

AVSweetPeaGetPluginRef CORE NO YES YES YES

AVSweetPeaGetResourceAccess CORE NO YES YES YES

AVSweetPeaIsADMAvailable CORE NO YES YES YES

AVSweetPeaProcessADMEvent CORE NO YES YES YES

AVSweetPeaSetResourceAccess CORE NO YES YES YES

AVSysAllocTimeStringFrom- CORE NO YES YES YES


TimeRec
AVSysBeep CORE NO YES YES YES

AVSysGetCursor CORE NO YES YES YES

AVSysGetIconFromFilename CORE NO YES YES YES

AVSysGetIconFromMimeType CORE NO YES YES YES

626 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


AVSysGetIconFromTypeAndCre- CORE NO YES YES YES
ator
AVSysGetModifiers CORE NO YES YES YES

AVSysGetStandardCursor CORE NO YES YES YES

AVSysGetUsePenForInput CORE NO YES YES YES

AVSysMouseIsStillDown CORE NO YES YES YES

AVSysSetCursor CORE NO YES YES YES

AVSysSetWaitCursor CORE NO YES YES YES

AVToolBarAddButton CORE NO YES YES YES

AVToolBarEnumButtons CORE NO YES YES YES

AVToolBarGetButtonByName CORE NO YES YES YES

AVToolBarGetNumButtons CORE NO YES YES YES

AVToolBarIsRoomFor CORE NO YES YES YES

AVToolBarNew CORE NO YES YES YES

AVToolBarNewFlyout CORE NO YES YES YES

AVToolBarUpdateButtonStates CORE NO YES YES YES

AVToolButtonAddAnimationI- CORE NO YES YES YES


con
AVToolButtonDestroy CORE NO YES YES YES

AVToolButtonExecute CORE NO YES YES YES

AVToolButtonGetAnimationI- CORE NO YES YES YES


conCount
AVToolButtonGetAnimationPe- CORE NO YES YES YES
riod
AVToolButtonGetFlyout CORE NO YES YES YES

AVToolButtonGetIcon CORE NO YES YES YES

AVToolButtonGetLabelText CORE NO YES YES YES

AVToolButtonGetMenu CORE NO YES YES YES

Acrobat and PDF Library API Overview 627


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


AVToolButtonGetName CORE NO YES YES YES

AVToolButtonIsAnimationRun- CORE NO YES YES YES


ning
AVToolButtonIsEnabled CORE NO YES YES YES

AVToolButtonIsMarked CORE NO YES YES YES

AVToolButtonIsSeparator CORE NO YES YES YES

AVToolButtonIsVisible CORE NO YES YES YES

AVToolButtonNew CORE NO YES YES YES

AVToolButtonRemove CORE NO YES YES YES

AVToolButtonRemoveAnima- CORE NO YES YES YES


tionIcons
AVToolButtonSetAnimationPe- CORE NO YES YES YES
riod
AVToolButtonSetComputeEn- CORE NO YES YES YES
abledProc
AVToolButtonSetComp- CORE NO YES YES YES
uteMarkedProc
AVToolButtonSetComputeTool- CORE NO YES YES YES
tipProc
AVToolButtonSetComputeVisi- CORE NO YES YES YES
bleProc
AVToolButtonSetExecuteProc CORE NO YES YES YES

AVToolButtonSetExternal CORE NO YES YES YES

AVToolButtonSetFlyout CORE NO YES YES YES

AVToolButtonSetHelpText CORE NO YES YES YES

AVToolButtonSetIcon CORE NO YES YES YES

AVToolButtonSetLabelText CORE NO YES YES YES

AVToolButtonSetMenu CORE NO YES YES YES

628 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


AVToolButtonSetNotifyToolt- CORE NO YES YES YES
ipProc
AVToolButtonStartAnimation CORE NO YES YES YES

AVToolButtonStopAnimation CORE NO YES YES YES

AVToolGetType CORE NO YES YES YES

AVToolIsPersistent CORE NO YES YES YES

AVUndoGetAVDoc CORE NO YES YES YES

AVUndoGetData CORE NO YES YES YES

AVUndoGetType CORE NO YES YES YES

AVUndoNew CORE NO YES YES YES

AVUndoSetData CORE NO YES YES YES

AVUnregisterAuxDataHandler CORE NO YES YES YES

AVUtilGetBaseNameAndExten- CORE NO YES YES YES


sionByPathName
AVUtilGetBaseNameAndExten- CORE NO YES YES YES
sionByString
AVUtilGetBaseNameAndExten- CORE NO YES YES YES
sionEx
AVWindowBecomeKey CORE NO YES YES YES

AVWindowBringToFront CORE NO YES YES YES

AVWindowCenter CORE NO YES YES YES

AVWindowDestroy CORE NO YES YES YES

AVWindowDoModal CORE NO YES YES YES

AVWindowDrawNow CORE NO YES YES YES

AVWindowEndModal CORE NO YES YES YES

AVWindowEnsureInBounds CORE NO YES YES YES

AVWindowGetBorderWidths CORE NO YES YES YES

AVWindowGetCursorAtPoint CORE NO YES YES YES

Acrobat and PDF Library API Overview 629


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


AVWindowGetDesktopBounds CORE NO YES YES YES

AVWindowGetFrame CORE NO YES YES YES

AVWindowGetInterior CORE NO YES YES YES

AVWindowGetMinMaxSize CORE NO YES YES YES

AVWindowGetOwnerData CORE NO YES YES YES

AVWindowGetPlatformThing CORE NO YES YES YES

AVWindowGetTitle CORE NO YES YES YES

AVWindowHandlePlatformEvent CORE NO YES YES YES

AVWindowHide CORE NO YES YES YES

AVWindowInvalidateRect CORE NO YES YES YES

AVWindowIsKey CORE NO YES YES YES

AVWindowIsVisible CORE NO YES YES YES

AVWindowMaximize CORE NO YES YES YES

AVWindowNew CORE NO YES YES YES

AVWindowNewFromPlatformTh- CORE NO YES YES YES


ing
AVWindowResignKey CORE NO YES YES YES

AVWindowSetFrame CORE NO YES YES YES

AVWindowSetMinMaxSize CORE NO YES YES YES

AVWindowSetOwnerData CORE NO YES YES YES

AVWindowSetTitle CORE NO YES YES YES

AVWindowSetWantsKey CORE NO YES YES YES

AVWindowShow CORE NO YES YES YES

AVWindowUserClose CORE NO YES YES YES

CosArrayGet CORE YES YES YES YES

CosArrayInsert CORE YES YES YES YES

CosArrayIsWeakReference CORE YES YES YES YES

630 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


CosArrayLength CORE YES YES YES YES

CosArrayPut CORE YES YES YES YES

CosArrayRemove CORE YES YES YES YES

CosArrayRemoveNth CORE YES YES YES YES

CosArraySetWeakReference CORE YES YES YES YES

CosBooleanValue CORE YES YES YES YES

CosCopyNameStringValue CORE YES YES YES YES

CosCopyStringValue CORE YES YES YES YES

CosCryptGetVersion CORE YES YES YES YES

CosDecryptData CORE YES YES YES YES

CosDecryptGetMaxKeyBytes CORE YES YES YES YES

CosDictGet CORE YES YES YES YES

CosDictGetKey CORE YES YES YES YES

CosDictGetKeyString CORE YES YES YES YES

CosDictGetXAPMetadata CORE YES YES YES NO

CosDictIsWeakReference CORE YES YES YES YES

CosDictKnown CORE YES YES YES YES

CosDictKnownKey CORE YES YES YES YES

CosDictKnownKeyString CORE YES YES YES YES

CosDictPut CORE YES YES YES YES

CosDictPutKey CORE YES YES YES YES

CosDictPutKeyString CORE YES YES YES YES

CosDictRemove CORE YES YES YES YES

CosDictRemoveKey CORE YES YES YES YES

CosDictRemoveKeyString CORE YES YES YES YES

CosDictSetWeakReference CORE YES YES YES YES

Acrobat and PDF Library API Overview 631


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


CosDictSetXAPMetadata CORE YES YES YES NO

CosDocClose CORE YES YES YES YES

CosDocCreate CORE YES YES YES YES

CosDocEnumEOFs CORE YES YES YES YES

CosDocEnumEOFs64 CORE YES YES YES YES

CosDocEnumIndirect CORE YES YES YES YES

CosDocGetID CORE YES YES YES YES

CosDocGetInfoDict CORE YES YES YES YES

CosDocGetObjByID CORE YES YES YES YES

CosDocGetRoot CORE YES YES YES YES

CosDocHasFullCompression CORE NO YES YES YES

CosDocHasPartialCompression CORE NO YES YES YES

CosDocObjIsWithinRange CORE YES YES YES YES

CosDocObjIsWithinRange64 CORE YES YES YES YES

CosDocOpenWithParams CORE YES YES YES YES

CosDocSaveToFile CORE YES YES YES YES

CosDocSaveWithParams CORE YES YES YES YES

CosDocSetDirty CORE YES YES YES YES

CosEncryptData CORE YES YES YES YES

CosEncryptGetMaxKeyBytes CORE YES YES YES YES

CosFixedValue CORE YES YES YES YES

CosFloatValue CORE YES YES YES YES

CosInteger64Value CORE YES YES YES YES

CosIntegerValue CORE YES YES YES YES

CosNameValue CORE YES YES YES YES

CosNewArray CORE YES YES YES YES

632 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


CosNewBoolean CORE YES YES YES YES

CosNewDict CORE YES YES YES YES

CosNewFixed CORE YES YES YES YES

CosNewFloat CORE YES YES YES YES

CosNewInteger CORE YES YES YES YES

CosNewInteger64 CORE YES YES YES YES

CosNewName CORE YES YES YES YES

CosNewNameFromString CORE YES YES YES YES

CosNewNull CORE YES YES YES YES

CosNewObjCollection CORE YES YES YES YES

CosNewStream CORE YES YES YES YES

CosNewStream64 CORE YES YES YES YES

CosNewString CORE YES YES YES YES

CosNumberIsWithinASFixe- CORE YES YES YES YES


dRange
CosNumberIsWithinASInt32Ran CORE YES YES YES YES
ge
CosObjAcquire CORE YES YES YES YES

CosObjAddToCollection CORE YES YES YES YES

CosObjCmp CORE YES YES YES YES

CosObjCollectionEnum CORE YES YES YES YES

CosObjCollectionEqual CORE YES YES YES YES

CosObjCollectionIsNull CORE YES YES YES YES

CosObjCollectionSize CORE YES YES YES YES

CosObjCopy CORE YES YES YES YES

CosObjDestroy CORE YES YES YES YES

CosObjEnum CORE YES YES YES YES

Acrobat and PDF Library API Overview 633


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


CosObjEqual CORE YES YES YES YES

CosObjGetCollection CORE YES YES YES YES

CosObjGetCompressibility CORE YES YES YES YES

CosObjGetDoc CORE YES YES YES YES

CosObjGetGeneration CORE YES YES YES YES

CosObjGetID CORE YES YES YES YES

CosObjGetType CORE YES YES YES YES

CosObjHash CORE YES YES YES YES

CosObjIsCompressed CORE YES YES YES YES

CosObjIsIndirect CORE YES YES YES YES

CosObjRefreshAfterLinear- CORE NO YES YES YES


izedSave
CosObjRelease CORE YES YES YES YES

CosObjRemoveFromCollection CORE YES YES YES YES

CosObjSetCompressibility CORE YES YES YES YES

CosSetMaxDocStorage CORE YES YES YES YES

CosStreamDict CORE YES YES YES YES

CosStreamLength CORE YES YES YES YES

CosStreamLength64 CORE YES YES YES YES

CosStreamOpenStm CORE YES YES YES YES

CosStreamPos CORE YES YES YES YES

CosStreamPos64 CORE YES YES YES YES

CosStringGetHexFlag CORE YES YES YES YES

CosStringSetHexFlag CORE YES YES YES YES

CosStringValue CORE YES YES YES YES

CosStringValueSafe CORE YES YES YES YES

FloatToASFixed CORE YES YES YES YES

634 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


HFTDestroy CORE YES YES YES YES

HFTGetReplacedEntry CORE YES YES YES YES

HFTGetVersion CORE YES YES YES YES

HFTIsValid CORE YES YES YES YES

HFTNew CORE YES YES YES YES

HFTNewEx CORE YES YES YES YES

HFTReplaceEntry CORE YES YES YES YES

HFTReplaceEntryEx CORE YES YES YES YES

HFTServerDestroy CORE YES YES YES YES

HFTServerNew CORE YES YES YES YES

HFTUnreplaceEntry CORE YES YES YES YES

JPXColorSpaceAcquireNext CORE YES YES YES NO

JPXColorSpaceGetEnumAttrs CORE YES YES YES NO

JPXColorSpaceGetProfile CORE YES YES YES NO

JPXColorSpaceGetType CORE YES YES YES NO

JPXPaletteGetBitDepths CORE YES YES YES NO

JPXPaletteGetNumComponents CORE YES YES YES NO

JPXPaletteGetNumEntries CORE YES YES YES NO

JPXPaletteGetTable CORE YES YES YES NO

PDActionCanCopy CORE YES YES YES NO

PDActionCanPaste CORE YES YES YES NO

PDActionCopy CORE YES YES YES NO

PDActionDestroy CORE YES YES YES YES

PDActionDestroyClipboard- CORE YES YES YES NO


Data
PDActionEqual CORE YES YES YES YES

PDActionFromCosObj CORE YES YES YES YES

Acrobat and PDF Library API Overview 635


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


PDActionGetCosObj CORE YES YES YES YES

PDActionGetDest CORE YES YES YES YES

PDActionGetFileSpec CORE YES YES YES YES

PDActionGetSubtype CORE YES YES YES YES

PDActionIsValid CORE YES YES YES YES

PDActionNew CORE YES YES YES YES

PDActionNewFromDest CORE YES YES YES YES

PDActionNewFromFileSpec CORE YES YES YES YES

PDActionPaste CORE YES YES YES NO

PDAnnotCanCopy CORE YES YES YES NO

PDAnnotCanPaste CORE YES YES YES NO

PDAnnotCopy CORE YES YES YES NO

PDAnnotDestroyClipboardData CORE YES YES YES NO

PDAnnotEqual CORE YES YES YES YES

PDAnnotFromCosObj CORE YES YES YES YES

PDAnnotGetColor CORE YES YES YES YES

PDAnnotGetCosObj CORE YES YES YES YES

PDAnnotGetDate CORE YES YES YES YES

PDAnnotGetFlags CORE YES YES YES YES

PDAnnotGetOCMD CORE YES YES YES YES

PDAnnotGetRect CORE YES YES YES YES

PDAnnotGetSubtype CORE YES YES YES YES

PDAnnotGetTitle CORE YES YES YES YES

PDAnnotIsCurrentlyVisible CORE YES YES YES YES

PDAnnotIsValid CORE YES YES YES YES

PDAnnotNotifyDidChange CORE YES YES YES YES

636 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


PDAnnotNotifyWillChange CORE YES YES YES YES

PDAnnotPaste CORE YES YES YES NO

PDAnnotRemoveOCMD CORE YES YES YES YES

PDAnnotSetColor CORE YES YES YES YES

PDAnnotSetDate CORE YES YES YES YES

PDAnnotSetFlags CORE YES YES YES YES

PDAnnotSetOCMD CORE YES YES YES YES

PDAnnotSetRect CORE YES YES YES YES

PDAnnotSetTitle CORE YES YES YES YES

PDApplyFunction CORE YES YES YES YES

PDBeadAcquirePage CORE YES YES YES YES

PDBeadDestroy CORE YES YES YES NO

PDBeadEqual CORE YES YES YES YES

PDBeadFromCosObj CORE YES YES YES YES

PDBeadGetCosObj CORE YES YES YES YES

PDBeadGetIndex CORE YES YES YES YES

PDBeadGetNext CORE YES YES YES YES

PDBeadGetPrev CORE YES YES YES YES

PDBeadGetRect CORE YES YES YES YES

PDBeadGetThread CORE YES YES YES YES

PDBeadInsert CORE YES YES YES NO

PDBeadIsValid CORE YES YES YES YES

PDBeadNew CORE YES YES YES NO

PDBeadSetPage CORE YES YES YES NO

PDBeadSetRect CORE YES YES YES NO

PDBookmarkAddChild CORE YES YES YES YES

Acrobat and PDF Library API Overview 637


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


PDBookmarkAddNewChild CORE YES YES YES YES

PDBookmarkAddNewSibling CORE YES YES YES YES

PDBookmarkAddNext CORE YES YES YES YES

PDBookmarkAddPrev CORE YES YES YES YES

PDBookmarkAddSubtree CORE YES YES YES YES

PDBookmarkDestroy CORE YES YES YES YES

PDBookmarkEqual CORE YES YES YES YES

PDBookmarkFromCosObj CORE YES YES YES YES

PDBookmarkGetAction CORE YES YES YES YES

PDBookmarkGetByTitle CORE YES YES YES YES

PDBookmarkGetColor CORE YES YES YES YES

PDBookmarkGetCosObj CORE YES YES YES YES

PDBookmarkGetCount CORE YES YES YES YES

PDBookmarkGetFirstChild CORE YES YES YES YES

PDBookmarkGetFlags CORE YES YES YES YES

PDBookmarkGetIndent CORE YES YES YES YES

PDBookmarkGetLastChild CORE YES YES YES YES

PDBookmarkGetNext CORE YES YES YES YES

PDBookmarkGetParent CORE YES YES YES YES

PDBookmarkGetPrev CORE YES YES YES YES

PDBookmarkGetTitle CORE YES YES YES YES

PDBookmarkHasChildren CORE YES YES YES YES

PDBookmarkIsOpen CORE YES YES YES YES

PDBookmarkIsValid CORE YES YES YES YES

PDBookmarkRemoveAction CORE YES YES YES NO

PDBookmarkSetAction CORE YES YES YES YES

638 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


PDBookmarkSetColor CORE YES YES YES NO

PDBookmarkSetFlags CORE YES YES YES NO

PDBookmarkSetOpen CORE YES YES YES YES

PDBookmarkSetTitle CORE YES YES YES YES

PDBookmarkUnlink CORE YES YES YES YES

PDCharProcEnum CORE YES YES YES YES

PDCharProcEnumWithParams CORE YES YES YES YES

PDCharProcGetCosObj CORE YES YES YES YES

PDCryptAuthorizeFilterAc- CORE YES YES YES YES


cess
PDDocAcquire CORE YES YES YES YES

PDDocAcquirePage CORE YES YES YES YES

PDDocAddThread CORE YES YES YES NO

PDDocAddWatermarkFromPDPage CORE YES YES YES YES

PDDocAddWatermarkFromText CORE YES YES YES YES

PDDocAuthorize CORE YES YES YES YES

PDDocCalculateImplicitMeta- CORE YES YES YES NO


data
PDDocClearFlags CORE YES YES YES YES

PDDocClose CORE YES YES YES YES

PDDocCopyToFile CORE YES YES YES YES

PDDocCreate CORE YES YES YES YES

PDDocCreateNameTree CORE YES YES YES NO

PDDocCreatePage CORE YES YES YES NO

PDDocCreateStructTreeRoot CORE YES YES YES YES

PDDocCreateTextSelect CORE YES YES YES YES

PDDocCreateTextSelectHost CORE YES YES YES YES

Acrobat and PDF Library API Overview 639


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


PDDocCreateThumbs CORE YES YES YES NO

PDDocCreateWordFinder CORE YES YES YES YES

PDDocCreateWordFinderEx CORE YES YES YES YES

PDDocCreateWordFinderUCS CORE YES YES YES YES

PDDocDeletePages CORE YES YES YES NO

PDDocDeleteThumbs CORE YES YES YES NO

PDDocEnumFonts CORE YES YES YES YES

PDDocEnumLoadedFonts CORE YES YES YES YES

PDDocEnumOCConfigs CORE YES YES YES YES

PDDocEnumOCGs CORE YES YES YES YES

PDDocEnumPDSElementsWith- CORE YES YES YES YES


UserProperties
PDDocEnumResources CORE YES YES YES YES

PDDocExportNotes CORE YES YES YES NO

PDDocExportSomeNotes CORE YES YES YES NO

PDDocFindPageNumForLabel CORE YES YES YES YES

PDDocFindPageNumForLabelEx CORE NO YES YES YES

PDDocFlattenOC CORE YES YES YES YES

PDDocFromCosDoc CORE YES YES YES YES

PDDocGetBookmarkRoot CORE YES YES YES YES

PDDocGetCosDoc CORE YES YES YES YES

PDDocGetCryptHandler CORE YES YES YES YES

PDDocGetCryptHandlerClient- CORE YES YES YES YES


Data
PDDocGetFile CORE YES YES YES YES

PDDocGetFlags CORE YES YES YES YES

PDDocGetFullScreen CORE YES YES YES YES

640 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


PDDocGetID CORE YES YES YES YES

PDDocGetInfo CORE YES YES YES YES

PDDocGetLabelForPageNum CORE YES YES YES YES

PDDocGetLabelForPageNumEx CORE NO YES YES YES

PDDocGetLayoutMode CORE YES YES YES YES

PDDocGetMergedXAPKeywords CORE YES YES YES YES

PDDocGetNameTree CORE YES YES YES YES

PDDocGetNewCryptHandler CORE YES YES YES YES

PDDocGetNewSecurityData CORE YES YES YES YES

PDDocGetNewSecurityInfo CORE YES YES YES YES

PDDocGetNumOCGs CORE YES YES YES YES

PDDocGetNumPages CORE YES YES YES YES

PDDocGetNumThreads CORE YES YES YES YES

PDDocGetOCConfig CORE YES YES YES YES

PDDocGetOCContext CORE YES YES YES YES

PDDocGetOCGs CORE YES YES YES YES

PDDocGetOpenAction CORE YES YES YES YES

PDDocGetPageLabel CORE YES YES YES YES

PDDocGetPageMode CORE YES YES YES YES

PDDocGetPageObjByNum CORE YES YES YES YES

PDDocGetPermissions CORE YES YES YES YES

PDDocGetSecurityData CORE YES YES YES YES

PDDocGetStructTreeRoot CORE YES YES YES YES

PDDocGetThread CORE YES YES YES YES

PDDocGetThreadIndex CORE YES YES YES YES

PDDocGetTrapped CORE YES YES YES YES

Acrobat and PDF Library API Overview 641


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


PDDocGetVersion CORE YES YES YES YES

PDDocGetWordFinder CORE YES YES YES YES

PDDocGetWordFinderHost CORE YES YES YES YES

PDDocGetXAPMetadata CORE YES YES YES NO

PDDocGetXAPMetadataProperty CORE YES YES YES NO

PDDocHasOC CORE YES YES YES YES

PDDocHasUserProperties CORE YES YES YES YES

PDDocImportCosDocNotes CORE YES YES YES NO

PDDocImportNotes CORE YES YES YES NO

PDDocInsertPages CORE YES YES YES NO

PDDocMergeXAPKeywords CORE YES YES YES YES

PDDocMovePage CORE YES YES YES NO

PDDocNewSecurityData CORE YES YES YES YES

PDDocOpen CORE YES YES YES YES

PDDocOpenEx CORE YES YES YES YES

PDDocOpenFromASFile CORE YES YES YES YES

PDDocOpenFromASFileEx CORE YES YES YES YES

PDDocOpenWithParams CORE YES YES YES YES

PDDocPermRequest CORE YES YES YES YES

PDDocPermRequestNoUB CORE YES YES YES YES

PDDocReadAhead CORE YES YES YES YES

PDDocReadAheadEmbeddedFile CORE YES YES YES YES

PDDocReadAheadPages CORE YES YES YES YES

PDDocRelease CORE YES YES YES YES

PDDocRemoveNameTree CORE YES YES YES NO

PDDocRemoveOpenAction CORE YES YES YES NO

642 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


PDDocRemovePageLabel CORE YES YES YES NO

PDDocRemoveStructTreeRoot CORE YES YES YES YES

PDDocRemoveThread CORE YES YES YES NO

PDDocReplaceOCG CORE YES YES YES YES

PDDocReplacePages CORE YES YES YES NO

PDDocRequestEntireFile CORE YES YES YES YES

PDDocRequestPages CORE YES YES YES YES

PDDocSave CORE YES YES YES NO

PDDocSaveWithParams CORE YES YES YES NO

PDDocSetFlags CORE YES YES YES YES

PDDocSetFullScreen CORE YES YES YES NO

PDDocSetInfo CORE YES YES YES NO

PDDocSetLayoutMode CORE YES YES YES YES

PDDocSetNewCryptFilterData CORE YES YES YES YES

PDDocSetNewCryptFilter- CORE YES YES YES YES


Method
PDDocSetNewCryptHandler CORE YES YES YES NO

PDDocSetNewCryptHandlerEx CORE YES YES YES NO

PDDocSetNewDefaultFilters CORE YES YES YES YES

PDDocSetNewSecurityData CORE YES YES YES NO

PDDocSetOpenAction CORE YES YES YES YES

PDDocSetPageLabel CORE YES YES YES NO

PDDocSetPageMode CORE YES YES YES NO

PDDocSetTrapped CORE YES YES YES NO

PDDocSetXAPMetadata CORE YES YES YES NO

PDDocSetXAPMetadataProperty CORE YES YES YES NO

PDDrawCosObjToWindow CORE YES YES YES YES

Acrobat and PDF Library API Overview 643


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


PDDrawCosObjWithParams CORE YES YES YES YES

PDEAcquire CORE YES YES YES NO

PDEAddTag CORE YES YES YES NO

PDEAttrEnumTable CORE YES YES YES NO

PDEBeginContainerCreate CORE YES YES YES NO

PDEBeginContainerGetDict CORE YES YES YES NO

PDEBeginContainerGetMCTag CORE YES YES YES NO

PDEBeginContainerSetDict CORE YES YES YES NO

PDEBeginContainerSetMCTag CORE YES YES YES NO

PDEBeginGroupCreate CORE YES YES YES NO

PDEClipAddElem CORE YES YES YES NO

PDEClipCopy CORE YES YES YES NO

PDEClipCreate CORE YES YES YES NO

PDEClipFlattenedEnumElems CORE YES YES YES NO

PDEClipGetElem CORE YES YES YES NO

PDEClipGetNumElems CORE YES YES YES NO

PDEClipRemoveElems CORE YES YES YES NO

PDEColorSpaceCreate CORE YES YES YES NO

PDEColorSpaceCreateFrom- CORE YES YES YES NO


CosObj
PDEColorSpaceCreateFromName CORE YES YES YES NO

PDEColorSpaceGetBase CORE YES YES YES NO

PDEColorSpaceGetBaseNum- CORE YES YES YES NO


Comps
PDEColorSpaceGetCosObj CORE YES YES YES NO

PDEColorSpaceGetCTable CORE YES YES YES NO

PDEColorSpaceGetHiVal CORE YES YES YES NO

644 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


PDEColorSpaceGetName CORE YES YES YES NO

PDEColorSpaceGetNumComps CORE YES YES YES NO

PDEContainerCreate CORE YES YES YES NO

PDEContainerGetContent CORE YES YES YES NO

PDEContainerGetDict CORE YES YES YES NO

PDEContainerGetMCTag CORE YES YES YES NO

PDEContainerGetXAPMetadata CORE YES YES YES NO

PDEContainerSetContent CORE YES YES YES NO

PDEContainerSetDict CORE YES YES YES NO

PDEContainerSetMCTag CORE YES YES YES NO

PDEContainerSetXAPMetadata CORE YES YES YES NO

PDEContentAddElem CORE YES YES YES NO

PDEContentAddPage CORE YES YES YES NO

PDEContentCreate CORE YES YES YES NO

PDEContentCreateFromCosObj CORE YES YES YES NO

PDEContentFlattenOC CORE YES YES YES NO

PDEContentGetAttrs CORE YES YES YES NO

PDEContentGetDefaultColor- CORE YES YES YES NO


Space
PDEContentGetElem CORE YES YES YES NO

PDEContentGetNumElems CORE YES YES YES NO

PDEContentGetResources CORE YES YES YES NO

PDEContentRemoveElem CORE YES YES YES NO

PDEContentSetContaining- CORE YES YES YES NO


Stream
PDEContentSetPage CORE YES YES YES NO

PDEContentSetStreamOwner CORE YES YES YES NO

Acrobat and PDF Library API Overview 645


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


PDEContentToCosObj CORE YES YES YES NO

PDEDefaultGState CORE YES YES YES NO

PDEDeviceNColorsCreate CORE YES YES YES NO

PDEDeviceNColorsGetColor- CORE YES YES YES NO


Value
PDEElementCopy CORE YES YES YES NO

PDEElementGetAllVisibili- CORE YES YES YES NO


ties
PDEElementGetBBox CORE YES YES YES NO

PDEElementGetClip CORE YES YES YES NO

PDEElementGetGState CORE YES YES YES NO

PDEElementGetMatrix CORE YES YES YES NO

PDEElementGetOCMD CORE YES YES YES NO

PDEElementHasGState CORE YES YES YES NO

PDEElementIsAtPoint CORE YES YES YES NO

PDEElementIsAtRect CORE YES YES YES NO

PDEElementIsCurrentlyVisi- CORE YES YES YES NO


ble
PDEElementMakeVisible CORE YES YES YES NO

PDEElementRemoveOCMD CORE YES YES YES NO

PDEElementSetClip CORE YES YES YES NO

PDEElementSetGState CORE YES YES YES NO

PDEElementSetMatrix CORE YES YES YES NO

PDEElementSetOCMD CORE YES YES YES NO

PDEEndContainerCreate CORE YES YES YES NO

PDEEndGroupCreate CORE YES YES YES NO

PDEEnumElements CORE YES YES YES NO

646 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


PDEExtGStateAcquireSoftMask CORE YES YES YES NO

PDEExtGStateCreate CORE YES YES YES NO

PDEExtGStateCreateNew CORE YES YES YES NO

PDEExtGStateGetAIS CORE YES YES YES NO

PDEExtGStateGetBlendMode CORE YES YES YES NO

PDEExtGStateGetCosObj CORE YES YES YES NO

PDEExtGStateGetOpacityFill CORE YES YES YES NO

PDEExtGStateGetOpaci- CORE YES YES YES NO


tyStroke
PDEExtGStateGetOPFill CORE YES YES YES NO

PDEExtGStateGetOPM CORE YES YES YES NO

PDEExtGStateGetOPStroke CORE YES YES YES NO

PDEExtGStateGetSA CORE YES YES YES NO

PDEExtGStateGetTK CORE YES YES YES NO

PDEExtGStateHasSoftMask CORE YES YES YES NO

PDEExtGStateSetAIS CORE YES YES YES NO

PDEExtGStateSetBlendMode CORE YES YES YES NO

PDEExtGStateSetOpacityFill CORE YES YES YES NO

PDEExtGStateSetOpaci- CORE YES YES YES NO


tyStroke
PDEExtGStateSetOPFill CORE YES YES YES NO

PDEExtGStateSetOPM CORE YES YES YES NO

PDEExtGStateSetOPStroke CORE YES YES YES NO

PDEExtGStateSetSA CORE YES YES YES NO

PDEExtGStateSetSoftMask CORE YES YES YES NO

PDEExtGStateSetTK CORE YES YES YES NO

PDEFontAddGlyphs CORE YES YES YES NO

Acrobat and PDF Library API Overview 647


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


PDEFontAddGlyphs CORE YES YES YES NO

PDEFontCreate CORE YES YES YES NO

PDEFontCreateFromCosObj CORE YES YES YES NO

PDEFontCreateFromSysFont CORE YES YES YES NO

PDEFontCreateFromSysFontAn- CORE YES YES YES NO


dEncoding
PDEFontCreateFromSysFontEx CORE YES YES YES NO

PDEFontCreateFromSys- CORE YES YES YES NO


FontWithParams
PDEFontCreateToUnicodeNow CORE YES YES YES NO

PDEFontCreateWidthsNow CORE YES YES YES NO

PDEFontCreateWithParams CORE YES YES YES NO

PDEFontEmbedNow CORE YES YES YES NO

PDEFontEmbedNowDontSubset CORE YES YES YES NO

PDEFontGetAttrs CORE YES YES YES NO

PDEFontGetCosObj CORE YES YES YES NO

PDEFontGetCreateNeedFlags CORE YES YES YES NO

PDEFontGetNumCodeBytes CORE YES YES YES NO

PDEFontGetOneByteEncoding CORE YES YES YES NO

PDEFontGetSysEncoding CORE YES YES YES NO

PDEFontGetSysFont CORE YES YES YES NO

PDEFontGetWidths CORE YES YES YES NO

PDEFontGetWidthsNow CORE YES YES YES NO

PDEFontIsEmbedded CORE YES YES YES NO

PDEFontIsMultiByte CORE YES YES YES NO

PDEFontSetSysEncoding CORE YES YES YES NO

PDEFontSetSysFont CORE YES YES YES NO

648 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


PDEFontSubsetNow CORE YES YES YES NO

PDEFontSumWidths CORE YES YES YES NO

PDEFontTranslateGlyphId- CORE YES YES YES NO


sToUnicode
PDEFormAcquireXGroup CORE YES YES YES NO

PDEFormCreateClone CORE YES YES YES NO

PDEFormCreateFromCosObj CORE YES YES YES NO

PDEFormGetContent CORE YES YES YES NO

PDEFormGetCosObj CORE YES YES YES NO

PDEFormHasXGroup CORE YES YES YES NO

PDEFormSetContent CORE YES YES YES NO

PDEFormSetXGroup CORE YES YES YES NO

PDEGetTag CORE YES YES YES NO

PDEGroupCreate CORE YES YES YES NO

PDEGroupGetContent CORE YES YES YES NO

PDEGroupSetContent CORE YES YES YES NO

PDEImageAcquireImageFlate CORE YES YES YES NO

PDEImageAcquireImageJPX CORE YES YES YES NO

PDEImageCreate CORE YES YES YES NO

PDEImageCreateFromCosObj CORE YES YES YES NO

PDEImageDataIsEncoded CORE YES YES YES NO

PDEImageFlateAcquireColor- CORE YES YES YES NO


Space
PDEImageFlateGetAttrs CORE YES YES YES NO

PDEImageFlateGetCosObj CORE YES YES YES NO

PDEImageFlateGetDataStm CORE YES YES YES NO

PDEImageGetAttrs CORE YES YES YES NO

Acrobat and PDF Library API Overview 649


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


PDEImageGetColorSpace CORE YES YES YES NO

PDEImageGetCosObj CORE YES YES YES NO

PDEImageGetData CORE YES YES YES NO

PDEImageGetDataLen CORE YES YES YES NO

PDEImageGetDataStm CORE YES YES YES NO

PDEImageGetDecodeArray CORE YES YES YES NO

PDEImageGetFilterArray CORE YES YES YES NO

PDEImageGetMatteArray CORE YES YES YES NO

PDEImageGetSMask CORE YES YES YES NO

PDEImageGetType CORE YES YES YES NO

PDEImageHasSMask CORE YES YES YES NO

PDEImageIsCosObj CORE YES YES YES NO

PDEImageJPXAcquireColor- CORE YES YES YES NO


Space
PDEImageJPXAcquireJPXColor- CORE YES YES YES NO
Space
PDEImageJPXAcquirePalette CORE YES YES YES NO

PDEImageJPXGetAttrs CORE YES YES YES NO

PDEImageJPXGetCosObj CORE YES YES YES NO

PDEImageJPXGetDataStm CORE YES YES YES NO

PDEImageJPXGetNumColor- CORE YES YES YES NO


Spaces
PDEImageJPXHasPalette CORE YES YES YES NO

PDEImageSetColorSpace CORE YES YES YES NO

PDEImageSetData CORE YES YES YES NO

PDEImageSetDataStm CORE YES YES YES NO

PDEImageSetDecodeArray CORE YES YES YES NO

650 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


PDEImageSetMatteArray CORE YES YES YES NO

PDEImageSetSMask CORE YES YES YES NO

PDELogDump CORE YES YES YES NO

PDEmbedSysFontForPDEFont CORE YES YES YES NO

PDEMergeResourcesDict CORE YES YES YES NO

PDEnumDocs CORE YES YES YES YES

PDEnumSysFonts CORE YES YES YES NO

PDEObjectDump CORE YES YES YES NO

PDEObjectGetType CORE YES YES YES NO

PDEPathAddSegment CORE YES YES YES NO

PDEPathCreate CORE YES YES YES NO

PDEPathGetData CORE YES YES YES NO

PDEPathGetPaintOp CORE YES YES YES NO

PDEPathSetData CORE YES YES YES NO

PDEPathSetPaintOp CORE YES YES YES NO

PDEPatternCreate CORE YES YES YES NO

PDEPatternGetCosObj CORE YES YES YES NO

PDEPlaceCreate CORE YES YES YES NO

PDEPlaceGetDict CORE YES YES YES NO

PDEPlaceGetMCTag CORE YES YES YES NO

PDEPlaceSetDict CORE YES YES YES NO

PDEPlaceSetMCTag CORE YES YES YES NO

PDEPSCreate CORE YES YES YES NO

PDEPSCreateFromCosObj CORE YES YES YES NO

PDEPSGetAttrs CORE YES YES YES NO

PDEPSGetData CORE YES YES YES NO

Acrobat and PDF Library API Overview 651


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


PDEPSGetDataStm CORE YES YES YES NO

PDEPSSetData CORE YES YES YES NO

PDEPSSetDataStm CORE YES YES YES NO

PDEPurgeCache CORE YES YES YES NO

PDERelease CORE YES YES YES NO

PDEReleaseSpan CORE YES YES YES NO

PDERemoveTag CORE YES YES YES NO

PDEShadingCreateFromCosObj CORE YES YES YES NO

PDEShadingGetCosObj CORE YES YES YES NO

PDESoftMaskAcquireForm CORE YES YES YES NO

PDESoftMaskCreate CORE YES YES YES NO

PDESoftMaskCreateFromCosObj CORE YES YES YES NO

PDESoftMaskCreateFromName CORE YES YES YES NO

PDESoftMaskGetBackdropColor CORE YES YES YES NO

PDESoftMaskGetCosObj CORE YES YES YES NO

PDESoftMaskGetName CORE YES YES YES NO

PDESoftMaskGetTransferFunc- CORE YES YES YES NO


tion
PDESoftMaskSetBackdropColor CORE YES YES YES NO

PDESoftMaskSetTransferFunc- CORE YES YES YES NO


tion
PDESoftMaskSetXGroup CORE YES YES YES NO

PDETextAdd CORE YES YES YES NO

PDETextAddGlyphs CORE YES YES YES NO

PDETextAddItem CORE YES YES YES NO

PDETextCreate CORE YES YES YES NO

PDETextGetAdvance CORE YES YES YES NO

652 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


PDETextGetAdvanceWidth CORE YES YES YES NO

PDETextGetBBox CORE YES YES YES NO

PDETextGetFont CORE YES YES YES NO

PDETextGetGState CORE YES YES YES NO

PDETextGetItem CORE YES YES YES NO

PDETextGetMatrix CORE YES YES YES NO

PDETextGetNumBytes CORE YES YES YES NO

PDETextGetNumChars CORE YES YES YES NO

PDETextGetNumRuns CORE YES YES YES NO

PDETextGetQuad CORE YES YES YES NO

PDETextGetRunForChar CORE YES YES YES NO

PDETextGetState CORE YES YES YES NO

PDETextGetStrokeMatrix CORE YES YES YES NO

PDETextGetText CORE YES YES YES NO

PDETextGetTextMatrix CORE YES YES YES NO

PDETextGetTextState CORE YES YES YES NO

PDETextIsAtPoint CORE YES YES YES NO

PDETextIsAtRect CORE YES YES YES NO

PDETextItemCopyText CORE YES YES YES NO

PDETextItemCreate CORE YES YES YES NO

PDETextItemGetFont CORE YES YES YES NO

PDETextItemGetGState CORE YES YES YES NO

PDETextItemGetTextLen CORE YES YES YES NO

PDETextItemGetTextMatrix CORE YES YES YES NO

PDETextItemGetTextState CORE YES YES YES NO

PDETextItemRemoveChars CORE YES YES YES NO

Acrobat and PDF Library API Overview 653


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


PDETextItemReplaceChars CORE YES YES YES NO

PDETextItemReplaceText CORE YES YES YES NO

PDETextItemSetFont CORE YES YES YES NO

PDETextItemSetGState CORE YES YES YES NO

PDETextItemSetTextMatrix CORE YES YES YES NO

PDETextItemSetTextState CORE YES YES YES NO

PDETextRemove CORE YES YES YES NO

PDETextRemoveItems CORE YES YES YES NO

PDETextReplaceChars CORE YES YES YES NO

PDETextRunGetCharOffset CORE YES YES YES NO

PDETextRunGetNumChars CORE YES YES YES NO

PDETextRunSetFont CORE YES YES YES NO

PDETextRunSetGState CORE YES YES YES NO

PDETextRunSetMatrix CORE YES YES YES NO

PDETextRunSetState CORE YES YES YES NO

PDETextRunSetStrokeMatrix CORE YES YES YES NO

PDETextRunSetTextMatrix CORE YES YES YES NO

PDETextRunSetTextState CORE YES YES YES NO

PDETextSplitRunAt CORE YES YES YES NO

PDEUnknownGetOpName CORE YES YES YES NO

PDEXGroupAcquireColorSpace CORE YES YES YES NO

PDEXGroupCreate CORE YES YES YES NO

PDEXGroupCreateFromCosObj CORE YES YES YES NO

PDEXGroupGetCosObj CORE YES YES YES NO

PDEXGroupGetIsolated CORE YES YES YES NO

PDEXGroupGetKnockout CORE YES YES YES NO

654 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


PDEXGroupSetColorSpace CORE YES YES YES NO

PDEXGroupSetIsolated CORE YES YES YES NO

PDEXGroupSetKnockout CORE YES YES YES NO

PDEXObjectCreate CORE YES YES YES NO

PDEXObjectGetCosObj CORE YES YES YES NO

PDFileSpecAcquireASPath CORE YES YES YES YES

PDFileSpecFromCosObj CORE YES YES YES YES

PDFileSpecGetCosObj CORE YES YES YES YES

PDFileSpecGetDIPath CORE YES YES YES YES

PDFileSpecGetDoc CORE YES YES YES YES

PDFileSpecGetFileSys CORE YES YES YES YES

PDFileSpecGetFileSysName CORE YES YES YES YES

PDFileSpecIsValid CORE YES YES YES YES

PDFileSpecNewFromASPath CORE YES YES YES NO

PDFindSysFont CORE YES YES YES NO

PDFindSysFontEx CORE YES YES YES NO

PDFindSysFontForPDEFont CORE YES YES YES NO

PDFontAcquireEncodingArray CORE YES YES YES YES

PDFontAcquireXlateTable CORE YES YES YES YES

PDFontEncodingArrayRelease CORE YES YES YES YES

PDFontEnumCharProcs CORE YES YES YES YES

PDFontFromCosObj CORE YES YES YES YES

PDFontGetASTextName CORE YES YES YES YES

PDFontGetBBox CORE YES YES YES YES

PDFontGetCharSet CORE YES YES YES YES

PDFontGetCIDSystemInfo CORE YES YES YES YES

Acrobat and PDF Library API Overview 655


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


PDFontGetCIDSystemSupple- CORE YES YES YES YES
ment
PDFontGetCosObj CORE YES YES YES YES

PDFontGetDescendant CORE YES YES YES YES

PDFontGetEncodingIndex CORE YES YES YES YES

PDFontGetEncodingName CORE YES YES YES YES

PDFontGetFontMatrix CORE YES YES YES YES

PDFontGetMetrics CORE YES YES YES YES

PDFontGetName CORE YES YES YES YES

PDFontGetSubtype CORE YES YES YES YES

PDFontGetWidths CORE YES YES YES YES

PDFontIsEmbedded CORE YES YES YES YES

PDFontSetMetrics CORE YES YES YES NO

PDFontXlateString CORE YES YES YES YES

PDFontXlateTableRelease CORE YES YES YES YES

PDFontXlateToHost CORE YES YES YES YES

PDFontXlateToUCS CORE YES YES YES YES

PDFontXlateWidths CORE YES YES YES YES

PDFormEnumPaintProc CORE YES YES YES YES

PDFormEnumPaintProcWith- CORE YES YES YES YES


Params
PDFormEnumResources CORE YES YES YES YES

PDFormGetBBox CORE YES YES YES YES

PDFormGetFormType CORE YES YES YES YES

PDFormGetMatrix CORE YES YES YES YES

PDFormGetXUIDCosObj CORE YES YES YES YES

PDGetAnnotHandlerByName CORE YES YES YES NO

656 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


PDGetHostEncoding CORE YES YES YES YES

PDGetPDFDocEncoding CORE YES YES YES YES

PDGraphicGetBBox CORE YES YES YES YES

PDGraphicGetCurrentMatrix CORE YES YES YES YES

PDGraphicGetState CORE YES YES YES YES

PDHostMBLen CORE YES YES YES YES

PDImageColorSpaceGetIndex- CORE YES YES YES YES


Lookup
PDImageGetAttrs CORE YES YES YES YES

PDImageSelAdjustMatrix CORE YES YES YES YES

PDImageSelectAlternate CORE YES YES YES YES

PDImageSelGetDeviceAttr CORE YES YES YES YES

PDImageSelGetGeoAttr CORE YES YES YES YES

PDInlineImageColorSpaceGet- CORE YES YES YES YES


IndexLookup
PDInlineImageGetAttrs CORE YES YES YES YES

PDInlineImageGetData CORE YES YES YES YES

PDLinkAnnotGetAction CORE YES YES YES YES

PDLinkAnnotGetBorder CORE YES YES YES YES

PDLinkAnnotRemoveAction CORE YES YES YES NO

PDLinkAnnotSetAction CORE YES YES YES YES

PDLinkAnnotSetBorder CORE YES YES YES YES

PDNameTreeEnum CORE YES YES YES YES

PDNameTreeEqual CORE YES YES YES YES

PDNameTreeFromCosObj CORE YES YES YES YES

PDNameTreeGet CORE YES YES YES YES

PDNameTreeGetCosObj CORE YES YES YES YES

Acrobat and PDF Library API Overview 657


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


PDNameTreeIsValid CORE YES YES YES YES

PDNameTreeLookup CORE YES YES YES YES

PDNameTreeNew CORE YES YES YES NO

PDNameTreeNotifyNameAdded CORE YES YES YES NO

PDNameTreeNotifyNameRemoved CORE YES YES YES NO

PDNameTreePut CORE YES YES YES NO

PDNameTreeRemove CORE YES YES YES NO

PDNumTreeEnum CORE YES YES YES YES

PDNumTreeEqual CORE YES YES YES YES

PDNumTreeFromCosObj CORE YES YES YES YES

PDNumTreeGet CORE YES YES YES YES

PDNumTreeGetCosObj CORE YES YES YES YES

PDNumTreeIsValid CORE YES YES YES YES

PDNumTreeNew CORE YES YES YES NO

PDNumTreePut CORE YES YES YES NO

PDNumTreeRemove CORE YES YES YES NO

PDOCConfigCreate CORE YES YES YES YES

PDOCConfigDestroy CORE YES YES YES YES

PDOCConfigGetAllRadioBut- CORE YES YES YES YES


tonGroups
PDOCConfigGetCosObj CORE YES YES YES YES

PDOCConfigGetCreator CORE YES YES YES YES

PDOCConfigGetInitState CORE YES YES YES YES

PDOCConfigGetIntent CORE YES YES YES YES

PDOCConfigGetLockedArray CORE YES YES YES YES

PDOCConfigGetName CORE YES YES YES YES

PDOCConfigGetOCGOrder CORE YES YES YES YES

658 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


PDOCConfigGetPDDoc CORE YES YES YES YES

PDOCConfigGetRadioButton- CORE YES YES YES YES


GroupForOCG
PDOCConfigMakeRadioButton- CORE YES YES YES YES
Group
PDOCConfigSetCreator CORE YES YES YES YES

PDOCConfigSetInitState CORE YES YES YES YES

PDOCConfigSetIntent CORE YES YES YES YES

PDOCConfigSetLockedArray CORE YES YES YES YES

PDOCConfigSetName CORE YES YES YES YES

PDOCConfigSetOCGOrder CORE YES YES YES YES

PDOCContextApplyAutoState- CORE YES YES YES YES


Changes
PDOCContextClearAllUse- CORE YES YES YES YES
rOverrides
PDOCContextContentIsVisible CORE YES YES YES YES

PDOCContextFindAutoState- CORE YES YES YES YES


Changes
PDOCContextFree CORE YES YES YES YES

PDOCContextGetIntent CORE YES YES YES YES

PDOCContextGetNonOCDrawing CORE YES YES YES YES

PDOCContextGetOCDrawEnum- CORE YES YES YES YES


Type
PDOCContextGetOCGStates CORE YES YES YES YES

PDOCContextGetPDDoc CORE YES YES YES YES

PDOCContextInit CORE YES YES YES YES

PDOCContextMakeCopy CORE YES YES YES YES

PDOCContextMakeCopyWithAu- CORE YES YES YES YES


toStateChanges

Acrobat and PDF Library API Overview 659


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


PDOCContextNew CORE YES YES YES YES

PDOCContextNewWithInitial- CORE YES YES YES YES


State
PDOCContextNewWithOCDis- CORE YES YES YES YES
abled
PDOCContextPopOCMD CORE YES YES YES YES

PDOCContextPushOCMD CORE YES YES YES YES

PDOCContextResetOCMDStack CORE YES YES YES YES

PDOCContextSetIntent CORE YES YES YES YES

PDOCContextSetNonOCDrawing CORE YES YES YES YES

PDOCContextSetOCDrawEnum- CORE YES YES YES YES


Type
PDOCContextSetOCGStates CORE YES YES YES YES

PDOCContextXObjectIsVisible CORE YES YES YES YES

PDOCGCreate CORE YES YES YES YES

PDOCGCreateFromCosObj CORE YES YES YES YES

PDOCGDestroy CORE YES YES YES YES

PDOCGGetCosObj CORE YES YES YES YES

PDOCGGetCurrentState CORE YES YES YES YES

PDOCGGetFromCosObj CORE YES YES YES YES

PDOCGGetInitialState CORE YES YES YES YES

PDOCGGetIntent CORE YES YES YES YES

PDOCGGetLocked CORE YES YES YES YES

PDOCGGetName CORE YES YES YES YES

PDOCGGetPDDoc CORE YES YES YES YES

PDOCGGetUsageEntry CORE YES YES YES YES

PDOCGGetUserOverride CORE YES YES YES YES

660 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


PDOCGHasUsageInfo CORE YES YES YES YES

PDOCGRemoveInitialState CORE YES YES YES YES

PDOCGSetCurrentState CORE YES YES YES YES

PDOCGSetInitialState CORE YES YES YES YES

PDOCGSetIntent CORE YES YES YES YES

PDOCGSetLocked CORE YES YES YES YES

PDOCGSetName CORE YES YES YES YES

PDOCGSetUsageDictEntry CORE YES YES YES YES

PDOCGSetUserOverride CORE YES YES YES YES

PDOCGUsedInOCConfig CORE YES YES YES YES

PDOCGUsedInOCContext CORE YES YES YES YES

PDOCMDCreate CORE YES YES YES YES

PDOCMDFindOrCreate CORE YES YES YES YES

PDOCMDFindOrCreateEx CORE YES YES YES YES

PDOCMDGetCosObj CORE YES YES YES YES

PDOCMDGetFromCosObj CORE YES YES YES YES

PDOCMDGetOCGs CORE YES YES YES YES

PDOCMDGetPDDoc CORE YES YES YES YES

PDOCMDGetVisibilityExpres- CORE YES YES YES YES


sion
PDOCMDGetVisPolicy CORE YES YES YES YES

PDOCMDIsCurrentlyVisible CORE YES YES YES YES

PDOCMDsAreCurrentlyVisible CORE YES YES YES YES

PDOCMDsMakeContentVisible CORE YES YES YES YES

PDPageAcquirePage CORE YES YES YES YES

PDPageAcquirePDEContent CORE YES YES YES NO

PDPageAddAnnot CORE YES YES YES NO

Acrobat and PDF Library API Overview 661


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


PDPageAddCosContents CORE YES YES YES NO

PDPageAddCosResource CORE YES YES YES NO

PDPageAddNewAnnot CORE YES YES YES NO

PDPageCreateAnnot CORE YES YES YES YES

PDPageDrawContentsToWindow CORE YES YES YES YES

PDPageDrawContentsToWin- CORE YES YES YES YES


dowEx
PDPageDrawContentsWith- CORE YES YES YES YES
Params
PDPageEnumContents CORE NO YES YES YES

PDPageEnumInks CORE YES YES NO NO

PDPageEnumInksEx CORE YES YES YES YES

PDPageEnumOCGs CORE YES YES YES YES

PDPageEnumResources CORE NO YES YES YES

PDPageFlattenOC CORE YES YES YES YES

PDPageGetAnnot CORE YES YES YES YES

PDPageGetAnnotIndex CORE YES YES YES YES

PDPageGetAnnotSequence CORE YES YES YES NO

PDPageGetBBox CORE YES YES YES YES

PDPageGetBox CORE YES YES YES YES

PDPageGetCosObj CORE YES YES YES YES

PDPageGetCosResources CORE YES YES YES YES

PDPageGetCropBox CORE YES YES YES YES

PDPageGetDefaultMatrix CORE YES YES YES YES

PDPageGetDoc CORE YES YES YES YES

PDPageGetDuration CORE YES YES YES YES

PDPageGetFlippedMatrix CORE YES YES YES YES

662 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


PDPageGetMediaBox CORE YES YES YES YES

PDPageGetNumAnnots CORE YES YES YES YES

PDPageGetNumber CORE YES YES YES YES

PDPageGetOCGs CORE YES YES YES YES

PDPageGetPalette CORE YES YES YES YES

PDPageGetPDEContentFilters CORE YES YES YES NO

PDPageGetPDEContentFlags CORE YES YES YES NO

PDPageGetRotate CORE YES YES YES YES

PDPageGetTransition CORE YES YES YES YES

PDPageGetUserUnitSize CORE YES YES YES YES

PDPageGetVisibleBBox CORE YES YES YES YES

PDPageHasTransition CORE YES YES YES YES

PDPageHasTransparency CORE YES YES YES YES

PDPageLabelEqual CORE YES YES YES YES

PDPageLabelFromCosObj CORE YES YES YES YES

PDPageLabelGetCosObj CORE YES YES YES YES

PDPageLabelGetPrefix CORE YES YES YES YES

PDPageLabelGetStart CORE YES YES YES YES

PDPageLabelGetStyle CORE YES YES YES YES

PDPageLabelIsValid CORE YES YES YES YES

PDPageLabelNew CORE YES YES YES NO

PDPageMakeSeparations CORE YES YES NO NO

PDPageNotifyContentsDid- CORE YES YES YES YES


Change
PDPageNotifyContentsDid- CORE YES YES YES YES
ChangeEx
PDPageNumFromCosObj CORE YES YES YES YES

Acrobat and PDF Library API Overview 663


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


PDPagePDEContentWasChanged CORE YES YES YES NO

PDPageRegisterForPDECon- CORE YES YES YES NO


tentChanged
PDPageRegisterForPDECon- CORE YES YES YES NO
tentNotCached
PDPageRelease CORE YES YES YES YES

PDPageReleasePDEContent CORE YES YES YES NO

PDPageRemoveAnnot CORE YES YES YES NO

PDPageRemoveCosContents CORE YES YES YES NO

PDPageRemoveCosResource CORE YES YES YES NO

PDPageResumePDECon- CORE YES YES YES NO


tentChanged
PDPageSetBox CORE YES YES YES NO

PDPageSetCropBox CORE YES YES YES NO

PDPageSetDuration CORE YES YES YES NO

PDPageSetMediaBox CORE YES YES YES NO

PDPageSetPDEContent CORE YES YES YES NO

PDPageSetPDEContentCanRaise CORE YES YES YES NO

PDPageSetPDEContentFilters CORE YES YES YES NO

PDPageSetPDEContentFlags CORE YES YES YES NO

PDPageSetRotate CORE YES YES YES NO

PDPageSetTransition CORE YES YES YES NO

PDPageSetUserUnitSize CORE YES YES YES YES

PDPageStmGetInlineImage CORE YES YES YES YES

PDPageStmGetToken CORE YES YES YES YES

PDPageSuspendPDECon- CORE YES YES YES NO


tentChanged

664 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


PDPageUnRegisterForPDECon- CORE YES YES YES NO
tentChanged
PDPageUnRegisterForPDECon- CORE YES YES YES NO
tentNotCached
PDPathEnum CORE YES YES YES YES

PDPathGetPaintOp CORE YES YES YES YES

PDPrefGetColorCal CORE YES YES YES YES

PDPrefSetColorCal CORE YES YES YES YES

PDRegisterActionHandler CORE YES YES YES NO

PDRegisterAnnotHandler CORE YES YES YES NO

PDRegisterCryptHandler CORE YES YES YES YES

PDRegisterCryptHandlerEx CORE YES YES YES YES

PDRegisterFileSpecHandler CORE YES YES YES YES

PDRegisterFileSpecHandler- CORE YES YES YES YES


ByName
PDSAttrObjCreate CORE YES YES YES NO

PDSAttrObjCreateFromStream CORE YES YES YES NO

PDSAttrObjGetCosObj CORE YES YES YES YES

PDSAttrObjGetOwner CORE YES YES YES YES

PDSClassMapAddAttrObj CORE YES YES YES NO

PDSClassMapGetAttrObj CORE YES YES YES YES

PDSClassMapGetNumAttrObjs CORE YES YES YES YES

PDSClassMapRemoveAttrObj CORE YES YES YES NO

PDSClassMapRemoveClass CORE YES YES YES NO

PDSElementAddAttrObj CORE YES YES YES NO

PDSElementAddClass CORE YES YES YES NO

PDSElementClearID CORE YES YES YES NO

Acrobat and PDF Library API Overview 665


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


PDSElementCreate CORE YES YES YES NO

PDSElementEnumKidsWithUser- CORE YES YES YES NO


Properties
PDSElementEnumUserProper- CORE YES YES YES NO
tiesAsASText
PDSElementEnumUserProper- CORE YES YES YES NO
tiesAsCosObj
PDSElementFindAncestorWith- CORE YES YES YES NO
UserProperties
PDSElementGetActualText CORE YES YES YES YES

PDSElementGetAlt CORE YES YES YES YES

PDSElementGetAttrObj CORE YES YES YES YES

PDSElementGetClass CORE YES YES YES YES

PDSElementGetCosObj CORE YES YES YES YES

PDSElementGetFirstPage CORE YES YES YES YES

PDSElementGetID CORE YES YES YES YES

PDSElementGetKid CORE YES YES YES YES

PDSElementGetKidEx CORE YES YES YES YES

PDSElementGetKidWithMCInfo CORE YES YES YES YES

PDSElementGetLanguage CORE YES YES YES YES

PDSElementGetNumAttrObjs CORE YES YES YES YES

PDSElementGetNumClasses CORE YES YES YES YES

PDSElementGetNumKids CORE YES YES YES YES

PDSElementGetParent CORE YES YES YES YES

PDSElementGetRevision CORE YES YES YES YES

PDSElementGetStructTreeRoot CORE YES YES YES YES

PDSElementGetTitle CORE YES YES YES YES

PDSElementGetType CORE YES YES YES YES

666 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


PDSElementHasActualText CORE YES YES YES YES

PDSElementHasAlt CORE YES YES YES YES

PDSElementHasLanguage CORE YES YES YES YES

PDSElementHasUserProperties CORE YES YES YES NO

PDSElementIncrementRevision CORE YES YES YES NO

PDSElementInsertKid CORE YES YES YES NO

PDSElementInsertMCAsKid CORE YES YES YES NO

PDSElementInsertMCRefAsKid CORE YES YES YES NO

PDSElementInsertOBJAsKid CORE YES YES YES NO

PDSElementInsertStmMCAsKid CORE YES YES YES NO

PDSElementRemoveAllAttrObjs CORE YES YES YES NO

PDSElementRemoveAllClasses CORE YES YES YES NO

PDSElementRemoveAttrObj CORE YES YES YES NO

PDSElementRemoveClass CORE YES YES YES NO

PDSElementRemoveKid CORE YES YES YES NO

PDSElementRemoveKidMC CORE YES YES YES NO

PDSElementRemoveKidOBJ CORE YES YES YES NO

PDSElementReplaceKid CORE YES YES YES NO

PDSElementReplaceKidMC CORE YES YES YES NO

PDSElementReplaceKidOBJ CORE YES YES YES NO

PDSElementSetActualText CORE YES YES YES NO

PDSElementSetAlt CORE YES YES YES NO

PDSElementSetID CORE YES YES YES NO

PDSElementSetLanguage CORE YES YES YES NO

PDSElementSetTitle CORE YES YES YES NO

PDSElementSetType CORE YES YES YES NO

Acrobat and PDF Library API Overview 667


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


PDSetHostEncoding CORE YES YES YES YES

PDSMCGetInfo CORE YES YES YES YES

PDSMCGetParent CORE YES YES YES YES

PDSMCGetPDEContainer CORE YES YES YES YES

PDSMCIDGetParent CORE YES YES YES YES

PDSMCRefCreate CORE YES YES YES NO

PDSMCRefDestroy CORE YES YES YES NO

PDSOBJGetParent CORE YES YES YES YES

PDSRoleMapCopy CORE YES YES YES NO

PDSRoleMapDoesMap CORE YES YES YES YES

PDSRoleMapGetDirectMap CORE YES YES YES YES

PDSRoleMapMap CORE YES YES YES NO

PDSRoleMapUnMapDst CORE YES YES YES NO

PDSRoleMapUnMapSrc CORE YES YES YES NO

PDSTreeRootCreateClassMap CORE YES YES YES NO

PDSTreeRootCreateRoleMap CORE YES YES YES NO

PDSTreeRootGetClassMap CORE YES YES YES YES

PDSTreeRootGetElementFromID CORE YES YES YES YES

PDSTreeRootGetKid CORE YES YES YES YES

PDSTreeRootGetNumKids CORE YES YES YES YES

PDSTreeRootGetRoleMap CORE YES YES YES YES

PDSTreeRootInsertKid CORE YES YES YES NO

PDSTreeRootRemoveClassMap CORE YES YES YES NO

PDSTreeRootRemoveKid CORE YES YES YES NO

PDSTreeRootRemoveRoleMap CORE YES YES YES NO

PDSTreeRootReplaceKid CORE YES YES YES NO

668 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


PDSTreeRootReplaceStreamRef CORE YES YES YES NO

PDStyleGetColor CORE YES YES YES YES

PDStyleGetFont CORE YES YES YES YES

PDStyleGetFontSize CORE YES YES YES YES

PDSysEncodingCreateFrom- CORE YES YES YES NO


BaseName
PDSysEncodingCreateFromC- CORE YES YES YES NO
MapName
PDSysEncodingCreateFrom- CORE YES YES YES NO
CodePage
PDSysEncodingGetWMode CORE YES YES YES NO

PDSysEncodingIsIdentity CORE YES YES YES NO

PDSysEncodingIsMultiByte CORE YES YES YES NO

PDSysFontAcquirePlatform- CORE YES YES YES NO


Data
PDSysFontGetAttrs CORE YES YES YES NO

PDSysFontGetCIDSystemInfo CORE YES YES YES NO

PDSysFontGetCreateFlags CORE YES YES YES NO

PDSysFontGetEncoding CORE YES YES YES NO

PDSysFontGetInfo CORE YES YES YES NO

PDSysFontGetName CORE YES YES YES NO

PDSysFontGetType0Widths CORE YES YES YES NO

PDSysFontGetWidths CORE YES YES YES NO

PDSysFontGetWidthsEx CORE YES YES YES NO

PDSysFontReleasePlatform- CORE YES YES YES NO


Data
PDSysFontVerifyEncoding CORE YES YES YES NO

PDTextAnnotGetContents CORE YES YES YES YES

Acrobat and PDF Library API Overview 669


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


PDTextAnnotIsOpen CORE YES YES YES YES

PDTextAnnotSetContents CORE YES YES YES YES

PDTextAnnotSetOpen CORE YES YES YES YES

PDTextEnum CORE YES YES YES YES

PDTextGetState CORE YES YES YES YES

PDTextSelectCreatePageHi- CORE YES YES YES YES


lite
PDTextSelectCreatePageHili- CORE YES YES YES YES
teEx
PDTextSelectCreateRanges CORE YES YES YES YES

PDTextSelectCreateRangesEx CORE YES YES YES YES

PDTextSelectCreateWordHi- CORE YES YES YES YES


lite
PDTextSelectCreateWordHili- CORE YES YES YES YES
teEx
PDTextSelectDestroy CORE YES YES YES YES

PDTextSelectEnumQuads CORE YES YES YES YES

PDTextSelectEnumText CORE YES YES YES YES

PDTextSelectEnumTextUCS CORE YES YES YES YES

PDTextSelectGetBoundingRect CORE YES YES YES YES

PDTextSelectGetPage CORE YES YES YES YES

PDTextSelectGetRange CORE YES YES YES YES

PDTextSelectGetRangeCount CORE YES YES YES YES

PDThreadDestroy CORE YES YES YES NO

PDThreadFromCosObj CORE YES YES YES YES

PDThreadGetCosObj CORE YES YES YES YES

PDThreadGetFirstBead CORE YES YES YES YES

PDThreadGetInfo CORE YES YES YES YES

670 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


PDThreadIsValid CORE YES YES YES YES

PDThreadNew CORE YES YES YES NO

PDThreadSetFirstBead CORE YES YES YES NO

PDThreadSetInfo CORE YES YES YES NO

PDTransEqual CORE YES YES YES YES

PDTransFromCosObj CORE YES YES YES YES

PDTransGetCosObj CORE YES YES YES YES

PDTransGetDuration CORE YES YES YES YES

PDTransGetSubtype CORE YES YES YES YES

PDTransIsValid CORE YES YES YES YES

PDTransNew CORE YES YES YES NO

PDTransNewFromCosDoc CORE YES YES YES YES

PDTransNull CORE YES YES YES YES

PDViewDestCreate CORE YES YES YES NO

PDViewDestDestroy CORE YES YES YES NO

PDViewDestFromCosObj CORE YES YES YES YES

PDViewDestGetAttr CORE YES YES YES YES

PDViewDestGetCosObj CORE YES YES YES YES

PDViewDestIsValid CORE YES YES YES YES

PDViewDestResolve CORE YES YES YES YES

PDWordCreateTextSelect CORE YES YES YES YES

PDWordFilterString CORE YES YES YES YES

PDWordFilterWord CORE YES YES YES YES

PDWordFinderAcquireVisible- CORE YES YES YES YES


WordList
PDWordFinderAcquireWordList CORE YES YES YES YES

PDWordFinderDestroy CORE YES YES YES YES

Acrobat and PDF Library API Overview 671


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


PDWordFinderEnumVisible- CORE YES YES YES YES
Words
PDWordFinderEnumWords CORE YES YES YES YES

PDWordFinderEnumWordsStr CORE YES YES YES YES

PDWordFinderGetLatestAlg- CORE YES YES YES YES


Version
PDWordFinderGetNthWord CORE YES YES YES YES

PDWordFinderReleaseWordList CORE YES YES YES YES

PDWordGetASText CORE YES YES YES YES

PDWordGetAttr CORE YES YES YES YES

PDWordGetAttrEx CORE YES YES YES YES

PDWordGetByteIdxFromHilite- CORE YES YES YES YES


Char
PDWordGetCharacterTypes CORE YES YES YES YES

PDWordGetCharDelta CORE YES YES YES YES

PDWordGetCharEncFlags CORE YES YES YES YES

PDWordGetCharOffset CORE YES YES YES YES

PDWordGetCharOffsetEx CORE YES YES YES YES

PDWordGetCharQuad CORE YES YES YES YES

PDWordGetLength CORE YES YES YES YES

PDWordGetNthCharStyle CORE YES YES YES YES

PDWordGetNthQuad CORE YES YES YES YES

PDWordGetNumHiliteChar CORE YES YES YES YES

PDWordGetNumQuads CORE YES YES YES YES

PDWordGetString CORE YES YES YES YES

PDWordGetStyleTransition CORE YES YES YES YES

PDWordIsCurrentlyVisible CORE YES YES YES YES

672 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


PDWordIsRotated CORE YES YES YES YES

PDWordMakeVisible CORE YES YES YES YES

PDWordSplitString CORE YES YES YES YES

PDXlateToHost CORE YES YES YES YES

PDXlateToHostEx CORE YES YES YES YES

PDXlateToPDFDocEnc CORE YES YES YES YES

PDXlateToPDFDocEncEx CORE YES YES YES YES

PDXObjectEnumFilters CORE YES YES YES YES

PDXObjectGetCosObj CORE YES YES YES YES

PDXObjectGetData CORE YES YES YES YES

PDXObjectGetDataLength CORE YES YES YES YES

PDXObjectGetSubtype CORE YES YES YES YES

RectToAVRect CORE NO YES YES YES

UnixAppAddModifierCallback CORE NO YES YES YES

UnixAppClipboardGetItemId CORE NO YES YES YES

UnixAppDispatchEvent CORE NO YES YES YES

UnixAppGetAppShellWidget CORE NO YES YES YES

UnixAppGetPlugInFilename CORE NO YES YES YES

UnixAppLoadPlugInAppDe- CORE NO YES YES YES


faults
UnixAppProcessEvent CORE NO YES YES YES

UnixAppRemoveModifierCall- CORE NO YES YES YES


back
UnixAppWaitForWm CORE NO YES YES YES

UnixSysGetConfigName CORE NO YES YES YES

UnixSysGetCursor CORE NO YES YES YES

UnixSysGetCwd CORE NO YES YES YES

Acrobat and PDF Library API Overview 673


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


UnixSysGetHomeDirectory CORE NO YES YES YES

UnixSysGetHostname CORE NO YES YES YES

UnixSysGetIcon CORE NO YES YES YES

UnixSysGetInstallDirectory CORE NO YES YES YES

UnixSysGetPixmap CORE NO YES YES YES

UnixSysGetString CORE NO YES YES YES

UnixSysGetTempFileDirectory CORE NO YES YES YES

UnixSysPrefInit CORE NO YES YES YES

UnixSysPrefUpdate CORE NO YES YES YES

WinAppEnableIdleTimer CORE NO YES YES YES

WinAppGetModalParent CORE NO YES YES YES

WinAppGetPalette CORE NO YES YES YES

WinAppGetPrinterHDC CORE NO YES YES YES

WinAppRegisterInterface CORE NO YES YES YES

WinAppRegisterModelessDia- CORE NO YES YES YES


log
WinAppUnRegisterModelessDi- CORE NO YES YES YES
alog
ASAtomGetCount PDFL only NO NO NO

ASFileSysGetDefaultTempPath PDFL only NO NO NO

ASFileSysSetDefaultTempPath PDFL only NO NO NO

ASGetExceptionErrorCode PDFL only NO NO NO

ASPopExceptionFrame PDFL only NO NO NO

ASPurgeMemory PDFL only NO NO NO

ASPushExceptionFrame PDFL only NO NO NO

PDDocPrintPages PDFL only NO NO NO

PDFLGetCoreHFT PDFL only NO NO NO

674 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


PDFLGetFlags PDFL only NO NO NO

PDFLGetInitCount PDFL only NO NO NO

PDFLGetVersion PDFL only NO NO NO

PDFLibraryRegisterNotifica- PDFL only NO NO NO


tion
PDFLibraryUnregisterNotifi- PDFL only NO NO NO
cation
PDFLInit PDFL only NO NO NO

PDFLPrintDoc PDFL only NO NO NO

PDFLTerm PDFL only NO NO NO

PDFontDownloadContextCreate PDFL only NO NO NO

PDFontDownloadContextDe- PDFL only NO NO NO


stroy
PDFontPSEmitGlyphsIncr PDFL only NO NO NO

PDFontPSFlushIncrGlyphList PDFL only NO NO NO

PDFontPSGetComponent- PDFL only NO NO NO


FontList
PDFontStreamPS PDFL only NO NO NO

PDFontWasExtracted PDFL only NO NO NO

PDFontWasFauxed PDFL only NO NO NO

PDFreeMemory PDFL only NO NO NO

PDPageDrawContentsPlaced- PDFL only NO NO NO


ToWindow
PDPageDrawContentsToMemory PDFL only NO NO NO

PDPageDrawContentsToWindow PDFL only NO NO NO

PDPageEmitPSOrient PDFL only NO NO NO

PDPageGetSize PDFL only NO NO NO

PDPrefGetAntialiasLevel PDFL only NO NO NO

Acrobat and PDF Library API Overview 675


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


PDPrefGetBlackPointCompen- PDFL only NO NO NO
sation
PDPrefGetGreekLevel PDFL only NO NO NO

PDPrefGetSuppressICCSpaces PDFL only NO NO NO

PDPrefGetUseOutputIntents PDFL only NO NO NO

PDPrefSetAntialiasLevel PDFL only NO NO NO

PDPrefSetBlackPointCompen- PDFL only NO NO NO


sation
PDPrefSetGreekLevel PDFL only NO NO NO

PDPrefSetSuppressICCSpaces PDFL only NO NO NO

PDPrefSetUseLocalFonts PDFL only NO NO NO

PDPrefSetUseOutputIntents PDFL only NO NO NO

PDPrefSetWorkingCMYK PDFL only NO NO NO

PDPrefSetWorkingGray PDFL only NO NO NO

PDPrefSetWorkingRGB PDFL only NO NO NO

AABFindCertsByName PLUGIN NO YES YES YES

AABGetCertChain PLUGIN NO YES YES YES

AABGetCertTrust PLUGIN NO YES YES YES

AABGetTrustedCerts PLUGIN NO YES YES YES

AABIsCertPresent PLUGIN NO YES YES YES

AFDrawText PLUGIN NO YES YES YES

AFExecuteThisScript PLUGIN NO YES YES YES

AFImportAppearance PLUGIN NO YES YES YES

AFLayoutBorder PLUGIN NO YES YES YES

AFLayoutCreateStream PLUGIN NO YES YES YES

AFLayoutDelete PLUGIN NO YES YES YES

AFLayoutNew PLUGIN NO YES YES YES

676 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


AFLayoutText PLUGIN NO YES YES YES

AFLayoutTextEx PLUGIN NO YES YES YES

AFPDDocEnumPDFields PLUGIN NO YES YES YES

AFPDDocGetPDFieldFromName PLUGIN NO YES YES YES

AFPDDocLoadPDFields PLUGIN NO YES YES YES

AFPDFieldFromCosObj PLUGIN NO YES YES YES

AFPDFieldGetCosObj PLUGIN NO YES YES YES

AFPDFieldGetDefaultTextAp- PLUGIN NO YES YES YES


pearance
AFPDFieldGetFlags PLUGIN NO YES YES YES

AFPDFieldGetName PLUGIN NO YES YES YES

AFPDFieldGetValue PLUGIN NO YES YES YES

AFPDFieldIsAnnot PLUGIN NO YES YES YES

AFPDFieldIsTerminal PLUGIN NO YES YES YES

AFPDFieldIsValid PLUGIN NO YES YES YES

AFPDFieldReset PLUGIN NO YES YES YES

AFPDFieldSetDefaultTextAp- PLUGIN NO YES YES YES


pearance
AFPDFieldSetFlags PLUGIN NO YES YES YES

AFPDFieldSetOptions PLUGIN NO YES YES YES

AFPDFieldSetValue PLUGIN NO YES YES YES

AFPDFieldValueChanged PLUGIN NO YES YES YES

AFPDFormFromPage PLUGIN NO YES YES YES

AFPDWidgetGetAreaColors PLUGIN NO YES YES YES

AFPDWidgetGetBorder PLUGIN NO YES YES YES

AFPDWidgetGetRotation PLUGIN NO YES YES YES

AFPDWidgetSetAreaColors PLUGIN NO YES YES YES

Acrobat and PDF Library API Overview 677


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


AFPDWidgetSetBorder PLUGIN NO YES YES YES

AFTTSEnd PLUGIN NO YES YES YES

AFTTSGetCharacterScale PLUGIN NO YES YES YES

AFTTSGetNumberOfVoices PLUGIN NO YES YES YES

AFTTSGetPitch PLUGIN NO YES YES YES

AFTTSGetPunctuations PLUGIN NO YES YES YES

AFTTSGetSpeaker PLUGIN NO YES YES YES

AFTTSGetSpeechRate PLUGIN NO YES YES YES

AFTTSGetVoiceName PLUGIN NO YES YES YES

AFTTSGetVolume PLUGIN NO YES YES YES

AFTTSIsAvailable PLUGIN NO YES YES YES

AFTTSPause PLUGIN NO YES YES YES

AFTTSQSilence PLUGIN NO YES YES YES

AFTTSQSound PLUGIN NO YES YES YES

AFTTSQTone PLUGIN NO YES YES YES

AFTTSQueueTextData PLUGIN NO YES YES YES

AFTTSReset PLUGIN NO YES YES YES

AFTTSResume PLUGIN NO YES YES YES

AFTTSSetCharacterScale PLUGIN NO YES YES YES

AFTTSSetNotify PLUGIN NO YES YES YES

AFTTSSetPitch PLUGIN NO YES YES YES

AFTTSSetPunctuations PLUGIN NO YES YES YES

AFTTSSetSpeaker PLUGIN NO YES YES YES

AFTTSSetSpeechRate PLUGIN NO YES YES YES

AFTTSSetVolume PLUGIN NO YES YES YES

AFTTSStop PLUGIN NO YES YES YES

678 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


AFTTSTalk PLUGIN NO YES YES YES

AssembleFormAndImportFDF PLUGIN NO YES YES YES

BeginWebProgress PLUGIN NO YES YES YES

CatalogActivate PLUGIN NO YES NO NO

CatalogBuildIndex PLUGIN NO YES NO NO

CatalogGiveStatus PLUGIN NO YES NO NO

CatalogLoadIndex PLUGIN NO YES NO NO

CatalogPurgeIndex PLUGIN NO YES NO NO

ConsStackGetCount PLUGIN NO YES YES NO

ConsStackIndexGetArrayIndex PLUGIN NO YES YES NO

ConsStackIndexGetDictKey PLUGIN NO YES YES NO

ConsStackIndexGetObj PLUGIN NO YES YES NO

ConsStackIndexGetTypeAt PLUGIN NO YES YES NO

ConsStackIndexGetTypeCount PLUGIN NO YES YES NO

ConsStackIndexIsArray PLUGIN NO YES YES NO

ConsStackIndexIsDict PLUGIN NO YES YES NO

ConsultantCreate PLUGIN NO YES YES NO

ConsultantDestroy PLUGIN NO YES YES NO

ConsultantGetNumDirectVis- PLUGIN NO YES YES NO


ited
ConsultantGetNumIndi- PLUGIN NO YES YES NO
rectVisited
ConsultantGetNumUniqueIndi- PLUGIN NO YES YES NO
rectsVisited
ConsultantGetPercentDone PLUGIN NO YES YES NO

ConsultantNextObj PLUGIN NO YES YES NO

ConsultantRegisterAgent PLUGIN NO YES YES NO

Acrobat and PDF Library API Overview 679


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


ConsultantResume PLUGIN NO YES YES NO

ConsultantSetStart PLUGIN NO YES YES NO

ConsultantSuspend PLUGIN NO YES YES NO

ConsultantTraverseFrom PLUGIN NO YES YES NO

DigSigAddedSig PLUGIN NO YES YES YES

DigSigAddedSigEx PLUGIN NO YES YES YES

DigSigAPCreateLayeredStream PLUGIN NO YES YES YES

DigSigAPXObjectFromLogo PLUGIN NO YES YES YES

DigSigAPXObjectFromXObjList PLUGIN NO YES YES YES

DigSigByteToHex PLUGIN NO YES YES YES

DigSigClearSig PLUGIN NO YES YES YES

DigSigClearSigRefDict PLUGIN NO YES YES YES

DigSigClick PLUGIN NO YES YES YES

DigSigCommitSigRefDict PLUGIN NO YES YES YES

DigSigComparePages PLUGIN NO YES YES YES

DigSigComparePagesEx PLUGIN NO YES YES YES

DigSigCompareWords PLUGIN NO YES YES YES

DigSigCompareWordsAnd- PLUGIN NO YES YES YES


FontsRecent
DigSigCompareWordsEx PLUGIN NO YES YES YES

DigSigCompareWordsRecent PLUGIN NO YES YES YES

DigSigCosObjOverwrite PLUGIN NO YES YES YES

DigSigCosSign PLUGIN NO YES YES YES

DigSigCreateStdXObj PLUGIN NO YES YES YES

DigSigDeletedSig PLUGIN NO YES YES YES

DigSigDeletedSigEx PLUGIN NO YES YES YES

DigSigDocModifiedAfterSig PLUGIN NO YES YES YES

680 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


DigSigDoProperties PLUGIN NO YES YES YES

DigSigDraw PLUGIN NO YES YES YES

DigSigEnumSignatures PLUGIN NO YES YES YES

DigSigFileGetEOF PLUGIN NO YES YES YES

DigSigFileRead PLUGIN NO YES YES YES

DigSigFileSetPos PLUGIN NO YES YES YES

DigSigFinishSigRefDict PLUGIN NO YES YES YES

DigSigGetDocAuthorSignature PLUGIN NO YES YES YES

DigSigGetDocMDPSetting PLUGIN NO YES YES YES

DigSigGetStdXObj PLUGIN NO YES YES YES

DigSigGetUbiquitySig PLUGIN NO YES YES YES

DigSigGetUniqueTitle PLUGIN NO YES YES YES

DigSigHexToByte PLUGIN NO YES YES YES

DigSigIsDocSigned PLUGIN NO YES YES YES

DigSigIsSigSigned PLUGIN NO YES YES YES

DigSigKeyDown PLUGIN NO YES YES YES

DigSigMD5ByteRange PLUGIN NO YES YES YES

DigSigNewSigRefDict PLUGIN NO YES YES YES

DigSigOverwriteBytes PLUGIN NO YES YES YES

DigSigOverwriteHexstring PLUGIN NO YES YES YES

DigSigOverwriteIntArray PLUGIN NO YES YES YES

DigSigRegisterFilter PLUGIN NO YES YES YES

DigSigRegisterObserver PLUGIN NO YES YES YES

DigSigRightClick PLUGIN NO YES YES YES

DigSigRollbackToSig PLUGIN NO YES YES YES

DigSigSignDoc PLUGIN NO YES YES YES

Acrobat and PDF Library API Overview 681


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


DigSigUnregisterFilter PLUGIN NO YES YES YES

DigSigUnregisterObserver PLUGIN NO YES YES YES

DigSigUpdatePanel PLUGIN NO YES YES YES

DigSigVerifySig PLUGIN NO YES YES YES

DigSigVerifySigRefDict PLUGIN NO YES YES YES

DSAPFileAcquire PLUGIN NO YES YES YES

DSAPFileCanDeleteNthEntry PLUGIN NO YES YES YES

DSAPFileCopyNthEntry PLUGIN NO YES YES YES

DSAPFileEditNthEntry PLUGIN NO YES YES YES

DSAPFileGetCount PLUGIN NO YES YES YES

DSAPFileGetNewNthName PLUGIN NO YES YES YES

DSAPFileRelease PLUGIN NO YES YES YES

DSAPFileRemoveNthEntry PLUGIN NO YES YES YES

DSAPFileSave PLUGIN NO YES YES YES

EndWebProgress PLUGIN NO YES YES YES

ExportAsFDF PLUGIN NO YES YES YES

ExportAsFDFEx PLUGIN NO YES YES YES

ExportAsFDFWithParams PLUGIN NO YES YES YES

ExportAsHtml PLUGIN NO YES YES YES

ExportAsHtmlEx PLUGIN NO YES YES YES

GetAppSpecifier PLUGIN NO YES YES YES

ImportAnFDF PLUGIN NO YES YES YES

IsPDDocAcroForm PLUGIN NO YES YES YES

PDFObjTypeGetSuperclass PLUGIN NO YES YES NO

PSCertIssuedUnderTestCP PLUGIN NO YES YES YES

PSCloseEncryptedDocs PLUGIN NO YES YES YES

682 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


PSCountEncryptedDocs PLUGIN NO YES YES YES

PSDataBufferDigest PLUGIN NO YES YES YES

PSDataBufferEnum PLUGIN NO YES YES YES

PSExportDataExchange PLUGIN NO YES YES YES

PSImportDataExchange PLUGIN NO YES YES YES

PSRegisterHandler PLUGIN NO YES YES YES

PSSigValidateDoc PLUGIN NO YES YES YES

PSSigValidatePDDocSigField PLUGIN NO YES YES YES

PSUnregisterHandler PLUGIN NO YES YES YES

RegisterWebDriver PLUGIN NO YES YES YES

ResetForm PLUGIN NO YES YES YES

SearchAddIndex PLUGIN NO YES YES YES

SearchAddIndexEx PLUGIN NO YES YES YES

SearchCountIndexList PLUGIN NO YES YES YES

SearchExecuteQuery PLUGIN NO YES YES YES

SearchExecuteQueryEx PLUGIN NO YES YES YES

SearchGetIndexByPath PLUGIN NO YES YES YES

SearchGetIndexByPathEx PLUGIN NO YES YES YES

SearchGetIndexFileSys PLUGIN NO YES YES YES

SearchGetIndexFlags PLUGIN NO YES YES YES

SearchGetIndexList PLUGIN NO YES YES YES

SearchGetIndexPath PLUGIN NO YES YES YES

SearchGetIndexPathEx PLUGIN NO YES YES YES

SearchGetIndexTitle PLUGIN NO YES YES YES

SearchGetIndexTitleEx PLUGIN NO YES YES YES

SearchGetNthIndex PLUGIN NO YES YES YES

Acrobat and PDF Library API Overview 683


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


SearchIsLegacySearchAvail- PLUGIN NO YES YES YES
able
SearchRemoveIndex PLUGIN NO YES YES YES

SearchSetIndexFlags PLUGIN NO YES YES YES

SpellAddDictionary PLUGIN NO YES YES NO

SpellAddDomain PLUGIN NO YES YES NO

SpellAddWord PLUGIN NO YES YES NO

SpellCheck PLUGIN NO YES YES NO

SpellCheckRTF PLUGIN NO YES YES NO

SpellCheckText PLUGIN NO YES YES NO

SpellCheckWord PLUGIN NO YES YES NO

SpellCountKnownWords PLUGIN NO YES YES NO

SpellCustomDictionaryClose PLUGIN NO YES YES NO

SpellCustomDictionaryCreate PLUGIN NO YES YES NO

SpellCustomDictionaryDelete PLUGIN NO YES YES NO

SpellCustomDictionaryExport PLUGIN NO YES YES NO

SpellCustomDictionaryOpen PLUGIN NO YES YES NO

SpellDictionaryNames PLUGIN NO YES YES NO

SpellDomainNames PLUGIN NO YES YES NO

SpellGetDocDictionaryOrder PLUGIN NO YES YES NO

SpellGetLanguageOrder PLUGIN NO YES YES NO

SpellGetNextWord PLUGIN NO YES YES NO

SpellIgnoreAll PLUGIN NO YES YES NO

SpellLanguage PLUGIN NO YES YES NO

SpellRemoveDictionary PLUGIN NO YES YES NO

SpellRemoveDomain PLUGIN NO YES YES NO

SpellRemoveWord PLUGIN NO YES YES NO

684 Acrobat and PDF Library API Overview


Platform Support Provided by Each API
F

API Where? PDFL? Pro? Std? Rdr?


SpellSetDocDictionaryOrder PLUGIN NO YES YES NO

SpellSetLanguageOrder PLUGIN NO YES YES NO

SpellUserDictionaryOrder PLUGIN NO YES YES NO

SpellUserLanguageOrder PLUGIN NO YES YES NO

SpellUserWords PLUGIN NO YES YES NO

UpdateWebProgress PLUGIN NO YES YES YES

WebProgressDidCancel PLUGIN NO YES YES YES

WLCreateOrDeleteWebLinks PLUGIN NO YES YES YES

WWWOpenURL PLUGIN NO YES YES YES

WWWOpenURLWithParams PLUGIN NO YES YES YES

Acrobat and PDF Library API Overview 685


Platform Support Provided by Each API
F

686 Acrobat and PDF Library API Overview


G API Changes

This appendix summarizes changes to the API in the following versions:


Version 2.1
Version 3.0
Version 3.01
Adobe PDF Library, Version 1.0
Version 4
Version 5
Version 6
Version 7
NOTE: With version 7, the Acrobat Core API Reference, PDF Library Supplement to the Acrobat
Core API Reference, AcroColor API Reference, Catalog API Reference, Digital Signature
API Reference, Forms API Reference, PDF Consultant Accessibility Checker, Search API
Reference, Spelling API Reference, and Weblink API Reference ceased to exist. All API
documentation previously contained within those documents was moved to the
header files. Whatever was not moved was folded into this document, including the
list of API changes to the Acrobat Core API Reference (this foundation for this
appendix). Therefore, for versions 2.1 - 6, the information in this appendix applies
only to the APIs that were documented in the Acrobat Core API Reference. For version
7, the API changes listed are comprehensive: all API changes that occurred to the
core API, extended API, and PDF Library are summarized. Detailed documentation
for all APIs can be found in Acrobat and PDF Library API Reference.

Version 2.1
Methods
The following methods were added in version 2.1.
Available only if PI_ACROVIEW_VERSION (in PIRequir.h) is set to 0x00020001 or
higher.
AVDocGetClientName
AVDocGetPageText
AVDocSetClientName
Available only if PI_PDMODEL_VERSION (in PIRequir.h) is set to 0x00020001 or
higher.

Acrobat and PDF Library API Overview 687


API Changes
G
Version 3.0

PDDocClearFlags
PDDrawCosObjToWindow
PDPageNotifyContentsDidChangeEx
Errors
The following errors were added in version 2.1.
xmErrPluginLoadFailed
xmErrNotPrivileged
xmErr68KOnly
xmErrPPCOnly
avErrNoText
Notifications
The following notifications were added in version 2.1.
PDPageContentsDidChangeEx

Version 3.0
Objects
The following object was added in version 3.0.
PDTrans
Methods
The following methods were added in version 3.0.
Available only if PI_ACROSUPPORT_VERSION (in PIRequir.h) is set to 0x00020002 or
higher.
ASFileFromMDFile
ASFileGetFileSysByName
ASFileGetMDFile
ASFilePushData
ASFileRegisterFileSys
ASFileSetMode
ASFileSysAcquireFileSysPath
ASFileSysCreatePathName
ASFileUnregisterFileSys
Available only if PI_ACROVIEW_VERSION (in PIRequir.h) is set to 0x00020002 or
higher.
AVAppEnumTransHandlers
AVAppGetTransHandlerByType
AVAppHandlePlatformEvent

688 Acrobat and PDF Library API Overview


API Changes
G
Version 3.0

AVAppRegisterTransHandler
AVAuthOpen
AVDocDoActionPropsDialog
AVDocDoSaveAs
AVDocGetViewDef
AVDocIsExternal
AVDocOpenFromASFileWithParamString
AVDocPrintPagesWithParams
AVDocSendAuxData
AVDocSetDead
AVDocSetViewDef
AVHasAuxDataHandler
AVPageViewDrawCosObj
AVPageViewGetFirstVisiblePageNum
AVPageViewGetLastVisiblePageNum
AVPageViewGetLayoutMode
AVPageViewGetNextView
AVPageViewGetSelectedAnnotPageNum
AVPageViewHighlightText
AVPageViewInsetRect
AVPageViewInvalidateText
AVPageViewPageNumIsVisible
AVPageViewPointInText
AVPageViewSetLayoutMode
AVPageViewTrackText
AVPageViewSetPageNum
AVPageViewUseThisDestination
AVRegisterAuxDataHandler
AVToolButtonSetExternal
AVToolButtonSetHelpText
AVUnregisterAuxDataHandler
AVWindowGetCursorAtPoint
AVWindowHandlePlatformEvent
Available only if PI_MACINTOSH_VERSION (in PIRequir.h) is set to 0x00020002 or
higher.
AVAppEnumSystemFonts
Available only if PI_COS_VERSION (in PIRequir.h) is set to 0x00020002 or higher.
CosDocClose
CosDocCreate
CosDocOpenWithParams
CosDocSaveToFile
CosDocSetDirty

Acrobat and PDF Library API Overview 689


API Changes
G
Version 3.0

Available only if PI_PDMODEL_VERSION (in PIRequir.h) is set to 0x00020002 or


higher.
PDDocGetCryptHandlerClientData
PDDocGetFullScreen
PDDocOpenEx
PDDocOpenFromASFile
PDDocOpenFromASFileEx
PDDocReadAhead
PDDocSaveWithParams
PDDocSetFullScreen
PDFileSpecGetDoc
PDFileSpecGetFileSysName
PDNameTreeLookup
PDPageGetDuration
PDPageGetTransition
PDPageHasTransition
PDPageSetDuration
PDPageSetTransition
PDPageStmGetInlineImage
PDPageStmGetToken
PDRegisterCryptHandlerEx
PDRegisterFileSpecHandlerByName
PDTransEqual
PDTransFromCosObj
PDTransGetCosObj
PDTransGetDuration
PDTransGetSubtype
PDTransNew
PDTransNewFromCosDoc
PDTransNull
PDTransIsValid
PDViewDestResolve
Available only if PI_WIN_VERSION (in PIRequir.h) is set to 0x00020000 or higher.
WinAppEnableIdleTimer
WinAppGetModalParent
WinAppGetPalette
WinAppRegisterModelessDialog
WinAppUnRegisterModelessDialog
The following methods were added to the Acrobat Toolkit.
ASGetErrorString
ASfree
ASmalloc

690 Acrobat and PDF Library API Overview


API Changes
G
Version 3.0

ASrealloc
CosDictPut
CosDictRemove
CosNewString
PDDocAuthorize
PDDocCreate
PDDocInsertPages
PDDocSaveWithParams
PDFontAcquireXlateTable
PDFontXlateTableRelease
PDFontXlateString
PDFontXlateWidths
PDPageGetDoc
PDRegisterCryptHandler
PDXlateToPDFDocEnc
The following methods are now replaceable.
AVDocDoSaveAs
AVPageViewGetNextView
PDDocSave
PDDocSaveWithParams
Callbacks
The following callbacks were added in version 3.0.
ASFileCompletionProc
ASFileSysAcquireFileSysPathProc
ASFileSysAsyncAbortProc
ASFileSysAsyncReadProc
ASFileSysAsyncWriteProc
ASFileSysClearOutstandingMReadsProc
ASFileSysCreatePathNameProc
ASFileSysGetFileFlags
ASFileSysGetStatusProc
ASFileSysMReadRequestProc
ASFileSysYieldProc
ASIODoneProc
ASMemFreeProc
AVAnnotHandlerCursorEnterProc
AVAnnotHandlerCursorExitProc
AVAuxDataPerformProc
AVTransHandlerCompleteTransDictProc
AVTransHandlerDoPropertiesProc
AVTransHandlerEnumProc
AVTransHandlerExecuteProc

Acrobat and PDF Library API Overview 691


API Changes
G
Version 3.0

AVTransHandlerGetButtonTextProc
AVTransHandlerGetInstructionsProc
AVTransHandlerGetStringOneTextProc
AVTransHandlerGetStringTwoTextProc
AVTransHandlerGetTypeProc
AVTransHandlerGetItemUINameProc
AVTransHandlerGetUINameProc
AVTransHandlerInitTransDictProc
PDAuthProcEx
PDCryptFreeAuthDataProc
PDCryptFreeSecurityDataProc
PDLaunchActionProc
PDPageStmImageDataProc
PDPageStmStringOverflowProc
Data
The following data structures were added in version 3.0.
ASFile Flags
ASFileMode (ASFILE_SERIAL and ASFILE_LOCAL)
ASFileStatus Flags
ASFileSysRec (significantly expanded)
ASIORequest
ASPlatformPrinterSpec
AVAnnotHandler (new callbacks)
AVAuxDataHandler
AVDocOpenParams (significantly expanded)
AVDocPrintParams
AVDocViewDef
AVPrefsType (significantly expanded)
AVSystemFont
AVSystemFont Flags
AVTransHandler
AVTransitionPort
CosDocOpenParams
CosDocSaveFlags
CosDocSaveParams
Emit Font Options
Emit Flags
Page Specification
PDCryptHandler (new callbacks)
PDDocReadAhead Flags
PDLayoutMode
PDPageStmToken
Predefined Cursors (cursors added)

692 Acrobat and PDF Library API Overview


API Changes
G
Version 3.0

Tool Button Flags


Transition Duration
Errors
The following error system was added in version 3.0.
ErrSysXtnMgr
The following errors were added in version 3.0.
cfMacGenPSErr
cfMaciPrSavPFil
cfMacServerLostConnection
cosErrBadIndex
cosErrCancelSave
cosErrOldLinFormat
cosErrTempTooShort
cosSynErrBadLinearized
fileErrBytesNotReady
fileErrUserRequestedStop
fileErrIOTimeout
fsErrBadParameter
fsErrDownloadAborted
fsErrDownloadFailed
pageErrBadColorSpace
pageErrBadEGS
pageErrBadPattern
pageErrEGStateNotFound
pageErrMissingKey
pageErrMissingResource
pageErrPatternNotFound
pageErrPatternTypeNotAvailable
pdErrATMMemory
pdErrBadCMap
pdErrCancelSave
pdErrCannotReopenDoc
pdErrOldATMVersion
pdErrOptMemory
pdErrTextStringTooShort
pdErrZeroPageFile
Notifications
The following notifications were added in version 3.0.
Available only if PI_ACROVIEW_VERSION (in PIRequir.h) is set to 0x00020002 or
higher.

Acrobat and PDF Library API Overview 693


API Changes
G
Version 3.0

AVDocDidAddToSelection
AVDocWantsToDie
AVDocWillOpenFromPDDoc
PDDocWillPrintDoc
PDDocWillSaveEx
Miscellaneous
Values of some types in methods, callbacks, and data have been changed for improved
cross-platform portability.

Previous name New name

boolean ASBool
Int8 ASInt8
Int16 ASInt16
Int32 ASInt32
Uns8 ASUns8
Uns16 ASUns16
Uns32 ASUns32

694 Acrobat and PDF Library API Overview


API Changes
G
Version 3.0

Version 3.0J
Methods
The following methods were added in version 3.0J.
Available only if PI_PDMODEL_VERSION (in PIRequir.h) is set to 0x00020003 or
higher.
PDGetHostEncoding
PDHostMBLen
PDXlateToHostEx
PDXlateToPDFDocEncEx
PDDocCreateWordFinderUCS
PDFontGetCIDSystemInfo
PDFontGetCIDSystemSupplement
PDFontGetDescendant
PDFontGetEncodingName
PDFontXlateToHost
PDFontXlateToUCS
The following methods have new behavior in version 3.0J.
PDWordFilterString
PDWordGetString
PDWordSplitString

Acrobat and PDF Library API Overview 695


API Changes
G
Version 3.01

Ver s i o n 3 . 0 1
Methods
The following methods were added in version 3.01.
Available only if PI_ACROVIEW_VERSION (in PIRequir.h) is set to 0x00020003 or
higher.
AVDestInfoDestroy
AVDocCopyAction
AVDocCopyActionCommon
AVDocCopyAdditionalActions
AVDocCopyAnnot
AVDocCopyAnnotCommon
AVDocDoCopyAs
AVPageViewDrawCosObjEx
AVPageViewToDestInfo
AVPageViewUseDestInfo
Callbacks
The following callbacks were added in version 3.01.
AVActionCopyProc
AVAnnotHandlerCopyProc
CrossDocLinkWithDestProc
Data
The following data structures were added or changed in version 3.01.
AVAnnotHandler (new flag)
AVDestInfo
Emit Font Options (obsoleted and new flags)
ExternalDocServerCreationData (new callback and data)
Errors
The following errors were added in version 3.01.
avErrBadActionCopy
avErrBadAnnotationCopy

696 Acrobat and PDF Library API Overview


API Changes
G
Adobe PDF Library, Version 1.0

Adobe PDF Li brar y, Version 1.0


All API elements listed here are available only if the Adobe PDF Library Version is 1.0 or later.
This version adds the PDFEdit methods.
Objects
The following objects were added for PDFEdit.
PDEClip
PDEColorSpace
PDEContainer
PDEContent
PDEElement
PDEExtGState
PDEFont
PDEForm
PDEImage
PDEObject
PDEPath
PDEPattern
PDEPlace
PDEText
PDEXObject
PDSysFont
Methods
The following methods were added for the Adobe PDF Library.
PDDocPrintPages
PDFLInit
PDFLPrintDoc
PDFLTerm
AVExtensionMgrRegisterNotification
AVExtensionMgrUnregisterNotification
PDSetHostEncoding
The following methods were added for PDFEdit.
PDELogDump
PDEObjectDump
PDEAttrEnumTable
PDEDefaultGState
PDEEnumElements
PDEMergeResourcesDict
PDEClipAddElem
PDEClipCreate

Acrobat and PDF Library API Overview 697


API Changes
G
Adobe PDF Library, Version 1.0

PDEClipGetElem
PDEClipGetNumElems
PDEClipRemoveElems
PDEColorSpaceCreate
PDEColorSpaceCreateFromName
PDEColorSpaceGetBase
PDEColorSpaceGetBaseNumComps
PDEColorSpaceGetCosObj
PDEColorSpaceGetCTable
PDEColorSpaceGetHiVal
PDEColorSpaceGetName
PDEColorSpaceGetNumComps
PDEContainerCreate
PDEContainerGetContent
PDEContainerGetDict
PDEContainerGetMCTag
PDEContainerSetContent
PDEContainerSetDict
PDEContainerSetMCTag
PDEContentAddElem
PDEContentCreate
PDEContentCreateFromCosObj
PDEContentGetAttrs
PDEContentGetElem
PDEContentGetNumElems
PDEContentGetResources
PDEContentRemoveElem
PDEContentToCosObj
PDEElementCopy
PDEElementGetBBox
PDEElementGetClip
PDEElementGetGState
PDEElementGetMatrix
PDEElementSetGState
PDEElementSetMatrix
PDEExtGStateCreate
PDEExtGStateGetCosObj
PDEFontCreate
PDEFontCreateFromCosObj
PDEFontCreateFromSysFont
PDEFontCreateWithParams
PDEFontGetCosObj
PDEFontGetNumCodeBytes

698 Acrobat and PDF Library API Overview


API Changes
G
Adobe PDF Library, Version 1.0

PDEFontSubsetNow
PDFindSysFontForPDEFont
PDEShadingCreateFromCosObj
PDEFormGetContent
PDEFormGetCosObj
PDEImageCreate
PDEImageCreateFromCosObj
PDEImageDataIsEncoded
PDEImageGetAttrs
PDEImageGetColorSpace
PDEImageGetCosObj
PDEImageGetData
PDEImageGetDataLen
PDEImageGetDataStm
PDEImageGetFilterArray
PDEImageIsCosObj
PDEImageSetData
PDEImageSetDataStm
PDEAcquire
PDEAddTag
PDEGetTag
PDEObjectGetType
PDERelease
PDERemoveTag
PDEPathAddSegment
PDEPathCreate
PDEPathGetData
PDEPathGetPaintOp
PDEPathSetData
PDEPathSetPaintOp
PDEPatternCreate
PDEPatternGetCosObj
PDEPlaceCreate
PDEPlaceGetDict
PDEPlaceGetMCTag
PDEPlaceSetDict
PDEPlaceSetMCTag
PDETextAdd
PDETextCreate
PDETextGetAdvanceWidth
PDETextGetBBox
PDETextGetFont
PDETextGetGState

Acrobat and PDF Library API Overview 699


API Changes
G
Adobe PDF Library, Version 1.0

PDETextGetNumBytes
PDETextGetNumRuns
PDETextGetQuad
PDETextGetRunForChar
PDETextGetStrokeMatrix
PDETextGetText
PDETextGetTextMatrix
PDETextGetTextState
PDETextIsAtPoint
PDETextReplaceChars
PDETextRunGetCharOffset
PDETextRunGetNumChars
PDETextRunSetFont
PDETextRunSetGState
PDETextRunSetStrokeMatrix
PDETextRunSetTextMatrix
PDETextRunSetTextState
PDETextSplitRunAt
PDEXObjectCreate
PDEXObjectGetCosObj
PDEnumSysFonts
PDFindSysFont
PDPageAcquirePDEContent
PDPageGetPDEContentFilters
PDPageGetPDEContentFlags
PDPagePDEContentWasChanged
PDPageRegisterForPDEContentChanged
PDPageRegisterForPDEContentNotCached
PDPageReleasePDEContent
PDPageSetPDEContent
PDPageSetPDEContentFilters
PDPageSetPDEContentFlags
PDPageSuspendPDEContentChanged
PDPageUnRegisterForPDEContentNotCached
PDSysFontAcquirePlatformData
PDSysFontGetEncoding
PDSysFontGetInfo
PDSysFontGetName
PDSysFontGetType0Widths
Callbacks
The following callbacks were added for PDFEdit.

700 Acrobat and PDF Library API Overview


API Changes
G
Adobe PDF Library, Version 1.0

PDEAttrEnumProc
PDEElementEnumProc
PDEObjectDumpProc
PDSysFontEnumProc
Data
The following data structures were added, mostly for PDFEdit.
PDFLData (for Adobe PDF Library)
PDEColorSpec
PDEColorValue
PDEContentAttrs
PDEContentFlags
PDEContentToCosObjFlags
PDEDash
PDEElementCopyFlags
PDEEnumElementsFlags
PDEFilterArray
PDEFilterSpec
PDEFontAttrs
PDEFontCreateFlags
PDEFontInfoP
PDEGraphicStateP
PDEGraphicStateWasSetFlags
PDEImageAttrFlags
PDEImageAttrs
PDEImageDataFlags
PDEPathElementType
PDEPathOpFlags
PDETextFlags
PDETextRenderMode
PDETextState
PDETextStateWasSetFlags
PDEType
PDSysFontMatchFlags
Notifications
The following notifications were added for PDFEdit.
PagePDEContentDidChange
PagePDEContentNotCached

Acrobat and PDF Library API Overview 701


API Changes
G
Version 4

Ver s i o n 4
Objects
The following objects were added in version 4.0.
ASExtension
PDEDeviceNColors
PDEGroup
PDEShading
PDEUnknown
PDNameTree
PDNumTree
PDPageLabel
PDSAttrObj
PDSClassMap
PDSElement
PDSMC
PDSRoleMap
PDSTreeRoot
Methods
The following methods were obsoleted in version 4.0.
PDPageEnumContents
PDPageEnumResources
The following methods were added in version 4.0.
Available only if PI_ACROSUPPORT_VERSION (in PIRequir.h) is set to 0x00040000 or
higher.
ASEnumExtensions
ASExtensionGetFileName
ASExtensionGetRegisteredName
ASFileStmWrOpen
ASProcStmWrOpen
HFTIsValid
Available only if PI_ACROVIEW_VERSION (in PIRequir.h) is set to 0x00040000 or
higher.
AVAnnotHandlerDeleteInfo
AVAnnotHandlerGetInfo
AVAppHandlePlatformEvent
AVAppOpenHelpFile
AVDocAlert
AVDocAlertConfirm
AVDocAlertNote

702 Acrobat and PDF Library API Overview


API Changes
G
Version 4

AVDocAlertYesNo
AVDocDoCopyAs
AVDocDoPrint
AVDocDoSaveAsWithParams
AVDocIsReadOnly
AVDocSelectionEnumPageRanges
AVDocSetReadOnly
AVMenuIsHiddenOnMenubar
AVMenubarAddHiddenMenu
AVPageViewAppearanceGetAVMatrix
AVPageViewDeviceRectToPageRZ
AVPageViewDoPopupMenu
AVPageViewDrawAnnotSequence
AVPageViewGetGrayRect
AVPageViewGetVisibleAnnotPage
AVPageViewInvertQuad
AVPageViewShowControl
AVPageViewTransformRectRZ
AVSysAllocTimeStringFromTimeRec
AVToolBarNewFlyout
AVToolButtonGetFlyout
AVToolButtonGetIcon
AVToolButtonGetMenu
AVToolButtonSetFlyout
AVToolButtonSetIcon
AVToolButtonSetMenu
AVWindowHandlePlatformEvent
Available only if PI_ACROVIEW_VERSION (in PIRequir.h) is set to 0x00040005 or
higher.
AVAppRegisterForPageViewKeyDown
AVAppUnregisterForPageViewKeyDown
Available only if PI_COS_VERSION (in PIRequir.h) is set to 0x00040000 or higher.
CosArrayRemoveNth
CosDocEnumEOFs
CosDocEnumIndirect
CosDocGetObjByID
CosDocSaveWithParams
CosObjCopy
CosObjGetGeneration
CosObjGetID
CosObjHash

Acrobat and PDF Library API Overview 703


API Changes
G
Version 4

CosStringGetHexFlag
CosStringSetHexFlag
Available only if PI_COS_VERSION (in PIRequir.h) is set to 0x00040005 or higher.
CosCryptGetVersion
CosDecryptGetMaxKeyBytes
CosEncryptGetMaxKeyBytes
Available only if PI_PDMODEL_VERSION (in PIRequir.h) is set to 0x00040000 or
higher.
PDDocCreateNameTree
PDDocCreateStructTreeRoot
PDDocEnumOCGs
PDDocExportNotes
PDDocFindPageNumForLabel
PDDocFromCosDoc
PDDocGetLabelForPageNum
PDDocGetNameTree
PDDocGetPageLabel
PDDocGetStructTreeRoot
PDDocImportCosDocNotes
PDDocImportNotes
PDDocOpenWithParams
PDDocReadAheadPages
PDDocRemoveNameTree
PDDocRemovePageLabel
PDDocRemoveStructTreeRoot
PDDocSetPageLabel
PDFontFromCosObj
PDGetAnnotHandlerByName
PDImageSelectAlternate
PDImageSelAdjustMatrix
PDImageSelGetDeviceAttr
PDImageSelGetGeoAttr
PDNameTreeEnum
PDNameTreeEqual
PDNameTreeFromCosObj
PDNameTreeGet
PDNameTreeGetCosObj
PDNameTreeIsValid
PDNameTreeNew
PDNameTreePut
PDNameTreeRemove
PDPageGetAnnotSequence

704 Acrobat and PDF Library API Overview


API Changes
G
Version 4

PDPageLabelEqual
PDPageLabelFromCosObj
PDPageLabelGetCosObj
PDPageLabelGetPrefix
PDPageLabelGetStart
PDPageLabelGetStyle
PDPageLabelIsValid
PDPageLabelNew
PDRegisterAnnotHandler
The following methods were added for the Adobe PDF Library.
ASAtomGetCount
ASPurgeMemory
PDFLPrintDoc
The following methods were added for Placed PDF, which is part of the Adobe PDF Library.
AGMCleanup
AGMClip
AGMClosePath
AGMConcat
AGMDeletePort
AGMDeleteRasterDev
AGMFill
AGMInit
AGMLineTo
AGMMoveTo
AGMNewBitmapPort
AGMNewPath
AGMNewRasterDev
AGMNewRasterPort
AGMNewWindowPort
AGMSetAntiAliasPolicy
AGMSetRGBColor
CCSetSystemCalibration
PDDocPrintPages
PDFontDownloadContextCreate
PDFontDownloadContextDestroy
PDFontStreamPS
PDFontWasExtracted
PDFontWasFauxed
PDFreeMemory
PDPageDrawContents
PDPageDrawContentsPlaced

Acrobat and PDF Library API Overview 705


API Changes
G
Version 4

PDPageDrawContentsPlacedToWindow
PDPageEmitPSOrient
The following methods were added for PDFEdit.
Available only if PI_PDFEDIT_READ_VERSION (in PIRequir.h) is set to 0x00040000
or higher.
PDEClipFlattenedEnumElems
PDEContentGetDefaultColorSpace
PDEDeviceNColorsGetColorValue
PDEElementIsAtPoint
PDEElementIsAtRect
PDEFontGetNumCodeBytes
PDEFontGetOneByteEncoding
PDEFontIsMultiByte
PDEFontSumWidths
PDEGroupGetContent
PDEImageGetDecodeArray
PDETextGetNumBytes
PDETextIsAtPoint
PDETextIsAtRect
Available only if PI_PDFEDIT_WRITE_VERSION (in PIRequir.h) is set to
0x00040000 or higher.
PDEClipAddElem
PDEClipCopy
PDEClipCreate
PDEColorSpaceCreate
PDEDeviceNColorsCreate
PDEFontCreateFromSysFontEx
PDEFontCreateWithParams
PDEGroupCreate
PDEGroupSetContent
PDEImageSetDecodeArray
PDEPurgeCache
PDEShadingCreateFromCosObj
PDEUnknownGetOpName
Available only if PI_PDSYSFONT_VERSION (in PIRequir.h) is set to 0x00040000 or
higher.
PDEmbedSysFontForPDEFont
PDFindSysFontEx
PDSysFontAcquirePlatformData
PDSysFontGetCIDSystemInfo
PDSysFontGetType0Widths

706 Acrobat and PDF Library API Overview


API Changes
G
Version 4

PDSysFontGetWidthsEx
PDSysFontReleasePlatformData
The following methods were added for PDS (Structure level).
Available only if PI_PDS_READ_VERSION (in PIRequir.h) is set to 0x00040000 or
higher.
PDSAttrObjGetOwner
PDSClassMapGetAttrObj
PDSClassMapGetNumAttrObjs
PDSElementGetAlt
PDSElementGetAttrObj
PDSElementGetClass
PDSElementGetFirstPage
PDSElementGetID
PDSElementGetKid
PDSElementGetNumAttrObjs
PDSElementGetNumClasses
PDSElementGetNumKids
PDSElementGetParent
PDSElementGetRevision
PDSElementGetStructTreeRoot
PDSElementGetTitle
PDSElementGetType
PDSMCGetInfo
PDSOBJGetParent
PDSRoleMapDoesMap
PDSRoleMapGetDirectMap
PDSTreeRootGetClassMap
PDSTreeRootGetElementFromID
PDSTreeRootGetKid
PDSTreeRootGetNumKids
PDSTreeRootGetRoleMap
Available only if PI_PDS_WRITE_VERSION (in PIRequir.h) is set to 0x00040000 or
higher.
PDSAttrObjCreate
PDSAttrObjCreateFromStream
PDSClassMapAddAttrObj
PDSClassMapRemoveAttrObj
PDSClassMapRemoveClass
PDSElementAddAttrObj
PDSElementAddClass
PDSElementClearID
PDSElementCreate

Acrobat and PDF Library API Overview 707


API Changes
G
Version 4

PDSElementIncrementRevision
PDSElementInsertKid
PDSElementInsertMCAsKid
PDSElementInsertOBJAsKid
PDSElementRemoveAttrObj
PDSElementRemoveAllAttrObjs
PDSElementRemoveAllClasses
PDSElementRemoveClass
PDSElementRemoveKid
PDSElementRemoveKidMC
PDSElementReplaceKid
PDSElementReplaceKidMC
PDSElementReplaceKidOBJ
PDSElementSetAlt
PDSElementSetID
PDSElementSetTitle
PDSElementSetType
PDSRoleMapCopy
PDSRoleMapMap
PDSRoleMapUnMapDst
PDSRoleMapUnMapSrc
PDSTreeRootCreateClassMap
PDSTreeRootCreateRoleMap
PDSTreeRootInsertKid
PDSTreeRootRemoveClassMap
PDSTreeRootRemoveKid
PDSTreeRootRemoveRoleMap
PDSTreeRootReplaceKid
Available only if PI_WIN_VERSION (in PIRequir.h) is set to 0x00040000 or higher.
WinAppGetPrinterHDC
The following methods are now replaceable.
AVDocDoPrint
AVDocDoSaveAsWithParams
AVDocPrintPages
AVDocPrintPagesWithParams
PDImageSelectAlternate
Callbacks
The following callbacks were added in version 4.0.
ASExtensionEnumProc
ASProcStmDestroyProc
ASStmProc

708 Acrobat and PDF Library API Overview


API Changes
G
Version 4

AVAnnotHandlerDeleteInfoProc
AVAnnotHandlerGetInfoProc
AVDocSelectionEnumPageRangesProc
AVDocSelectionGetSelectionTypeProc
AVPageViewKeyDownProc
AVSelectionPageRangeEnumProc
AVWindowDestroyPlatformThingProc
CosDocEnumEOFsProc
CosObjOffsetProc
CosObjSetCallbackFlagProc
DoClickProcType
DoLeaveProcType
GetSelectionServerProcType
PDAnnotHandlerDeleteAnnotInfoProc
PDAnnotHandlerGetAnnotInfoFlagsProc
PDAnnotHandlerGetAnnotInfoProc
PDAnnotHandlerGetTypeProc
PDAnnotWillPrintProc
PDCryptNewCryptDataExProc
PDDocPreSaveProc
PDDocWillExportAnnotCallback
PDDocWillExportAnnotProc
PDDocWillImportAnnotCallback
PDDocWillImportAnnotProc
PDEClipEnumProc
PIExportHFTsProcType
PIHandshake
PIImportReplaceAndRegisterProcType
PIInitProcType
PIUnloadProcType
The following callbacks were added for the Adobe PDF Library.
ASMemAllocProc
ASMemAvailProc
ASMemFreeProc
ASMemReallocProc
PDFLPrintCancelProc
TKResourceAcquireProc
TKResourceReleaseProc
The following callbacks were added for Placed PDF, which is part of the Adobe PDF Library.
AGMMemAllocator
AGMMemDeleter
AGMPortDestructProcPtr

Acrobat and PDF Library API Overview 709


API Changes
G
Version 4

DoCancel
DocBegin
DocEnd
DocSetup
EmitPageContents
EmitPrologString
EmitPSFontBegin
EmitPSFontEncodingBegin
EmitPSFontEncodingEnd
EmitPSFontEnd
EmitPSResourceBegin
EmitPSResourceEnd
EndSetup
FlushString
GetFontVMUsage
NotifyNewPage
PageBegin
PageEnd
PageSetup
PDPrintCanEmitFontProc
PDPrintEmitFontProc
PDPrintEmitPrologResourceProc
PDPrintGetFontEncodingMethodProc
Data
The following data structures were added in version 4.0.
AGMBlackPointFlt
AGMColorRangeFlt
AGMGrayCalFlt
AGMLabCalFlt
AGMRGBCalFlt
AGMWhitePointFlt
AGMXYZColorFlt
AVAnnotHandler
AVAnnotHandlerInfo
AVDocSaveParams
AVIcon
AVPageViewControlID
PDAnnotHandler
PDAnnotInfo
PDDocCopyParams
PDDocOpenParams
PDDocPreSaveInfo
PDEColorSpaceStruct
PDEDeviceNColorData

710 Acrobat and PDF Library API Overview


API Changes
G
Version 4

PDEFontCreateParams
PDEGrayCalFlt
PDEICCBasedColorData
PDEIndexedColorData
PDELabCalFlt
PDEPatternColorSpace
PDERGBCalFlt
PDESeparationColorData
PDFLPrintUserParamsRec (for Adobe PDF Library)
PDFontStyles
PDPageDrawFlags
PIHandshakeData_V0200
StdPassword
StdSecurityData
TKAllocatorProcs (for Adobe PDF Library)
TKResourceProcs (for Adobe PDF Library)
The following data structures were added for Placed PDF, which is part of the Adobe PDF
Library.
AGMCMYKColorRec
AGMColorTab
AGMFixedMatrix
AGMFixedPoint
AGMImageAlphaRecord
AGMInt16Rect
AGMLABColorRec
AGMMemObj
AGMRGBColorRec
PDPageDrawFlags
PDPrintClient
Errors
The following errors were added in version 4.0.
avErrActionExternal
avErrActionFullScreen
avErrActionRestricted
avErrCantOpenDialog
avErrCantOpenPrinting
pageErrBadEPSColorSpace
pageErrBadFunction
pageErrInvalidImageMaskDepth
pdErrCannotMergeWithSubsetFonts
pdErrHostEncodingNotSet
pdErrNoPDDocForCosDoc
ErrSysRaster

Acrobat and PDF Library API Overview 711


API Changes
G
Version 4

peErrCantCreateFontSubset
peErrCantEmbedFont
peErrCantGetAttrs
peErrCantGetWidths
peErrCantReadImage
peErrFontToEmbedNotOnSys
peErrNoError
peErrPStackUnderflow
peErrUnknownPDEColorSpace
peErrUnknownResType
peErrWrongPDEObjectType
Notifications
The following notifications were added in version 4.0.
AVAppWillCloseAllInternalDocs
AVDocDidClickName
AVDocDidPrint
AVDocWillPrint
PDBookmarkDidUnlink
PDDocDidClose
PDDocDidExportAnnots
PDDocDidImportAnnots
PDDocDidInsertPagesEx
PDDocPageLabelDidChange
PDDocWillClose
PDDocWillExportAnnots
PDDocWillImportAnnots
PDDocWillInsertPagesEx
PDNameTreeNameAdded
PDNameTreeNameRemoved
PSPrintAfterBeginPageSetup
PSPrintAfterBeginProlog
PSPrintAfterBeginSetup
PSPrintAfterEmitExtGState
PSPrintAfterPageTrailer
PSPrintAfterTrailer
PSPrintBeforeEndComments
PSPrintBeforeEndSetup

712 Acrobat and PDF Library API Overview


API Changes
G
Version 5

Ver s i o n 5
Objects
The following objects were added in version 5.0.
ASCab
ASText
AVCommand
AVSweetPea
PDEBeginContainer
PDEBeginGroup
PDEEndContainer
PDEEndGroup
PDEPS
PDESoftMask
PDEXGroup
PDSysEncoding
Modifed Objects
The following objects were modified in version 5.0.
PDWord
Methods
The following methods were deprecated in version 5.0.
ASPathFromPlatformPath
AVToolBarGetFrame
The following method was deleted in version 5.0.
AVAppWindowHandlePlatformEvent
The following method UNIX-specific method was added in version 5.0.
UnixMachinePortGetOffscreenPixmap
The following methods were added or modified in version 5.0.
Available only if PI_ASEXTRA_VERSION (in PIRequir.h) is set to 0x00050000 or
higher.
ASCabCopy
ASCabDestroy
ASCabDestroyEmpties
ASCabDetachBinary
ASCabDetachCab
ASCabDetachPathName
ASCabDetachPointer
ASCabDetachString

Acrobat and PDF Library API Overview 713


API Changes
G
Version 5

ASCabDetachText
ASCabDup
ASCabEnum
ASCabEqual
ASCabFromEntryList
ASCabGetAtom
ASCabGetBinary
ASCabGetBinaryCopy
ASCabGetBool
ASCabGetCab
ASCabGetDouble
ASCabGetInt
ASCabGetPathNameCopy
ASCabGetPointer
ASCabGetPointerDestroyProc
ASCabGetPointerType
ASCabGetString
ASCabGetStringCopy
ASCabGetText
ASCabGetType
ASCabKnown
ASCabMakeEmpty
ASCabMunge
ASCabNew
ASCabNumEntries
ASCabPutAtom
ASCabPutBinary
ASCabPutBool
ASCabPutCab
ASCabPutDouble
ASCabPutInt
ASCabPutNull
ASCabPutPathName
ASCabPutPointer
ASCabPutString
ASCabPutText
ASCabReadFromStream
ASCabRemove
ASCabRename
ASCabValueEqual
ASCabWriteToStream
ASScriptFromHostEncoding
ASScriptToHostEncoding

714 Acrobat and PDF Library API Overview


API Changes
G
Version 5

ASTextCat
ASTextCatMany
ASTextCmp
ASTextCopy
ASTextDestroy
ASTextDup
ASTextFromEncoded
ASTextFromInt32
ASTextFromPDText
ASTextFromScriptText
ASTextFromSizedEncoded
ASTextFromSizedPDText
ASTextFromSizedScriptText
ASTextFromSizedUnicode
ASTextFromUnicode
ASTextFromUns32
ASTextGetBestEncoding
ASTextGetBestScript
ASTextGetCountry
ASTextGetEncoded
ASTextGetEncodedCopy
ASTextGetLanguage
ASTextGetPDTextCopy
ASTextGetScriptText
ASTextGetScriptTextCopy
ASTextGetUnicode
ASTextGetUnicodeCopy
ASTextIsEmpty
ASTextMakeEmpty
ASTextNew
ASTextNormalizeEndOfLine
ASTextReplace
ASTextReplaceASCII
ASTextSetCountry
ASTextSetEncoded
ASTextSetLanguage
ASTextSetPDText
ASTextSetScriptText
ASTextSetSizedEncoded
ASTextSetSizedPDText
ASTextSetSizedScriptText
ASTextSetSizedUnicode
ASTextSetUnicode

Acrobat and PDF Library API Overview 715


API Changes
G
Version 5

Available only if PI_ACROSUPPORT_VERSION (in PIRequir.h) is set to 0x00050000


or higher.
ASFileGetOpenMode
ASFileGetURL
ASFileHardFlush
ASFileIsSame
ASFileSysAcquireParent
ASFileSysCreateFolder
ASFileSysDestroyFolderIterator
ASFileSysDisplayStringFromPath
ASFileSysFirstFolderItem
ASFileSysFlushVolume
ASFileSysGetItemProps
ASFileSysGetNameFromPath
ASFileSysGetStorageFreeSpace
ASFileSysGetTempPathName
ASFileSysGetTypeAndCreator
ASFileSysNextFolderItem
ASFileSysRemoveFolder
ASFileSysSetTypeAndCreator
ASFileSysURLFromPath
ASGetSecs
ASHostMBLen
ASPathFromPlatformPath
HFTReplaceEntryEx
HFTUnreplaceEntry
Available only if PI_ACROVIEW_VERSION (in PIRequir.h) is set to 0x00050000 or
higher.
AVAcquireSpecialFilePathName
AVAcquireSpecialFolderPathName
AVAlertGetPref
AVAlertResetPrefs
AVAlertSetPref
AVAlertWithParams
AVAppChooseFolderDialog
AVAppDidOrWillSwitchForDialog
AVAppFindCommandHandlerByName
AVAppFindGlobalCommandByName
AVAppGetLanguageEncoding
AVAppGetReportProc
AVAppGetToolBarByName
AVAppOpenDialog
AVAppRegisterCommandHandler

716 Acrobat and PDF Library API Overview


API Changes
G
Version 5

AVAppRegisterFromPDFHandler
AVAppRegisterGlobalCommand
AVAppRegisterToolBarPosition
AVAppRegisterToPDFHandler
AVAppSaveDialog
AVAppUnregisterGlobalCommand
AVAppYieldToOtherApps
AVCommandCancel
AVCommandDestroy
AVCommandExecute
AVCommandGetAVDoc
AVCommandGetCab
AVCommandGetCancelProc
AVCommandGetConfig
AVCommandGetInputs
AVCommandGetName
AVCommandGetParams
AVCommandGetPDDoc
AVCommandGetProgressMonitor
AVCommandGetProps
AVCommandGetReportProc
AVCommandGetStatus
AVCommandGetUIPolicy
AVCommandNew
AVCommandPutCab
AVCommandReset
AVCommandSetConfig
AVCommandSetInputs
AVCommandSetParams
AVCommandShowDialog
AVCommandWork
AVConversionConvertFromPDFWithHandler
AVConversionConvertToPDF
AVConversionConvertToPDFWithHandler
AVConversionEnumFromPDFConverters
AVConversionEnumToPDFConverters
AVDocFromPDDoc
AVDocIsDead
AVDocPerformActionEx
AVDocPermRequest
AVExtensionAcquireInfo
AVExtensionGetNumPlugIns
AVExtensionReleaseInfo

Acrobat and PDF Library API Overview 717


API Changes
G
Version 5

AVIdentityGetText
AVIdentitySetText
AVPageViewClearFocusAnnot
AVPageViewDeviceToInfo
AVPageViewDragOutNewRectSnapped
AVPageViewDragRectSnapped
AVPageViewDrawRectOutlineWithHandles
AVPageViewFilterKeyDownForFocusAnnot
AVPageViewFocusAnnotPerformOp
AVPageViewGetFocusAnnot
AVPageViewGetMousePositionSnapped
AVPageViewGhostRectOutline
AVPageViewInfoToDevice
AVPageViewInfoToPoint
AVPageViewIsAnnotOfTypeAtPoint
AVPageViewIsFocusAnnot
AVPageViewPointToInfo
AVPageViewResumeOffscreenDrawing
AVPageViewScrollToAnnot
AVPageViewSetFocusAnnot
AVPageViewSnapPoint
AVPageViewSnapRect
AVPageViewSuspendOffscreenDrawing
AVPageViewUpdateInfoPanel
AVRectHandleHitTest
AVSweetPeaGetBasicSuiteP
AVSweetPeaGetPluginRef
AVSweetPeaGetResourceAccess
AVSweetPeaIsADMAvailable
AVSweetPeaProcessADMEvent
AVSweetPeaSetResourceAccess
AVSysSetWaitCursor
AVToolBarNew
AVUtilGetBaseNameAndExtensionByPathName
AVUtilGetBaseNameAndExtensionByString
AVWindowCenter
AVWindowEnsureInBounds
Available only if PI_ACROVIEW_VERSION (in PIRequir.h) is set to 0x00050001 or
higher.
AVMenuClone
Available only if PI_PDMETADATA_VERSION (in PIRequir.h) is set to 0x00050000
or higher.

718 Acrobat and PDF Library API Overview


API Changes
G
Version 5

CosDictGetXAPMetadata
CosDictSetXAPMetadata
PDDocCalculateImplicitMetadata
PDDocGetXAPMetadata
PDDocSetXAPMetadata
PDEContainerGetXAPMetadata
PDEContainerSetXAPMetadata
Available only if PI_COS_VERSION (in PIRequir.h) is set to 0x00050000 or higher.
CosCopyStringValue
CosDocGetID
CosObjCmp
CosStringValueSafe
Available only if PI_PDMODEL_VERSION (in PIRequir.h) is set to 0x00050000 or
higher.
PDBookmarkGetColor
PDBookmarkGetFlags
PDBookmarkRemoveAction
PDBookmarkSetColor
PDBookmarkSetFlags
PDDocExportSomeNotes
PDDocGetPageObjByNum
PDDocPermRequest
PDDocRemoveOpenAction
PDLinkAnnotRemoveAction
PDNameTreeNotifyNameAdded
PDNameTreeNotifyNameRemoved
PDPageDrawContentsToWindowEx
PDPageGetBox
PDPageGetPalette
PDPageHasTransparency
PDPageResumePDEContentChanged
PDPageSetBox
PDTextSelectCreatePageHiliteEx
PDTextSelectCreateRangesEx
PDTextSelectCreateWordHiliteEx
PDTextSelectEnumTextUCS
PDPageSuspendPDEContentChanged
Available only if PI_PDFEDIT_READ_VERSION (in PIRequir.h) is set to
0x00050000 or higher.
PDEBeginContainerGetDict
PDEBeginContainerGetMCTag
PDEElementHasGState

Acrobat and PDF Library API Overview 719


API Changes
G
Version 5

PDEExtGStateAcquireSoftMask
PDEExtGStateGetAIS
PDEExtGStateGetBlendMode
PDEExtGStateGetOpacityFill
PDEExtGStateGetOpacityStroke
PDEExtGStateGetOPFill
PDEExtGStateGetOPM
PDEExtGStateGetOPStroke
PDEExtGStateGetSA
PDEExtGStateGetTK
PDEExtGStateHasSoftMask
PDEFormAcquireXGroup
PDEFormHasXGroup
PDEImageGetMatteArray
PDEImageGetSMask
PDEImageHasSMask
PDESoftMaskAcquireForm
PDESoftMaskGetBackdropColor
PDESoftMaskGetCosObj
PDESoftMaskGetName
PDESoftMaskGetTransferFunction
PDETextGetMatrix
PDETextGetState
PDEXGroupAcquireColorSpace
PDEXGroupGetCosObj
PDEXGroupGetIsolated
PDEXGroupGetKnockout
PDSysEncodingGetWMode
PDSysEncodingIsIdentity
PDSysEncodingIsMultiByte
Available only if PI_PDFEDIT_WRITE_VERSION (in PIRequir.h) is set to
0x00050000 or higher.
PDEBeginContainerCreate
PDEBeginContainerSetDict
PDEBeginContainerSetMCTag
PDEBeginGroupCreate
PDEEndContainerCreate
PDEEndGroupCreate
PDEExtGStateCreateNew
PDEExtGStateSetAIS
PDEExtGStateSetBlendMode
PDEExtGStateSetOpacityFill
PDEExtGStateSetOpacityStroke

720 Acrobat and PDF Library API Overview


API Changes
G
Version 5

PDEExtGStateSetOPFill
PDEExtGStateSetOPM
PDEExtGStateSetOPStroke
PDEExtGStateSetSA
PDEExtGStateSetSoftMask
PDEExtGStateSetTK
PDEFontCreateFromSysFontAndEncoding
PDEFontCreateFromSysFontWithParams
PDEFontCreateToUnicodeNow
PDEFontCreateWidthsNow
PDEFontEmbedNow
PDEFontEmbedNowDontSubset
PDEFontGetCreateNeedFlags
PDEFontGetWidthsNow
PDEFontTranslateGlyphIdsToUnicode
PDEFormSetXGroup
PDEImageSetColorSpace
PDEImageSetMatteArray
PDEImageSetSMask
PDESoftMaskCreate
PDESoftMaskCreateFromCosObj
PDESoftMaskCreateFromName
PDESoftMaskSetBackdropColor
PDESoftMaskSetTransferFunction
PDESoftMaskSetXGroup
PDETextRunSetMatrix
PDETextRunSetState
PDEXGroupCreate
PDEXGroupCreateFromCosObj
PDEXGroupSetColorSpace
PDEXGroupSetIsolated
PDEXGroupSetKnockout
PDSysEncodingCreateFromBaseName
PDSysEncodingCreateFromCMapName
PDSysFontGetCreateFlags
Available only if PI_PDSYSFONT_VERSION (in PIRequir.h) is set to 0x00050000 or
higher.
PDFindSysFontForPDEFont
Available only if PI_PDS_READ_VERSION (in PIRequir.h) is set to 0x00050000 or
higher.
PDSElementGetActualText
PDSElementGetKidEx

Acrobat and PDF Library API Overview 721


API Changes
G
Version 5

PDSElementGetLanguage
PDSElementHasActualText
PDSElementHasAlt
PDSElementHasLanguage
Available only if PI_PDS_WRITE_VERSION (in PIRequir.h) is set to 0x00050000
or higher.
PDSElementRemoveKidOBJ
PDSElementSetActualText
PDSElementSetLanguage
Available only if PI_WIN_VERSION (in PIRequir.h) is set to 0x00050000 or higher.
WinAppRegisterInterface
Callbacks (new or modified)
The following callbacks were added in version 5.0.
ASCabEnumProc
ASCabPointerDestroyProc
ASCancelProc
ASFileSysCreateFolderProc
ASFileSysDestroyFolderIteratorProc
ASFileSysDisplayStringFromPathProc
ASFileSysFirstFolderItemProc
ASFileSysGetItemPropsProc
ASFileSysGetParentProc
ASFileSysGetTypeAndCreatorProc
ASFileSysNextFolderItemProc
ASFileSysRemoveFolderProc
ASFileSysSetTypeAndCreatorProc
ASFileSysURLFromPathProc
ASReportProc
AVActionPerformExProc
AVAnnotHandlerCanPerformOpProc
AVAnnotHandlerDoKeyDownExProc
AVAnnotHandlerDrawExProc
AVAnnotHandlerPerformOpProc
AVCmdHandlerInitProc
AVCmdHandlerTermProc
AVCommandCancelProc
AVCommandCreatedProc
AVCommandDestroyProc
AVCommandGetProc
AVCommandPostflightFileProc
AVCommandPostflightSequenceProc

722 Acrobat and PDF Library API Overview


API Changes
G
Version 5

AVCommandPreflightFileProc
AVCommandPreflightSequenceProc
AVCommandRegisterCommandsProc
AVCommandResetProc
AVCommandSetProc
AVCommandShowDialogProc
AVCommandWorkProc
AVConversionConvertFromPDFProc
AVConversionConvertToPDFProc
AVConversionDefaultSettingsProc
AVConversionFromPDFEnumProc
AVConversionParamDescProc
AVConversionSettingsDialogProc
AVConversionToPDFEnumProc
AVDocPermReqProc
AVDocSelectionGetAVRectProc
AVDocSelectionShowMenuProc
AVOpenSaveDialogSettingsComputeEnabledProc
AVOpenSaveDialogSettingsExecuteProc
AVSetFocusProc
PDCryptAuthorizeExProc
PDCryptBatchAuthorizeProc
PDCryptBatchFreeAuthDataProc
PDCryptBatchNewAuthDataProc
PDCryptBatchParamDescProc
PDCryptBatchPostSequenceProc
PDCryptBatchPreSequenceProc
PDCryptBatchShowDialogProc
PDCryptBatchUpdateSecurityDataProc
PDCryptDisplaySecurityDataProc
PDCryptGetAuthDataExProc
PDCryptReservedProc
PDImplicitMetadataProc
PMSetTextProc
Data (New or modified)
The following data structures were added or changed in version 5.0.
ASCabEntryRec
ASCabMungeAction
ASCabValueType
ASFile Flags
ASFileSysCreatePathFromCString (macro)
ASFileSysCreatePathFromDIPath (macro)

Acrobat and PDF Library API Overview 723


API Changes
G
Version 5

ASFileSysCreatePathFromFSSpec (macro)
ASFileSysCreatePathWithFolderName (macro)
ASFileSysRec
ASFileSysItemProps
ASFileSysItemType
ASFolderIterator
ASFixedRoundToInt16 (macro)
ASHostEncoding
ASMDFile (replaced MDFile)
ASPortRef
ASProgressMonitor
ASReportType
ASScript
ASUnicodeFormat
ASWindowRef
AVAccessColorPolicy
AVActionContext
AVAlertButtonInfo
AVAlertCheckBoxInfo
AVAlert Icons
AVAlertParams
AVAnnotHandler
AVAnnotOp
AVAnnotOpData
AVBatchContext
AVCommandHandler
AVCommandStatus
AVCommandUIPolicy
AVConversionClientData
AVConversionEnumProcData
AVConversionFlags
AVConversionFromPDFHandler
AVConversionStatus
AVConversionToPDFHandler
AVDocOpenParams
AVDocPrintParams
AVDocSaveParams
AVDocSelectionServer
AVExtensionInfo
AVFileDescRec
AVFileFilterRec
AVFullScreenMonitor
AVIconBundle

724 Acrobat and PDF Library API Overview


API Changes
G
Version 5

AVIdentity
AVInfoPanelUpdateType
AVOpenSaveDialogFlags
AVOpenSaveDialogParams
AVPageViewControlID
AVPrefsType
AVRectHandleType
AVSpecialCategory
AVSpecialError
AVSpecialFolder
AVStatusMonitorProcs
AVToolBarDockPosition
AVToolBarLayout
AVToolBarPosition
AVTransitionPort
AVWindow Flags
AVWindowLayer
AVZoomType
Command Keys
Emit Flags
ExternalDocServerCreationData
Modifier Keys
PDAnnotArray
PDAnnotInfo
PDCryptBatchHandler
PDCryptHandler
PDEFontAttrs
PDEFontCreateFromSysFontParams
PDEFontCreateFlags
PDEFontCreateNeedFlags
PDEGrayCalFlt
PDELabCalFlt
PDERGBCalFlt
PDESoftMaskCreateFlags
PDETextState
PDEType
PDEXGroupCreateFlags
PDPermReqObj
PDPermReqOpr
PDPermReqStatus
PDTile
Predefined Cursors
StdSecurityData

Acrobat and PDF Library API Overview 725


API Changes
G
Version 5

Type/Creator Codes
Errors
The following errors were added in version 5.0.
pdErrCannotBeBlankPage
pdErrCannotDeleteAllPages
pdErrExceedEncryptionLength
pdErrExceedEncryptionVersion
pdErrInvalidPageNumber
pdErrMissingGlyphs
pdErrMissingSubsetFont
pdErrNeedJapanese
pdErrNeedKorean
pdErrNeedSimpChinese
pdErrNeedTradChinese
pdErrNotValidPage
pdErrRequireTrustedMode
pdErrStartLessThanEnd
ErrSysPDModel
pdMetadataErrBadPDF
pdMetadataErrCouldntCreateMetaXAP
pdMetadataErrInternalError
Notifications
The following notifications were added in version 5.0.
AVAppOldPrefDidChange
AVAppPrefDidChange
AVAppUsingPDDocForBatch
AVDocDidDeleteSelection
AVPageViewAnnotDidPerformOp
AVPageViewWillDraw
PDDocDidChangePageAreas
PDDocCalculateMetadata
PDDocDidOpen
PDDocDidPrintTiledPage
PDDocPrintingTiledPage
PDDocWillPrintTiledPage
PDPageDidPrintAnnot
PDPageDidPrintAnnots
PDPageWillPrintAnnot
PDPageWillPrintAnnots
PDNameTreeNameAdded

726 Acrobat and PDF Library API Overview


API Changes
G
Version 5

PDNameTreeNameRemoved
PSPrintBeforeAcrobatProcsets
Deleted PDFLibrary-specific Methods, Callbacks, and Data:
The following methods, callbacks, and data were deleted because they are specific to the
PDF Library, so are not available to Acrobat clients. The methods, callbacks, and data that
remain available in the PDF Library are now documented in the PDF Library Supplement to
the Core API Reference. See that document for more information.
NOTE: Many of the following methods, callbacks, and data are no longer available in any
Adobe product. They are mentioned here merely for API record-keeping purposes.
ASAtomGetCount (method)
ASPurgeMemory (method)
AVExtensionMgrRegisterNotification (method)
AVExtensionMgrUnregisterNotification (method)
PDFLGetVersion (method)
PDFLInit (method)
PDFLPrintDoc (method)
PDFLPrintPDF (method)
PDFLTerm (method)
AGMCleanup (method)
AGMClip (method)
AGMClosePath (method)
AGMConcat (method)
AGMDeletePort (method)
AGMDeleteRasterDev (method)
AGMFill (method)
AGMInit (method)
AGMLineTo (method)
AGMMoveTo (method)
AGMNewBitmapPort (method)
AGMNewPath (method)
AGMNewRasterDev (method)
AGMNewRasterPort (method)
AGMNewWindowPort (method)
AGMSetAntiAliasPolicy (method)
AGMSetRGBColor (method)
CCSetSystemCalibration (method)
PDDocPrintPages (method)
PDFontDownloadContextCreate (method)
PDFontDownloadContextDestroy (method)
PDFontStreamPS (method)
PDFontWasExtracted (method)
PDFontWasFauxed (method)
PDFreeMemory (method)
PDPageDrawContents (method)
PDPageDrawContentsPlaced (method)

Acrobat and PDF Library API Overview 727


API Changes
G
Version 5

PDPageDrawContentsPlacedToWindow (method)
PDPageEmitPSOrient (method)
PDSetHostEncoding (method)
AGMMemAllocator (callback)
AGMMemDeleter (callback)
AGMPortDestructProcPtr (callback)
ASMemAllocProc (callback)
ASMemAvailProc (callback)
ASMemFreeProc (callback)
ASMemReallocProc (callback)
DoCancel (callback)
DocBegin (callback)
DocEnd (callback)
DocSetup (callback)
EmitPageContents (callback)
EmitPrologString (callback)
EmitPSFontBegin (callback)
EmitPSFontEncodingBegin (callback)
EmitPSFontEncodingEnd (callback)
EmitPSFontEnd (callback)
EmitPSResourceBegin (callback)
EmitPSResourceEnd (callback)
EndSetup (callback)
FlushString (callback)
GetFontVMUsage (callback)
NotifyNewPage (callback)
PageBegin (callback)
PageEnd (callback)
PageSetup (callback)
PDFLPrintCancelProc (callback)
PDPrintCanEmitFontProc (callback)
PDPrintEmitFontProc (callback)
PDPrintEmitPrologResourceProc (callback)
PDPrintGetFontEncodingMethodProc (callback)
TKResourceAcquireProc (callback)
TKResourceReleaseProc (callback)
AGMBlackPointFlt (data)
AGMCMYKColorRec (data)
AGMColorRangeFlt (data)
AGMColorTab (data)
AGMFixedMatrix (data)
AGMFixedPoint (data)
AGMGrayCalFlt (data)
AGMImageALphaRecord (data)
AGMInt16Rec (data)
AGMLabCalFlt (data)
AGMLABColorRec (data)

728 Acrobat and PDF Library API Overview


API Changes
G
Version 5

AGMMemObj (data)
AGMRGBCalFlt (data)
AGMRGBColorRec (data)
AGMWhitePointFlt (data)
AGMXYZColorFlt (data)
PDFLData (data)
PDFLPrintUserParamsRec (data)
PDInclusion (data)
PDOutputType (data)
PDPrintClient (data)
PDPrintParams (data)
TKAllocatorProcs (data)
TKResourceProcs (data)

Acrobat and PDF Library API Overview 729


API Changes
G
Version 6

Ver s i o n 6
New Objects: introduced in this release
Modified Objects: with new or modified methods in this release
Deprecated Methods and Callbacks
New and Modified Methods: introduced or significantly modified in this release
Methods with Cosmetic Type Changes
New and Modified Callbacks: introduced or significantly modified in this release
Callbacks with Cosmetic Type Changes
New and Modified Data: introduced or significantly modified in this release
Data with Cosmetic Type Changes
New Notifications: introduced in this release
NOTE: Cosmetic Changes: Acrobat 6.0 introduced named cover types that are used in
place of generic numeric types in methods and data structures (generally to support
a future change from 16-bit to 32-bit values). Methods and data that use these
named cover types are listed separately.
In this release, methods and data can be compiled without error if they still use the
generic types, but future releases may conditionally compile the named types
depending on the release version. It is recommended that you update your code to
use the new named types.

New Objects
The following objects were added in version 6.0.
Available only if PI_ASEXTRA_VERSION (in PIRequir.h) is set to 0x00060000 or
higher.
ASDate
ASPlatformPath
ASTimeSpan
Available only if PI_ACROVIEW_VERSION (in PIRequir.h) is set to 0x00060000 or
higher.
AVUndo
Available only if PI_COS_VERSION (in PIRequir.h) is set to 0x00060000 or higher.
CosObjCollection
Available only if PI_PDMODEL_VERSION (in PIRequir.h) is set to 0x00060000 or
higher.
PDOCConfig
PDOCContext

730 Acrobat and PDF Library API Overview


API Changes
G
Version 6

PDOCG
PDOCMD
Available if PI_PDFEDIT_READ_VERSION and PI_PDFEDIT_WRITE_VERSION (in
PIRequir.h) are set to 0x00060000 or higher.
PDETextItem

Modified Objects
The following objects were modified in version 6.0.
ASCab
ASFile
ASFileSys
ASText
AVAnnotHandler
AVApp
AVConversion
AVDoc
AVMenu
AVMenuItem
AVPageView
AVToolButton
AVWindow
HFT
CosDoc
CosObj
PDAnnot
PDDoc
PDPage
PDWord
PDWordFinder
PDEContent
PDEElement
PDEText

Deprecated Methods and Callbacks


The following methods and callbacks are deprecated in version 6.0. They should not be
used, and will be removed from public header files in future releases.
AVAppOpenHelpFile

Acrobat and PDF Library API Overview 731


API Changes
G
Version 6

AVAnnotHandlerAdjustCursorProc
AVAnnotHandlerDoClickProc
AVAnnotHandlerDoKeyDownProc
AVAnnotHandlerDoPropertiesProc
AVAnnotHandlerDrawProc
AVAnnotHandlerGetLayerProc
PDDocGetPermissions

New and Modified Methods


The following methods were added or modified in version 6.0. All methods are new unless
otherwise marked.
Available only if PI_ASEXTRA_VERSION (in PIRequir.h) is set to 0x00060000 or
higher.
ASCabGetUns
ASCabPutUns
ASConstCabEnum
ASCalendarTimeSpanAddWithBase
ASCalendarTimeSpanCompare
ASCalendarTimeSpanDiff
ASDateAddCalendarTimeSpan
ASDateAddTimeSpan
ASDateCalendarDiff
ASDateClear
ASDateCompare
ASDateCopy
ASDateDestroy
ASDateDup
ASDateExactDiff
ASDateGetLocalTime
ASDateGetTimeString
ASDateGetUTCTime
ASDateNew
ASDateSetLocalTimeOffset
ASDateSetTimeFromRec
ASDateSetTimeFromString
ASDateSetToCurrentLocalTime
ASDateSetToCurrentUTCTime
ASDateSubtractCalendarTimeSpan
ASDateSubtractTimeSpan

732 Acrobat and PDF Library API Overview


API Changes
G
Version 6

ASFileCanSetEOF
ASFileHasOutstandingMReads
ASFileSysAcquirePlatformPath
ASFileSysCanPerformOpOnItem
ASFileSysConvertCabToItemProps
ASFileSysConvertItemPropsToCab
ASFileSysDisplayASTextFromPath
ASFileSysDIPathFromPathEx
ASFileSysGetItemPropsAsCab
ASFileSysGetNameFromPathAsASText
ASFileSysPathFromDIPathEx
ASFileSysPerformOpOnItem
ASFileSysReleasePlatformPath
ASIsValidUTF8
ASPlatformPathGetCFURLRefRecPtr
ASPlatformPathGetCstringPtr
ASPlatformPathGetFSRefPtr
ASPlatformPathGetFSRefWithCFStringRefRecPtr
ASPlatformPathGetFSSpecPtr
ASPlatformPathGetPOSIXPathPtr
ASProcStmRdOpenEx
ASStmFlush
ASTextCaseSensitiveCmp
ASTextEval
ASTextFilter
ASTextReplaceBadChars
ASTimeSpanAdd
ASTimeSpanCompare
ASTimeSpanCopy
ASTimeSpanDestroy
ASTimeSpanDiff
ASTimeSpanDup
ASTimeSpanGetASInt32
ASTimeSpanNegate
ASTimeSpanNew
ASTimeSpanSet
ASTimeSpanSetFromASInt32
ASTimeSpanSetFromString
ASUUIDFromCString
ASUUIDGenFromHash
ASUUIDGenFromName

Acrobat and PDF Library API Overview 733


API Changes
G
Version 6

ASUUIDGenUnique
ASUUIDToCString
HFTGetVersion
HFTNewEx
Available only if PI_ACROVIEW_VERSION (in PIRequir.h) is set to 0x00060000 or
higher.
AVAcquireSpecialFilePathNameWithASText
AVAppAutoShowHowToPanel
AVAppCreateIconBundle6
AVAppGetHowToPanelAutoShow
AVAppGetLanguageWithParams
AVAppGetUUID
AVAppHelpSearch
AVAppHelpShowContents
AVAppHelpShowIndex
AVAppOpenHelpFileWithParams
AVAppRegisterAnnotHandler
AVAppRegisterForContextMenuAddition
AVAppRegisterForPageViewAdjustCursor (modified)
AVAppRegisterForPageViewClicks (modified)
AVAppRegisterForPageViewDrawing (modified)
AVAppRegisterForPageViewRightClicks
AVAppRegisterHowToPanel
AVAppRegisterToolBarPosition (modified)
AVAppSetHowToPanelAutoShow
AVAppSetHowToPanelAutoShowText
AVAppSetHowToPanelComputeVisibleProc
AVAppUnregisterForPageViewDrawingEx
AVAppUnregisterForPageViewRightClicks
AVConversionConvertStreamFromPDFWithHandler
AVConversionConvertStreamFromStructNodeWithHandler
AVConversionConvertStreamToPDF
AVConversionConvertStreamToPDFWithHandler
AVDocBeginUndoOperation
AVDocClearUndos
AVDocEndUndoOperation
AVDocGetActiveTool
AVDocGetNthPageView
AVDocGetNumPageViews
AVDocGetPageText
AVDocGetSelectionServerByType
AVDocGetServerType

734 Acrobat and PDF Library API Overview


API Changes
G
Version 6

AVDocGetTopUndo
AVDocGetTopUndoAndRedo
AVDocGetViewDef (modified)
AVDocGetViewDefEx
AVDocIsSlow
AVDocOpenFromASFileWithParams (modified)
AVDocOpenFromASFileWithParamString
AVDocOpenFromFile (modified)
AVDocOpenFromFileWithParamString
AVDocOpenFromPDDoc (modified)
AVDocOpenFromPDDocWithParams (modified)
AVDocOpenFromPDDocWithParamString
AVDocPrintPagesWithParams (modified)
AVDocPrintSeparations
AVDocRegisterSelectionServer
AVDocSetActiveTool
AVDocSetViewDef (modified)
AVDocSetViewDefEx
AVMenuDoPopUp
AVMenuGetTitleAsASText
AVMenuNewWithASText
AVMenuItemClone
AVMenuItemGetTitleAsASText
AVMenuItemIsVisible
AVMenuItemNewWithASText
AVMenuItemSetComputeVisibleProc
AVMenuItemSetTitleWithASText
AVPageViewDevicePointToPage (modified)
AVPageViewDeviceRectToPage (modified)
AVPageViewDeviceRectToPageRZ (modified)
AVPageViewDoPopupMenu (modified)
AVPageViewDragOutNewRect (modified)
AVPageViewDragOutNewRectSnapped (modified)
AVPageViewDragRect (modified)
AVPageViewDragRectSnapped (modified)
AVPageViewDragRectSnappedEx
AVPageViewDrawAnnotSequence (modified)
AVPageViewDrawCosObj (modified)
AVPageViewDrawCosObjEx (modified)
AVPageViewDrawNowWithTransition
AVPageViewDrawPolygon
AVPageViewDrawPolygonOutline
AVPageViewDrawRect (modified)
AVPageViewDrawRectOutline (modified)
AVPageViewDrawRectOutlineWithHandles (modified)

Acrobat and PDF Library API Overview 735


API Changes
G
Version 6

AVPageViewGetAnnotRect (modified)
AVPageViewGetAperture (modified)
AVPageViewGetGrayRect (modified)
AVPageViewGetMousePosition (modified)
AVPageViewGetMousePositionSnapped (modified)
AVPageViewGetNumVisibleInks
AVPageViewGetPageToDevScaling
AVPageViewGetPixelInformationAtPoint
AVPageViewGetVisibleInks
AVPageViewGhostRectOutline (modified)
AVPageViewInsetRect (modified)
AVPageViewInvalidateRect (modified)
AVPageViewInvertQuad (modified)
AVPageViewInvertRect (modified)
AVPageViewIsAnnotAtPoint (modified)
AVPageViewIsAnnotOfTypeAtPoint (modified)
AVPageViewIsBeadAtPoint (modified)
AVPageViewPointInText (modified)
AVPageViewPointToDevice (modified)
AVPageViewRectToDevice (modified)
AVPageViewSetAnnotLocation (modified)
AVPageViewSetInkPreview
AVPageViewSetVisibleInks
AVPageViewScrollTo (modified)
AVPageViewScrollToRect (modified)
AVPageViewSnapPoint (modified)
AVPageViewSnapPointEx
AVPageViewSnapRect (modified)
AVPageViewTrackText (modified)
AVRectHandleHitTest (modified)
AVSysGetIconFromFilename
AVSysGetIconFromMimeType
AVSysGetIconFromTypeAndCreator
AVSysGetUsePenForInput
AVToolButtonGetLabelText
AVToolButtonIsVisible
AVToolButtonSetComputeVisibleProc
AVToolButtonSetLabelText
AVToolButtonSetNotifyTooltipProc
AVUndoGetAVDoc
AVUndoGetData
AVUndoGetType
AVUndoNew
AVUndoSetData

736 Acrobat and PDF Library API Overview


API Changes
G
Version 6

AVUtilGetBaseNameAndExtensionEx
AVWindowDoModal
AVWindowEndModal
AVWindowGetBorderWidths
AVWindowGetDesktopBounds
AVWindowGetFrame (modified)
AVWindowGetInterior (modified)
AVWindowGetMinMaxSize (modified)
AVWindowGetTitle (modified)
AVWindowInvalidateRect (modified)
AVWindowNew (modified)
AVWindowNewFromPlatformThing (modified)
AVWindowSetFrame (modified)
AVWindowSetMinMaxSize (modified)
AVWindowSetTitle (modified)
Available if PI_COS_VERSION (in PIRequir.h) is set to 0x00060000 or higher.
CosDocHasFullCompression
CosDocHasPartialCompression
CosDocObjIsWithinRange
CosDocSaveToFile
CosDocSaveWithParams
CosNewObjCollection
CosObjAddToCollection
CosObjCollectionEnum
CosObjCollectionEqual
CosObjCollectionIsNull
CosObjCollectionSize
CosObjGetCollection
CosObjGetCompressibility
CosObjIsCompressed
CosObjRefreshAfterLinearizedSave
CosObjRemoveFromCollection
CosObjSetCompressibility
CosSetMaxDocStorages
Available only if PI_PDMODEL_VERSION (in PIRequir.h) is set to 0x00060000 or
higher.
PDActionCanCopy
PDActionCanPaste
PDActionCopy
PDActionDestroyClipboardData
PDActionPaste

Acrobat and PDF Library API Overview 737


API Changes
G
Version 6

PDAnnotCanCopy
PDAnnotCanPaste
PDAnnotCopy
PDAnnotDestroyClipboardData
PDAnnotGetOCMD
PDAnnotIsCurrentlyVisible
PDAnnotPaste
PDAnnotRemoveOCMD
PDAnnotSetOCMD
PDCharProcEnumWithParams
PDCryptAuthorizeFilterAccess
PDDocCreateWordFinderEx
PDDocEnumOCConfigs
PDDocEnumOCGs
PDDocFindPageNumForLabelEx
PDDocFlattenOC
PDDocGetLabelForPageNumEx
PDDocGetNumOCGs
PDDocGetOCConfig
PDDocGetOCContext
PDDocGetOCGs
PDDocGetTrapped
PDDocGetXAPMetadataProperty
PDDocHasOC
PDDocReadAheadEmbeddedFile
PDDocReplaceOCG
PDDocRequestEntireFile
PDDocRequestPages
PDDocSetNewCryptFilterData
PDDocSetNewCryptFilterMethod
PDDocSetNewCryptHandlerEx
PDDocSetNewDefaultFilters
PDDocSetTrapped
PDDocSetXAPMetadataProperty
PDDrawCosObjWithParams
PDFontGetASTextName
PDFormEnumPaintProcWithParams
PDOCConfigCreate
PDOCConfigDestroy
PDOCConfigGetAllRadioButtonGroups
PDOCConfigGetCosObj

738 Acrobat and PDF Library API Overview


API Changes
G
Version 6

PDOCConfigGetCreator
PDOCConfigGetInitState
PDOCConfigGetIntent
PDOCConfigGetName
PDOCConfigGetOCGOrder
PDOCConfigGetPDDoc
PDOCConfigGetRadioButtonGroupForOCG
PDOCConfigMakeRadioButtonGroup
PDOCConfigSetCreator
PDOCConfigSetInitState
PDOCConfigSetIntent
PDOCConfigSetName
PDOCConfigSetOCGOrder
PDOCContextApplyAutoStateChanges
PDOCContextClearAllUserOverrides
PDOCContextContentIsVisible
PDOCContextFindAutoStateChanges
PDOCContextFree
PDOCContextGetIntent
PDOCContextGetNonOCDrawing
PDOCContextGetOCDrawEnumType
PDOCContextGetOCGStates
PDOCContextGetPDDoc
PDOCContextInit
PDOCContextMakeCopy
PDOCContextMakeCopyWithAutoStateChanges
PDOCContextNew
PDOCContextNewWithInitialState
PDOCContextNewWithOCDisabled
PDOCContextPopOCMD
PDOCContextPushOCMD
PDOCContextResetOCMDStack
PDOCContextSetIntent
PDOCContextSetNonOCDrawing
PDOCContextSetOCGStates
PDOCContextXObjectIsVisible
PDOCGCreate
PDOCGCreateFromCosObj
PDOCGDestroy
PDOCGGetCosObj
PDOCGGetCurrentState
PDOCGGetFromCosObj
PDOCGGetInitialState

Acrobat and PDF Library API Overview 739


API Changes
G
Version 6

PDOCGGetIntent
PDOCGGetName
PDOCGGetPDDoc
PDOCGGetUsageEntry
PDOCGGetUserOverride
PDOCGHasUsageInfo
PDOCGRemoveInitialState
PDOCGSetCurrentState
PDOCGSetInitialState
PDOCGSetIntent
PDOCGSetName
PDOCGSetUsageDictEntry
PDOCGUsedInOCConfig
PDOCGUsedInOCContext
PDOCMDCreate
PDOCMDFindOrCreate
PDOCMDGetCosObj
PDOCMDGetFromCosObj
PDOCMDGetOCGs
PDOCMDGetPDDoc
PDOCMDGetVisPolicy
PDOCMDIsCurrentlyVisible
PDOCMDsAreCurrentlyVisible
PDOCMDsMakeContentVisible
PDPageDrawContentsPlacedWithParams
PDPageDrawContentsWithParams
PDPageEnumContents
PDPageEnumInks
PDPageEnumOCGs
PDPageFlattenOC
PDPageGetOCGs
PDPageGetVisibleBBox
PDPageMakeSeparations
PDPageSetPDEContentCanRaise
PDRegisterActionHandler
PDWordCreateTextSelect
PDWordGetASText
PDWordGetAttrEx
PDWordGetByteIdxFromHiliteChar
PDWordGetCharEncFlags
PDWordGetCharOffsetEx
PDWordGetCharQuad

740 Acrobat and PDF Library API Overview


API Changes
G
Version 6

PDWordGetNumHiliteChar
PDWordIsCurrentlyVisible
PDWordMakeVisible
PDWordFinderAcquireVisibleWordList
PDWordFinderEnumVisibleWords
PDWordFinderEnumWordsStr
Available only if PI_PDFEDIT_READ_VERSION (in PIRequir.h) is set to
0x00060000 or higher.
PDEElementGetAllVisibilities
PDEElementGetOCMD
PDEElementIsCurrentlyVisible
PDEFontGetSysEncoding
PDEFontGetSysFont
PDEFontIsEmbedded
PDETextGetAdvance
PDETextGetItem
PDETextItemGetFont
PDETextItemGetGState
PDETextItemGetTextLen
PDETextItemGetTextMatrix
PDETextItemGetTextState
Available only if PI_PDFEDIT_WRITE_VERSION (in PIRequir.h) is set to
0x00060000 or higher.
PDEContentFlattenOC
PDEElementMakeVisible
PDEElementRemoveOCMD
PDEElementSetOCMD
PDEFontSetSysEncoding
PDEFontSetSysFont
PDEFormCreateClone
PDEFormSetContent
PDETextAddItem
PDETextRemoveItems
PDETextItemCopyText
PDETextItemCreate
PDETextItemRemoveChars
PDETextItemReplaceChars
PDETextItemReplaceText
PDETextItemSetFont

Acrobat and PDF Library API Overview 741


API Changes
G
Version 6

PDETextItemSetGState
PDETextItemSetTextMatrix
PDETextItemSetTextState
PDSysEncodingCreateFromCodePage
Available only if PI_PDS_READ_VERSION (in PIRequir.h) is set to 0x00060000 or
higher.
PDSAttrObjGetCosObj
PDSElementGetCosObj
PDSElementGetKidWithMCInfo
PDSMCGetInfo
PDSMCGetPDEContainer
PDSMCIDGetParent
PDSTreeRootReplaceStreamRef
Available only if PI_PDS_WRITE_VERSION (in PIRequir.h) is set to 0x00060000
or higher.
PDSElementInsertStmMCAsKid

Methods with Cosmetic Type Changes


Acrobat 6.0 introduced named cover types that are used in place of generic numeric types
in methods and data structures. Such methods can be compiled without error if they still
use the generic types, but in future the new types may be conditionally compiled
(depending on the Acrobat version) to 32-bit values. It is recommended that you update
your code to use the new named types.
NOTE: New coordinate numeric types such as AVDevCoord are conditionally compiled as
ASInt16 or ASInt32 depending on the Acrobat version level. These types are
used in other structures, such as AVRect. Methods that use these types are listed in
New and Modified Methods.
The following methods use these named cover types.
ASCabDetachBinary
ASCabGetBinary
ASCabGetBinaryCopy
ASCabNumEntries
ASCabPutBinary
ASExtensionGetFileName
ASGetErrorString
ASGetExceptionErrorCode
ASFileClose
ASFileGetEOF
ASFileGetPos
ASFileHardFlush

742 Acrobat and PDF Library API Overview


API Changes
G
Version 6

ASFilePushData
ASFileRead
ASFileReopen
ASFileSetPos
ASFileWrite
ASFileSysCreateFolder
ASFileSysFlushVolume
ASFileSysGetItemProps
ASFileSysGetNameFromPath
ASFileSysOpenFile
ASFileSysRemoveFile
ASFileSysRemoveFolder
ASStmRead
ASStmWrite
ASTextGetUnicode
ASTextGetUnicodeCopy
ASTextFromSizedEncoded
ASTextFromSizedPDText
ASTextFromSizedScriptText
ASTextFromSizedUnicode
ASTextFromUnicode
ASTextSetSizedEncoded
ASTextSetSizedPDText
ASTextSetSizedScriptText
ASTextSetSizedUnicode
ASTextSetUnicode
ASRaise
ASRegisterErrorString

AVAcquireSpecialFolderPathName
AVAppChooseFolderDialog
AVAppGetNumDocs
AVAppGetVersion
AVAppOpenDialog
AVAppRegisterForPageViewKeyDown
AVAppRegisterTool
AVAppSaveDialog
AVExtensionAcquireInfo
AVExtensionGetNumPlugIns
AVDocGetClientName
AVMenubarGetNumMenus
AVMenuGetNumMenuItems
AVMenuGetTitle

Acrobat and PDF Library API Overview 743


API Changes
G
Version 6

AVMenuItemGetTitle
AVMenuItemNew
AVPageViewAppearanceGetAVMatrix
AVPageViewDeviceToInfo
AVPageViewDrawPolygon
AVPageViewDrawPolygonOutline
AVPageViewFilterKeyDownForFocusAnnot
AVPageViewGetFirstVisiblePageNum
AVPageViewGetLastVisiblePageNum
AVPageViewGetNextView
AVPageViewGetPageNum
AVPageViewGetThreadIndex
AVPageViewGetSelectedAnnotPageNum
AVPageViewGetVisibleAnnotPage
AVPageViewGoTo
AVPageViewInfoToDevice
AVPageViewInvertRect
AVPageViewInvertRectOutline
AVPageViewPageNumIsVisible
AVPageViewSetPageNum
AVToolBarGetNumButtons
AVUtilGetBaseNameAndExtensionByPathName
AVUtilGetBaseNameAndExtensionByString

CosArrayGet
CosArrayInsert
CosArrayLength
CosArrayPut
CosArrayRemoveNth
CosCopyStringValue
CosDecryptData
CosDocCreate
CosDocGetID
CosDocSaveToFile
CosEncryptData
CosNewArray
CosNewDict
CosNewString
CosStreamLength
CosStreamPos
CosStringValue
CosStringValueSafe

744 Acrobat and PDF Library API Overview


API Changes
G
Version 6

New and Modified Callbacks


The following callbacks were added or changed in version 6.0.
ASConstCabEnumProc
ASCryptStmFCloseProc
ASCryptStmFFlushProc
ASCryptStmFilBufProc
ASCryptStmFlsBufProc
ASCryptStmFPutEOFProc
ASCryptStmFResetProc
ASCryptStmUnGetcProc
ASFileSysAcquirePlatformPathProc
ASFileSysAsyncReadProc
ASFileSysAsyncWriteProc
ASFileSysCanPerformOpOnItemProc
ASFileSysCanSetEofProc
ASFileSysCloseProc
ASFileSysCreateFolderProc
ASFileSysDIPathFromPathExProc
ASFileSysDisplayASTextFromPathProc
ASFileSysFlushProc
ASFileSysFlushVolumeProc
ASFileSysGetEofProc
ASFileSysGetItemPropsProc
ASFileSysGetItemPropsAsCabProc
ASFileSysGetNameAsASTextProc
ASFileSysGetNameProc
ASFileSysGetPosProc
ASFileSysOpenProc
ASFileSysPathFromDIPathProc
ASFileSysPerformOpOnItemProc
ASFileSysRangeArrivedProc
ASFileSysReadProc
ASFileSysReleasePlatformPathProc
ASFileSysRemoveFolderProc
ASFileSysRemoveProc
ASFileSysRenameProc
ASFileSysReopenProc
ASFileSysSetEofProc
ASFileSysSetPosProc
ASFileSysWriteProc
ASFileSysYieldProc

Acrobat and PDF Library API Overview 745


API Changes
G
Version 6

AVActionDoPropertiesExProc
AVActionGetDetailsProc
AVActionPerformExProc
AVAnnotHandlerAdjustCursorExProc
AVAnnotHandlerAppearanceDrawingProc
AVAnnotHandlerDoClickExProc
AVAnnotHandlerDoClickProc
AVAnnotHandlerDoKeyDownExProc
AVAnnotHandlerDoKeyDownProc
AVAnnotHandlerDoPropertiesExProc
AVAnnotHandlerGetAppearanceProc
AVAnnotHandlerGetFlagsProc
AVAnnotHandlerGetLayerExProc
AVAnnotHandlerPtInAnnotViewBBoxProc
AVComputeVisibleProc
AVContextMenuAdditionProc
AVConversionConvertStreamFromStructNodeProc
AVConversionConvertStreamToPDFProc
AVDocSelectionAcquireQuadsProc
AVDocSelectionHighlightSelectionExProc
AVDocSelectionKeyDownProc
AVDocSelectionShowMenuProc
AVIconHandlerGetFlagsProc
AVIconHandlerMeasureProc
AVIconHandlerOpenStmProc
AVIconHandlerReleaseProc
AVNotifyTooltipProc
AVPageViewClickProc
AVPageViewCursorProc
AVPageViewKeyDownProc
AVToolDestroyProc
AVToolGetLabelProc
AVToolGetLabelIconProc
AVUndoBeginEndProc
AVUndoGetTitleProc
AVUndoExecuteProc
AVUndoReleaseProc
AVUndoVerifyProc
AVWindowAdjustCursorProc
AVWindowMouseDownProc
DoClickProcType
DoKeyDownProcType
HFTServerProvideHFTProc

746 Acrobat and PDF Library API Overview


API Changes
G
Version 6

PDActionHandlerCanCopyProc
PDActionHandlerCanPasteProc
PDActionHandlerCopyProc
PDActionHandlerDestroyProc
PDActionHandlerDestroyDataProc
PDActionHandlerGetTypeProc
PDActionHandlerPasteProc
PDAnnotHandlerCanCopyProc
PDAnnotHandlerCanPasteProc
PDAnnotHandlerCopyProc
PDAnnotHandlerDestroyProc
PDAnnotHandlerDestroyDataProc
PDAnnotHandlerGetHeelPointProc
PDAnnotHandlerGetPrintAppearanceProc
PDAnnotHandlerPasteProc
PDCryptFilterAuthorizeProc
PDCryptFilterGetDataProc
PDCryptFilterStreamProc
PDCryptFilterStringProc
PDCryptGetDocPermsProc
PDDocPreWriteProc
PDDocRequestEntireFileProc
PDDocRequestPagesProc
PDOCConfigEnumProc
PDOCGEnumProc

Callbacks with Cosmetic Type Changes


Acrobat 6.0 introduced named cover types that are used in place of generic numeric types
in methods and data structures. Such methods can be compiled without error if they still
use the generic types. The following callback methods use these named cover types.
CosDocEnumEOFsProc
CosObjOffsetProc
ASFileCompletionProc
ASFileSysGetNameProc
ASFileSysMReadRequestProc
ASStmProc
AVActionGetButtonTextProc
AVActionGetInstructionsProc
AVActionGetStringOneTextProc
AVActionGetStringTwoTextProc
AVDocSelectionGetAVRectProc

Acrobat and PDF Library API Overview 747


API Changes
G
Version 6

AVSelectionPageRangeEnumProc
AVSelectionPageRangeEnumProc
PDAnnotHandlerGetAnnotInfoFlagsProc

New and Modified Data


The following data structures were added or changed in version 6.0.
ASCoord
ASCabValueType
ASCalendarTimeSpan
ASConstCab
ASConstText
ASCryptStm
ASCryptStmProcs
ASDateTimeFormat
ASFileSys
ASTextFilterType
ASTimeRec
ASTVersion
ASUUID
ASUUIDMaxStringLen
AVActionHandlerProcs
AVAdjustCursorParams
AVAlertParams
AVAlertType
AVAnnotHandler
AVAnnotOpData
AVAppLanguageFormat
AVAppLanguageParams
AVAppUUIDType
AVClickParams
AVColorForcing
AVConversionFromPDFHandler
AVConversionMimeTypeString
AVConversionToPDFHandler
AVDevCoord
AVDevRect
AVDevSize
AVDocOpenParams
AVDocPrintOverrideData
AVDocPrintParams
AVDocPrintRasterizeData

748 Acrobat and PDF Library API Overview


API Changes
G
Version 6

AVDocPrintSepsParams
AVDocPrintTileData
AVDocServerType
AVDocViewDef
AVFlagBits16
AVIconBundle6
AVIconColorFormat
AVIconData
AVIconDataFormat
AVIconHandler
AVInkValue
AVlCoord
AVLine
AVOpenSaveDialogParams
AVPageSize
AVResourcePolicy
AVRasterizeFlags
AVRect
AVScreenCoord
AVScreenRect
AVSpecialFolder
AVStructNode
AVSysIconType
AVTileMark
AVTool
AVUndoHandler
AVUndoHandlerData
AVUseValue
AVWindowCoord
AVWindowRect
Code Page Values
CosByte
CosByteMax
CosDocOpenParams
CosDocSaveFlags
Cstring_Ptr
FSRef_Ptr
FSRefWithCFStringRefRec_Ptr
FSSpec_Ptr
HFTData
PDActionClipboardData
PDActionHandler
PDActionHandlerData

Acrobat and PDF Library API Overview 749


API Changes
G
Version 6

PDAnnotClipboardData
PDAnnotHandler
PDAnnotPrintOp
PDCryptHandler
PDCryptFilterHandler
PDDocOCChangeType
PDDocRequestReason
PDDocSaveParams
PDDrawParams
PDGraphicEnumParams
PDHostSepsPlate
PDHostSepsSpec
PDOCConfigBaseState
PDOCContextChangeType
PDOCContextChangeType
PDOCDrawEnumType
PDOCMDVisPolicy
PDPageMarkFlags
PDPrintWhat
PDSaveFlags2
PDSMCInfo
PDWordFinderConfig
POSIXPath_Ptr
Quad
Word Attributes
WordFinder Character Encoding Flags
WordFinder Sort Order Flags

Data with Cosmetic Type Changes


Acrobat 6.0 introduced named cover types that are used in place of generic numeric types
in methods and data structures. Such methods can be compiled without error if they still
use the generic types. The following are the named cover types, as well as the structures
that use them but have not changed in any other way.
ASCount
ASErrorCode
ASIORequest
ASTArraySize
ASTCount
ASTFilePos
ASUnicodeChar
ASUTF16Val
AVArraySize

750 Acrobat and PDF Library API Overview


API Changes
G
Version 6

AVDestInfo
AVFilterIndex
AVFlagBits32
AVMenuIndex
AVPageIndex
AVPixelOffset
AVTArraySize
AVTBufferSize
AVTCount
AVTFlagBits
AVTFlagBits16
AVTSmallArraySize
AVTVersionNumPart
CosDocOpenParams
CosDocOpenParams
CosDocSaveParams
PDAnnotInfo
PDCount
PDDocInsertPagesParams
PDFontAngle
PDFontMetrics
PDFontOffset
PDGraphicState
PDiFontMetric
PDImageAttrs
PDImageScalar
PDPageNumber
PDSmallFlagBits

New Notifications
The following notifications were added or changed in version 6.0.
AVAppDidInitExtensions
AVAppSystemLogonSessionSwitched
AVAppToolDidChange
AVAppWillTerminateExtensions
AVDocActivePageViewDidChange
AVDocDidClearSelection
AVPageViewDocDidChange
AVPageViewWasCreated
AVPageViewWillDestroy

Acrobat and PDF Library API Overview 751


API Changes
G
Version 6

PDBookmarkDidChangeOpenState
PDDocOCDidChange
PDDocOCWillChange
PDDocPermsReady
PDDocWillPrintDocInMode
PDOCContextDidChange
PDOCContextWillChange
PDPageDidRemoveAnnotEx

752 Acrobat and PDF Library API Overview


API Changes
G
Version 7

Ver s i o n 7

New Objects
PDEImageFlate (Introduced in PDF Library SDK 6.1)
PDEImageJPX (Introduced in PDF Library SDK 6.1)

Deprecated Methods and Callbacks


ASFloatToFixed macro (replaced by FloatToASFixed)
ASFileSysGetPlatformThing

New Methods
AFDrawText (Forms extended API)
ASGetRamFileSys (Introduced in PDF Library SDK 6.1)
ASGetTempFileSys (Introduced in PDF Library SDK 6.1)
ASSetTempFileSys (Introduced in PDF Library SDK 6.1)
ASRamFileSysSetLimitKB (Introduced in PDF Library SDK 6.1)

ASCabGetInt64
ASCabGetUns64
ASCabPutInt64
ASCabPutUns64
ASFileGetEOF64
ASFileGetPos64
ASFileSetEOF64
ASFileSetPos64
ASFileSysGetFilePosLimit
ASFileSysGetNameFromPathForDisplay
ASFileSysOpenFile64
ASFixedToFloat (was previously a macro)

AVAppRegisterLateInitProc
AVAppShouldKeyDeleteObject
AVDocDoAnnotProperties
AVDocGetBookmarks
AVDocGetLastActiveTool
AVDocGetNthWindow
AVDocGetNumWindows
AVPageViewGetAVWindow

Acrobat and PDF Library API Overview 753


API Changes
G
Version 7

AVPageViewGetWireframeDrawing
AVPageViewSetWireframeDrawing

CosArrayIsWeakReference
CosArraySetWeakReference
CosCopyNameStringValue
CosDictGetKey
CosDictGetKeyString
CosDictIsWeakReference
CosDictKnownKey
CosDictKnownKeyString
CosDictPutKey
CosDictPutKeyString
CosDictRemoveKey
CosDictRemoveKeyString
CosDictSetWeakReference
CosDocEnumEOFs64
CosDocObjIsWithinRange64
CosFloatValue
CosInteger64Value
CosNewFloat
CosNewInteger64
CosNewNameFromString
CosNewStream64
CosNumberIsWithinASFixedRange
CosNumberIsWithinASInt32Range
CosObjAcquire
CosObjRelease
CosStreamLength64
CosStreamPos64

FloatToASFixed (previously a macro called ASFloatToFixed)

JPXColorSpaceAcquireNext (Introduced in PDF Library SDK 6.1)


JPXColorSpaceGetEnumAttrs (Introduced in PDF Library SDK 6.1)
JPXColorSpaceGetProfile (Introduced in PDF Library SDK 6.1)
JPXColorSpaceGetType (Introduced in PDF Library SDK 6.1)
JPXPaletteGetBitDepths (Introduced in PDF Library SDK 6.1)
JPXPaletteGetNumComponents (Introduced in PDF Library SDK 6.1)
JPXPaletteGetNumEntries (Introduced in PDF Library SDK 6.1)
JPXPaletteGetTable (Introduced in PDF Library SDK 6.1)
PDDocAddWatermarkFromPDPage
PDDocAddWatermarkFromText

754 Acrobat and PDF Library API Overview


API Changes
G
Version 7

PDDocEnumPDSElementsWithUserProperties
PDDocGetCryptHandler
PDDocGetLayoutMode
PDDocGetMergedXAPKeywords
PDDocHasUserProperties
PDDocMergeXAPKeywords
PDDocPermRequestNoUB
PDDocSetLayoutMode

PDEContentSetContainingStream
PDEContentSetPage
PDEContentSetStreamOwner
PDEFontAddGlyphs
PDEImageAcquireImageFlate (Introduced in PDF Library SDK 6.1)
PDEImageAcquireImageJPX (Introduced in PDF Library SDK 6.1)
PDEImageFlateAcquireColorSpace (Introduced in PDF Library SDK 6.1)
PDEImageFlateGetAttrs (Introduced in PDF Library SDK 6.1)
PDEImageFlateGetCosObj (Introduced in PDF Library SDK 6.1)
PDEImageFlateGetDataStm (Introduced in PDF Library SDK 6.1)
PDEFontAddGlyphs
PDEImageGetType
PDEImageJPXAcquireColorSpace (Introduced in PDF Library SDK 6.1)
PDEImageJPXAcquireJPXColorSpace (Introduced in PDF Library SDK 6.1)
PDEImageJPXAcquirePalette (Introduced in PDF Library SDK 6.1)
PDEImageJPXGetAttrs (Introduced in PDF Library SDK 6.1)
PDEImageJPXGetCosObj (Introduced in PDF Library SDK 6.1)
PDEImageJPXGetDataStm (Introduced in PDF Library SDK 6.1)
PDEImageJPXGetNumColorSpaces (Introduced in PDF Library SDK 6.1)
PDEImageJPXHasPalette (Introduced in PDF Library SDK 6.1)
PDEReleaseSpan
PDETextAddGlyphs

PDFLibraryRegisterNotificationEx (PDF Library only)

PDOCConfigGetLockedArray
PDOCConfigSetLockedArray
PDOCGGetLocked
PDOCGSetLocked
PDOCMDFindOrCreateEx
PDOCMDGetVisibilityExpression

PDPageAcquirePage
PDPageEnumInksEx

Acrobat and PDF Library API Overview 755


API Changes
G
Version 7

PDPageGetUserUnitSize
PDPageSetUserUnitSize

PDSElementEnumKidsWithUserProperties
PDSElementEnumUserPropertiesAsCosObj
PDSElementEnumUserPropertiesAsASText
PDSElementFindAncestorWithUserProperties
PDSElementHasUserProperties
PDSElementInsertMCRefAsKid
PDSMCRefCreate
PDSMCRefDestroy

PDSysFontVerifyEncoding

NewCallbacks
AVAnnotHandlerGetAccessibilityStringProc
AVComputeTooltipProc
CosDocEnumEOFsProc64
CosObjOffsetProc64
PDSElementEnumUserPropertiesAsASTextProc
PDSElementEnumUserPropertiesAsCosObjProc
EnumElementsWithUserPropertiesProc
PDDoExtGStateProc (PDF Library only)

New Data
ASInt64
ASUns64
ASFilePos64
AVAnnotHandlerRec
ImageInk (PDF Library only)
ImageInks (PDF Library only)

JPXColorSpace
JPXPalette

MonoInkList (PDF Library only)

PDDocSaveParams

PDEImageJPXattrs (Introduced in PDF Library SDK 6.1)

756 Acrobat and PDF Library API Overview


API Changes
G
Version 7

PDEImageFlateattrs (Introduced in PDF Library SDK 6.1)


PDEGlyphDescription
PDESpanSet
PDFLDataRec (modified; PDF Library only)
PDFLMemStats (PDF Library only)
PDPageDrawFlags (modified; PDF Library only)
PDPrintClientRec (modified; PDF Library only)
PDPrintParamsRec (modified; PDF Library only)
PDTileRecEx (PDF Library only)
SearchWordOptions (modifiedSearch extended API)
TextList (PDF Library only)
TIFFASCIITagList (PDF Library only)

New Notifications
AVDocActivePageViewDidChange
AVDocWIndowWasAdded
AVDocWindowWasRemoved
AVDocAVWindowDidChange

Acrobat and PDF Library API Overview 757


API Changes
G
Version 7

758 Acrobat and PDF Library API Overview


Index

A AVUndo 298
AVWindow 299
Acrobat Support (AS) layer 233
Acrobat viewers, controlling 39
ASAtom 233
action handlers 430
ASCab 233
adding new object types 35
ASCallback 237
Adobe Dialog Manager (ADM) 293
ASDate 238
annotation handlers 430
ASExtension 239
annotation types, new 42
ASFile 239
applications, examples 39
ASFileSys 241
AS layer 24
ASPlatformPath 245
AV layer 23
ASStm 247
AVCommand 431
ASText 248
ASTimespan 252
configuration 253 B
errors 253
batch processing 432
fixed-point math 254
HFT methods 255
memory allocation 255 C
platform-specific utilities 257
cabinets 233
thread-safe multithreading 256
classes, PDFEdit 359
Acrobat Viewer (AV) layer 261
command handlers 431
AVActionHandler 262
complex types 29
AVAlert 263
controlling the Acrobat viewers 39
AVAnnotHandler 263
conversion handlers 434
AVApp 264
converting file formats to and from PDF 273
AVCommand 270
coordinate systems 30
AVConversion 273
device space 31, 32
AVCrypt 274
machine port space 33
AVDoc 275
user space 30, 32
AVGrafSelect 280
core API
AVMenu 280
objects 24
AVMenubar 282
organization 22
AVMenuItem 283
types 27
AVPageView 285
core API organization
AVSweetPea 293
AS layer 24
AVSys 294
AV layer 23
AVTool 295
Cos layer 24
AVToolBar 295
PD layer 23
AVToolButton 296
PDFEdit 23

Acrobat and PDF Library API Overview 755


Index

PDSEdit 23 errors, Acrobat Support (AS) layer methods 253


platform-specific methods 24 examples of applications and plug-ins 39
Cos layer 24, 419 exception handlers 451
CosArray 424 exception handling 34
CosBoolean 424 extended APIs 15, 21, 39, 193
CosCollection 423 extracting text 41
CosDict 425
CosDoc 421
CosFixed 426 F
CosInteger 426 file specification handlers 435
CosName 426 file systems 239
CosNull 427 fixed-point math 254
CosObj 422
CosStream 427
CosString 428 H
encryption/decryption 428 handlers 429
file structure 420 action 430
Cos objects 29 annotation handlers 430
cross-platform dialog management 293 command 431
conversion 434
file specification 435
D file systems 438
data types progress monitors 439
complex 29 security 442
Cos 29 selection servers 435
opaque 29 tools 436
scalar 27 transition 439
simple 28 window 437
dates and times 238 handling errors 451, 461
decryption 441 adding new exceptions 454
device space 31, 32 passing an exception 454
device space, coordinates of 31 handling exceptions 34
dictionary access 42 HFT 255
document security 441 Host encoding 249
utility methods 449 host function table (HFT) 255
drawing into another window 39

I
E IAC interfaces 22
encoded text, specifying 248 indexed searching 40
encryption 441 info dictionary access 42
encryption/decryption integrating with an Acrobat viewer 21
Cos layer 428 interapplication communication (IAC) 21
error handling 451, 461 invoking AVCommands programmatically 270

756 Acrobat and PDF Library API Overview


Index

L PDFEdit 23, 357


classes 359
language codes, setting 251
comparison with other core APIs 363
layers
debuggin tools and techniques 374
Acrobat Support (AS) 233
dump methods 377
Acrobat Viewer (AV) 261
general methods 377
Cos 419
hit testing 365
Portable Document (PD) 303
matrix operations 367
logical structure 401
page creation 369
PDEClip 377
M PDEColorSpace 378
PDEContainer 378
machine port space 30, 33 PDEContent 380
Macintosh utilities 257 PDEDeviceNColors 381
memory allocation 255 PDEElement 381
Metadata 304 PDEExtGState 383
method names, general format of 25 PDEFont 385
PDEForm 388
N PDEGroup 388
PDEImage 388
new annotation types 42 PDEObject 391
PDEPath 391
PDEPattern 392
O
PDEPlace 392
object attributes 24 PDEShading 393
object names, conventions for 24 PDEText 394
object types, adding new 35 PDETextItem 396
objects 45 PDEUnknown 397
opaque data types 24 PDEXObject 398
opaque objects PDSysFont 398
objects, opaque 24 PDFileSpec 322
opaque types 29 PDModel layer 303
optional content 337 PDSEdit 23, 401
organization of core API 22 PDSAttrObj 409
PDSClassMap 410
PDSElement 405
P PDSMC 409
passing an exception 454 PDSObjr 410, 417
path names 245 PDSRoleMap 410
PD layer 23 PDSTreeRoot 404
PDF files permissions, querying PDDoc 313
private data in 35, 42 platform-specific utilities 257
PDF format, converting to and from 273 plug-ins 21
PDF Library 15, 21, 39 examples 39

Acrobat and PDF Library API Overview 757


Index

Portable Document (PD) layer 303 R


general methods 304
rectangles 34
PDAction 306
PDAnnot 307
PDBead 309 S
PDBookmark 310
PDCharProc 312 scalar types 27
PDDoc 313 searching, indexed 40
PDFileSpec 322 security 441
PDForm 327 new features in Acrobat 5.0 444
PDGraphic 327 security handlers 442
PDImage 328 callbacks 444
PDInlineImage 328 selection servers 435
PDLinkAnnot 329 simple types 28
PDNameTree 330 streams 247
PDNumTree 331 structure, logical 401
PDOCConfig 331
PDOCContext 333 T
PDOCG 337
PDOCMD 339 tagged PDF 401
PDPage 341 text, extraction 41
PDPageLabel 346 thread-safe multithreading 256
PDPath 347 times and dates 238
PDStyle 347 transition handlers 439
PDText 347 translating between user and device space 32
PDTextAnnot 348 transparency 384
PDTextSelect 348 types, core API 27
PDThread 350
PDThumb 351
U
PDTrans 351
PDViewDestination 352 Unicode 248
PDWord 352 UNIX utilities 257
PDWordFinder 355 user space 30, 32
PDXObject 356 user space, coordinates of 30
private data in PDF files 35, 42
progress monitors 439
W
window, drawing into another 39
Q Windows utilities 259
quadrilaterals 34
querying PDDoc permissions 313

758 Acrobat and PDF Library API Overview

Anda mungkin juga menyukai