22.03.2015 Views

DLI Implementation and Reference Guide - Datalogics

DLI Implementation and Reference Guide - Datalogics

DLI Implementation and Reference Guide - Datalogics

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Implementation</strong> <strong>and</strong><br />

<strong>Reference</strong> <strong>Guide</strong><br />

<strong>Datalogics</strong> Interface<br />

<strong>Datalogics</strong> ®


<strong>Datalogics</strong><br />

DATALOGICS INTERFACE<br />

<strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong>


This guide is part of the Adobe® PDF Library v7.0Plus suite; 02/17/06.<br />

Copyright 1999-2006 <strong>Datalogics</strong> Incorporated. All Rights Reserved.<br />

Use of <strong>Datalogics</strong> software is subject to the applicable license agreement.<br />

DL Interface is a trademark of <strong>Datalogics</strong> Incorporated. Other products mentioned herein as <strong>Datalogics</strong> products<br />

are also trademarks or registered trademarks of <strong>Datalogics</strong>, Incorporated.<br />

Adobe, Adobe PDF Library, Portable Document Format (PDF), PostScript, Acrobat, Distiller, Exchange <strong>and</strong><br />

Reader are trademarks of Adobe Systems Incorporated.<br />

HP <strong>and</strong> HP-UX are registered trademarks of Hewlett Packard Corporation.<br />

IBM, AIX, AS/400, OS/400, MVS, <strong>and</strong> OS/390 are registered trademarks of International Business Machines.<br />

Java, J2EE, J2SE, J2ME, all Java-based marks, Sun <strong>and</strong> Solaris are trademarks or registered trademarks of Sun<br />

Microsystems, Inc. in the United States <strong>and</strong> other countries.<br />

Linux is a registered trademark of Linus Torvalds.<br />

Microsoft, Windows <strong>and</strong> Windows NT are trademarks or registered trademarks of Microsoft Corporation.<br />

SAS/C is a registered trademark of SAS Institute Inc.<br />

UNIX is a registered trademark of The Open Group.<br />

VeriSign® is a registered trademark of VeriSign, Inc. in the United States <strong>and</strong>/or other countries.<br />

All other trademarks <strong>and</strong> registered trademarks are the property of their respective owners.<br />

For additional information, contact:<br />

<strong>Datalogics</strong>, Incorporated<br />

101 North Wacker Drive, Suite 1800<br />

Chicago, Illinois 60606-7301<br />

Phone: 312-853-8200<br />

Fax: 312-853-8282<br />

www.datalogics.com<br />

dlcomments@datalogics.com


TOC.i<br />

Table of Contents<br />

1 Getting Started 1.1<br />

An Introduction to <strong>DLI</strong> 1.2<br />

How to Create a PDF Document with <strong>DLI</strong> 1.2<br />

How to Use this Book 1.4<br />

What’s New in This Release 1.8<br />

What’s New in Previous Releases 1.9<br />

2 Initializing <strong>and</strong> Terminating the Library 2.1<br />

Overview 2.2<br />

Adobe PDF Library Data Structure 2.2<br />

Adobe PDF Library Version Control 2.5<br />

Files In Memory Activation 2.7<br />

Initializing <strong>and</strong> Terminating via <strong>DLI</strong> 2.7<br />

Writing PDF Output to Memory 2.13<br />

API Comparison 2.15<br />

3 Beginning <strong>and</strong> Ending a Document 3.1<br />

Overview 3.2<br />

4 Fonts 4.1<br />

PDF Font Overview 4.2<br />

Structure of a <strong>DLI</strong> Font 4.3<br />

Font Creation Calls 4.5<br />

Predefined Font Encodings 4.9<br />

Unicode Text Support 4.10<br />

Code Page Support 4.10<br />

Performance Considerations 4.11<br />

Accessing Fonts 4.11<br />

5 Multibyte Text Work 5.1<br />

Introduction 5.2<br />

Loading <strong>and</strong> Creating Fonts 5.3<br />

Creating DLPDFTEXT Areas 5.4<br />

Working With DLPDFTEXT Areas 5.6<br />

Performance Considerations 5.9<br />

6 Working with Pages 6.1<br />

Introduction to Page Interface 6.2<br />

Page Interface Calls 6.2<br />

7 Containers within Pages 7.1<br />

What are Containers? 7.2


TOC.ii <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

8 Working with Content 8.1<br />

Overview of Content Interface 8.2<br />

Content Interface Calls 8.3<br />

9 Working with Forms 9.1<br />

Overview of Forms 9.2<br />

Form Calls 9.2<br />

10 Displaying Line Drawings 10.1<br />

Overview 10.2<br />

Approaches to Line Drawing 10.2<br />

Graphic State <strong>and</strong> Line Drawing 10.14<br />

11 Image Display 11.1<br />

Overview 11.2<br />

Graphic Image Structures 11.2<br />

Graphic Image Forms 11.3<br />

Image Creation Methods 11.5<br />

Creating Transparent Graphics 11.10<br />

12 Color <strong>and</strong> its Use 12.1<br />

Library Color Descriptions 12.2<br />

Colors in Images 12.2<br />

Creating <strong>and</strong> Destroying Color Spaces 12.3<br />

Values for Color Channels 12.5<br />

Basic Color Spaces 12.5<br />

Advanced Color Spaces 12.8<br />

Building Patterned Color Spaces 12.10<br />

Conversion between Models 12.12<br />

13 Annotations <strong>and</strong> Links 13.1<br />

Overview 13.2<br />

Annotation Components 13.2<br />

Modifying the Link Cos Object 13.8<br />

14 Bookmark Creation 14.1<br />

Overview 14.2<br />

15 Digital Signatures 15.1<br />

Overview 15.2<br />

Public <strong>and</strong> Private Keys 15.2<br />

Digital Signature Calls 15.3


Table of Contents<br />

TOC.iii<br />

16 Error Testing <strong>and</strong> Recovery 16.1<br />

Overview 16.2<br />

OS/390 Platform Concerns 16.3<br />

17 Samples <strong>and</strong> Links 17.1<br />

Running <strong>DLI</strong> Sample Applications 17.2<br />

A <strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.1


TOC.iv <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong>


1<br />

Getting Started<br />

This chapter introduces the <strong>Datalogics</strong> Interface.<br />

Experienced users may want to skip directly to the section<br />

“What’s New in This Release” on page 1.8 for<br />

information on the latest enhancements <strong>and</strong> additions.<br />

1.1


1.2 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

An Introduction to <strong>DLI</strong><br />

The <strong>Datalogics</strong> Interface (<strong>DLI</strong>) facilitates the rapid creation of PDF documents <strong>and</strong> improves<br />

performance, throughput <strong>and</strong> graphics h<strong>and</strong>ling. It does this by bypassing many of the functions of the<br />

PDF Edit layer <strong>and</strong> eliminating redundant calls to the COS layer used in the Adobe® PDF Library. For<br />

information on the various layers of Adobe PDF Library please see the Acrobat Core API Overview.<br />

How to Create a PDF Document with <strong>DLI</strong><br />

The <strong>DLI</strong> package exists at the output end of the page creation process. As such, most of the intricacies of<br />

line breaking, page breaking <strong>and</strong> general composition are outside of its scope.<br />

The process of writing pages is where this package fits into an application. An overview of this process<br />

follows:<br />

1 Initialize <strong>DLI</strong>. (start of all processing)<br />

2 Define the document.<br />

3 Define fonts: i.e. Identify <strong>and</strong> describe each font to be used in the job to <strong>DLI</strong>. These can be done as<br />

encountered, if so desired.<br />

4 Define forms: i.e. Identify <strong>and</strong> describe each form to be used in the job to <strong>DLI</strong>. These can be done as<br />

encountered, if so desired.<br />

5 Define graphics: i.e. Identify <strong>and</strong> define each graphic to be used multiple times to <strong>DLI</strong>. These can be<br />

done as encountered, if so desired.<br />

6 For each page:<br />

• Create a dlpdfpage object.<br />

• Create a dlpdfcontent object.<br />

7 Generate the content of a single page:<br />

• For each graphic reference on the page, create the graphic in content.<br />

• For each text line on the page, create the text in content.<br />

8 End the content <strong>and</strong> inform <strong>DLI</strong> that the content is complete.<br />

9 End the page <strong>and</strong> inform <strong>DLI</strong> that the page is complete.<br />

10 End the document.<br />

11 End the job.<br />

Error h<strong>and</strong>ling during application execution is h<strong>and</strong>led through the raising <strong>and</strong> h<strong>and</strong>ling of exceptions, as<br />

defined by the Adobe PDF Library. These are similar to operation exceptions in C++. For details on<br />

h<strong>and</strong>ling exceptions, please see the chapter “Error Testing <strong>and</strong> Recovery” on page 16.1.


Getting Started 1.3<br />

What You Should Know<br />

This document is intended for programmers who are familiar with text composition <strong>and</strong> the creation of<br />

output drivers, or by application designers who are constructing an application based on the <strong>DLI</strong><br />

package.<br />

You should have access to the Adobe PDF Library Applications Programming Interface (API) manual <strong>and</strong><br />

the Adobe PDF Specifications manual for your system.<br />

For Adobe PDF Library v6.x releases, Adobe PDF Specification 1.5 is appropriate.For Adobe PDF<br />

Library v7.x releases, Adobe PDF Specification 1.6 is appropriate.<br />

NOTE: Some structures permitted in Adobe PDF Specification 1.6 may not be<br />

permitted in Adobe PDF Specification 1.5, <strong>and</strong> some structures defined in Adobe<br />

PDF Specification 1.5 are not available in Adobe PDF Specification 1.4.<br />

The explanations, assumptions <strong>and</strong> samples provided in this guide refer to Adobe PDF Library v7.0.0Plus<br />

<strong>and</strong> <strong>DLI</strong> v7.0 or higher.<br />

<strong>DLI</strong> Initialization Required<br />

Starting with <strong>DLI</strong> v2.1, the initialization process was simplified to enable initialization of the Adobe PDF<br />

Library automatically when <strong>DLI</strong> itself was initialized. Though it may be functionally possible to bypass<br />

the initialization of <strong>DLI</strong> for versions 2.1 <strong>and</strong> higher, an application should not do so. Using the <strong>DLI</strong><br />

initialization <strong>and</strong> termination routines not only simplifies application programming but also allows the<br />

use of the <strong>Datalogics</strong> Files In Memory (FIM) System, <strong>and</strong> the enabling of certain optimizations in jobs<br />

which span multiple documents.<br />

NOTE: The Adobe PDF Library <strong>and</strong> <strong>DLI</strong> are not intended to be initialized more than<br />

once within a single instance of an application. Doing so can produce undesirable<br />

results. Versions of Adobe PDF Library prior to v6.1 are not thread-safe.<br />

gcc Compilation Version<br />

Adobe compiles their PDF Library components with gcc 3.2 on the Solaris® <strong>and</strong> Linux® operating<br />

systems, <strong>and</strong> with Visual Age (xlC) 6.0 on the AIX® system. <strong>Datalogics</strong> does not recompile Adobe<br />

components on any other compiler on these operating systems. This information is subject to change at<br />

any time, so for the latest details on supported operating-system compilers <strong>and</strong> versions, please see the<br />

readme.txt file of last-minute updates accompanying your software release files, or the <strong>Datalogics</strong><br />

website System Requirements page at http://www.datalogics.com/pdflibraryrequirements.asp.


1.4 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Unix Compiler Run-Time Libraries<br />

For clients who are using native (i.e. platform-resident) UNIX® compilers, the run-time libraries for each<br />

of these operating systems are available from the Free Software Foundation. Any clients wishing to<br />

integrate the Adobe PDF Library <strong>and</strong> <strong>DLI</strong> components with their natively-compiled applications can<br />

retrieve these run-time libraries free of charge from the Free Software Foundation at http://<br />

www.gnu.org/software/gcc/.<br />

How to Use this Book<br />

This book has been created to guide you through the process of creating PDF documents with <strong>DLI</strong>. It<br />

consists of two main sections:<br />

• An <strong>Implementation</strong> section<br />

• A <strong>Reference</strong> <strong>Guide</strong> appendix<br />

The <strong>Implementation</strong> section begins with Chapter 1: Getting Started. It follows the steps needed to create<br />

PDF <strong>and</strong> introduces <strong>DLI</strong> in relation to the Adobe PDF Library, explains the methods used in <strong>DLI</strong>, how<br />

they fit together, <strong>and</strong> provides various samples.<br />

The <strong>Reference</strong> <strong>Guide</strong> appendix lists all <strong>DLI</strong> methods alphabetically.<br />

Each function or method listed in the first section of this manual, wherever it occurs, is linked to the same<br />

function or method in the second section. In some cases you may find references to a particular function<br />

appearing in several chapters of this document, depending on the context, <strong>and</strong> the function may be used<br />

for (<strong>and</strong> explained for) different purposes within each chapter. Click the function name to go to the more


Getting Started 1.5<br />

detailed reference information, which will provide full explanation of each, a full listing of calling<br />

parameters <strong>and</strong> return values, <strong>and</strong> any Technical Notes which may apply.<br />

You may also find a separate, st<strong>and</strong>alone /Codesamples folder in your documentation files which<br />

contains additional ASCII-text coding samples.<br />

NOTE: The files in the /Codesamples folder, if present, are not intended to be<br />

buildable source as-is, only to be demonstrations of correct comm<strong>and</strong> syntax for<br />

different purposes.<br />

Finally, the <strong>DLI</strong> release also includes a collection of complete, buildable sample applications, explained in<br />

the "Samples <strong>and</strong> Links" chapter following.<br />

The following list provides an outline of the chapters as well as a brief description of their contents. Click<br />

on the Chapter title below to jump to its first page.<br />

Chapter 1: "Getting Started" (This chapter) This chapter introduces the Adobe PDF Library <strong>and</strong><br />

<strong>DLI</strong>, including an overview of page creation, <strong>and</strong> describes the contents of this book, including<br />

enhancements in new releases of <strong>DLI</strong>.<br />

Chapter 2: "Initializing <strong>and</strong> Terminating the Library" describes initialization <strong>and</strong> termination<br />

of the Adobe PDF Library.<br />

Chapter 3: "Beginning <strong>and</strong> Ending a Document" describes all of the methods used to begin <strong>and</strong><br />

end a document.<br />

Chapter 4: "Fonts" discusses creation <strong>and</strong> arrangement of fonts.<br />

Chapter 5: "Multibyte Text Work" discusses the <strong>DLI</strong> methods available for creating <strong>and</strong><br />

manipulating multibyte text.<br />

Chapter 6: "Working with Pages" <strong>DLI</strong> assumes that pages will be added to the end of the document<br />

only. A page is represented by a data structure named DLPDFPAGE. This chapter explains the Page<br />

Interface <strong>and</strong> defines the calls available at this level.<br />

Chapter 7: "Containers within Pages" describes containers within pages, <strong>and</strong> provides examples of<br />

various applications.<br />

Chapter 8: "Working with Content" The Content Interface contains the bulk of the interface. At<br />

this level, you make marks on paper. Those marks may be on a Page or on a Forms XObject. They may be


1.6 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

text, line drawings or images. A content element is represented by the structure DLPDFCONTENT. This<br />

chapter explains the Content Interface <strong>and</strong> defines the calls available at this level.<br />

Chapter 9: "Working with Forms" Forms XObjects are represented via the structure<br />

DLPDFFORM. This chapter explains forms, <strong>and</strong> defines the calls available.<br />

Chapter 10: "Displaying Line Drawings" describes line drawings <strong>and</strong> the different approaches,<br />

including directly-drawn <strong>and</strong> path-drawn methods.<br />

Chapter 11: "Image Display" describes images as a predefined collection of shapes <strong>and</strong> colors.<br />

Chapter 12: "Color <strong>and</strong> its Use" discusses Adobe PDF Library color descriptions, colors in images,<br />

creating <strong>and</strong> destroying color spaces, patterned color spaces <strong>and</strong> more.<br />

Chapter 13: "Annotations <strong>and</strong> Links" describes creating annotations <strong>and</strong> how to modify the Link<br />

COS Structure.<br />

Chapter 14: "Bookmark Creation" describes bookmark creation <strong>and</strong> the steps involved.<br />

Chapter 15: "Digital Signatures" explains the process of adding a digital signature to a document,<br />

<strong>and</strong> outlines the methods for use.<br />

Chapter 16: "Error Testing <strong>and</strong> Recovery" discusses possible errors you may encounter <strong>and</strong> how<br />

to resolve them.<br />

Chapter 17: "Samples <strong>and</strong> Links" provides full program samples which have been compiled <strong>and</strong><br />

tested to illustrate various aspects of the Adobe PDF Library <strong>and</strong> <strong>DLI</strong>.<br />

Appendix A: "<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong>" provides an alphabetical listing of all methods used in <strong>DLI</strong>.<br />

Document Conventions<br />

The terms note, link <strong>and</strong> bookmark are used in this book the same way they are in the user interface of<br />

Adobe PDF Library v7.x.xPlus®, Adobe Acrobat® <strong>and</strong> Adobe Reader®. These correspond to the text


Getting Started 1.7<br />

annotation, link annotation <strong>and</strong> routine entry structures (respectively) that appear in a PDF file. See the<br />

Portable Document Format <strong>Reference</strong> Manual for a description of the PDF file format.<br />

The following documentation conventions appear throughout the manual to help you differentiate regular<br />

text from product <strong>and</strong> program names, <strong>and</strong> to distinguish comm<strong>and</strong> syntax.<br />

• Product <strong>and</strong> program names are set in italic type.<br />

• Multi-line examples are separated from the text <strong>and</strong> set in<br />

Courier monospace<br />

• Directory names <strong>and</strong> filenames are contained within the text <strong>and</strong> set in Courier monospace.<br />

• Comm<strong>and</strong>s are contained within the text <strong>and</strong> set in blue Courier monospace. In most cases, if you<br />

are reading this document in PDF form via Adobe Acrobat or Adobe Reader, clicking on a <strong>DLI</strong><br />

comm<strong>and</strong> will jump you to the <strong>Reference</strong> <strong>Guide</strong> appendix for full information on that comm<strong>and</strong>.<br />

• New terms are italicized.<br />

• Page numbers in this book do not correspond to page numbers in the PDF file. The numbering scheme<br />

(e.g. 4.1 or A.10) indicates the chapter number (4) or appendix letter (A) first, followed by the page<br />

number (1 or 10), separated by a period.<br />

Related Documentation<br />

The following documents will be useful in developing applications using <strong>DLI</strong>.<br />

<strong>Datalogics</strong> Resources<br />

Adobe PDF Library <strong>and</strong> <strong>DLI</strong> Installation <strong>Guide</strong> This document describes the installation<br />

requirements for using the Adobe PDF Library <strong>and</strong> <strong>DLI</strong> on the various platforms to which <strong>Datalogics</strong> has<br />

ported these products.<br />

Adobe PDF Library Developer Overview This document is designed to aid developers with<br />

incorporating the API calls for the Adobe PDF Library into their composition application.<br />

<strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong> (This book) This document details the <strong>Datalogics</strong><br />

Interface, a simplified interface to the COS Layer of the Adobe PDF Library.<br />

Java Interface User <strong>Guide</strong> This document details the <strong>Datalogics</strong> Java Interface, a Java-language<br />

wrapper interface to the Adobe PDF Library <strong>and</strong> <strong>DLI</strong>.<br />

Adobe Resources<br />

The following documents are distributed by Adobe as part of the original Adobe PDF Library release, <strong>and</strong><br />

are redistributed by <strong>Datalogics</strong> without alteration. These <strong>and</strong> other documents may also be found on the


1.8 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Adobe website at http://partners.adobe.com/asn/acrobat/technotes.jsp. (Descriptions<br />

below are provided by Adobe as part of their original accompanying readme.txt file.)<br />

NOTE: Adobe Solutions Network (ASN) membership may be required in order to<br />

access some material on the Adobe website. See http://<br />

partners.adobe.com/asn/programs/developer/index.jsp for<br />

more details.<br />

Portable Document Format <strong>Reference</strong> Manual This document describes PDF St<strong>and</strong>ard 1.6<br />

specifications. The latest version may be found at http://partners.adobe.com/public/<br />

developer/pdf/index_reference.html.<br />

NOTE: Adobe also provides an accompanying errata file for this manual, with lastminute<br />

updates <strong>and</strong> corrections. One copy is provided with this documentation<br />

(see your documentation file folder), <strong>and</strong> you can check for newer copies at<br />

http://partners.adobe.com/public/developer/en/pdf/<br />

PDF16Errata.pdf<br />

Adobe PDF Library Overview Technical Note #5189 provides background information <strong>and</strong><br />

development information for the Adobe PDF Library. Read this document before beginning development<br />

for information such as supported platforms, known issues <strong>and</strong> development requirements.<br />

Acrobat Core API Overview Technical Note #5190 provides an overview of the Acrobat API in<br />

general. It covers information applicable to both Plug-in development <strong>and</strong> Library development. Read this<br />

document to obtain an underst<strong>and</strong>ing of how the Acrobat API is organized.<br />

Acrobat Core API <strong>Reference</strong> Technical Note #5191 is the reference manual for all of the Acrobat<br />

API methods made available by the Adobe Acrobat viewer. It documents the parameters, return values<br />

<strong>and</strong> availability of each method, as well as specific implementation notes. This document is useful while<br />

developing with the Adobe PDF Library or planning development to determine method availability <strong>and</strong><br />

capabilities.<br />

PDF Library Supplement to the Acrobat Core API Technical Note #5414 complements the<br />

Acrobat Core API <strong>Reference</strong> <strong>and</strong> is specific to the Adobe PDF Library API methods. This is an important<br />

<strong>and</strong> useful document for all Adobe PDF Library developers.<br />

What’s New in This Release<br />

This section contains highlights of new additions <strong>and</strong> enhancements to <strong>DLI</strong> v7.0. You should also check<br />

the accompanying Release Notes file (typically ReleaseNotes.pdf) <strong>and</strong> readme.txt files (one each<br />

accompanies the software release files <strong>and</strong> the documentation files in their respective folders or<br />

directories) if present. Release Notes contain fixes <strong>and</strong> enhancements usually resulting from past problem


Getting Started 1.9<br />

reports; the readme.txt files typically contain last-minute information on the current release of the<br />

software or the documentation files.<br />

Minor version upgrades may be made as running changes rather than full releases, so the version or subversion<br />

number of your release may be newer than those listed here. See the accompanying readme.txt<br />

file for the very latest changes <strong>and</strong> enhancements.<br />

Revised <strong>DLI</strong> Version Numbering<br />

Beginning with the Adobe PDF Library v7.x releases, <strong>DLI</strong> version numbering has been revised upwards<br />

from the previous v3.x series to a new v7.x series, to better correspond with Adobe’s own versioning of<br />

their Acrobat product lines.<br />

What’s New in Previous Releases<br />

A summary of enhancements in prior releases follows below. See the relevant chapters or the <strong>Reference</strong><br />

<strong>Guide</strong> appendix for full details on methods listed below.<br />

<strong>DLI</strong> v3.0 for Adobe PDF Library v6.x featured a number of changes, briefly outlined here.<br />

Adobe PDF Library Now Thread-Safe<br />

As of Adobe PDF Library v6.1.0Plus <strong>and</strong> <strong>DLI</strong> v3.0.11, the Library is now re-entrant, <strong>and</strong> therefore safe<br />

for multithreaded applications. See the following chapter <strong>and</strong> “Multi-Thread Initializations” on page 2.11<br />

for more information on thread-safety issues.<br />

Adobe PDF Library Version Control<br />

The Adobe PDF Library is a set of routines associated with other Adobe products such as Adobe Acrobat,<br />

Adobe Acrobat Distiller <strong>and</strong> Adobe Reader. The original Adobe PDF Library was labeled as version 1.2<br />

in order to maintain consistency with the PDF st<strong>and</strong>ard of 1.2. The next version of the Library was<br />

labeled version 4.0 (<strong>and</strong> subsequently 4.05) due to the tie-in with Acrobat v4.0. Versions 4.0/4.05 of the<br />

Library complied with the PDF st<strong>and</strong>ard of 1.3. Adobe PDF Library v5.0.2Plus complied with PDF<br />

St<strong>and</strong>ard 1.4, Adobe PDF Library v6.x complied with PDF St<strong>and</strong>ard 1.5, <strong>and</strong> so on.<br />

PDF Level Declarations in Output<br />

By default, the Adobe PDF Library declares the current PDF level compliance in output PDF files; e.g.<br />

Adobe PDF Library v7.x applications building pages without <strong>Datalogics</strong> Interface methods will generate


1.10 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

PDF v1.6. Applications generating output via <strong>DLI</strong> may generate different PDF declarations depending on<br />

file contents <strong>and</strong> application coding; see below <strong>and</strong> “Adobe PDF Library Version Control” on page 2.5<br />

for more details.<br />

NOTE: Viewing a latest-generation PDF in a prior-version Adobe Acrobat or Adobe<br />

Reader (e.g. viewing PDF v1.5 in Acrobat or Reader v5.0 or earlier) can produce a<br />

popup warning of a PDF level mismatch, to warn the user that certain PDF features<br />

new to that version may not be supported by the viewing program. While this is<br />

only a warning, it may concern some users who have not upgraded to the latest<br />

viewer. You should ensure that your document features are backwards-compatible<br />

to older viewer versions where possible, or warn your users that a viewer upgrade<br />

will be required in order to take full advantage of features in your document, as<br />

appropriate.<br />

PDF Level Declarations via <strong>DLI</strong><br />

Applications built with Adobe PDF Library <strong>and</strong> <strong>Datalogics</strong> Interface (e.g. Adobe PDF Library v6.1.1Plus<br />

<strong>and</strong> <strong>DLI</strong> v3.0.19) <strong>and</strong> using <strong>DLI</strong> methods for output will have their output PDF compliance set<br />

appropriately by <strong>DLI</strong>. Unlike Library output, which will always declare the highest compliance level<br />

supported by the Library, files generated by <strong>DLI</strong> methods will declare the lowest PDF compliance level<br />

necessary for proper h<strong>and</strong>ling of the document. By default, files will identify themselves as PDF v1.3<br />

compliant, <strong>and</strong> only declare a higher level if the file really does contain higher-level PDF functionality.<br />

(e.g. Output containing Optional Content Groups will declare PDF v1.5 compliance instead.) Some<br />

further explanation can be found under “Selecting PDF Level Declarations via <strong>DLI</strong>” on page 2.6.<br />

Digital Signature Support<br />

New methods are now available for adding Digital Signatures to your documents, <strong>and</strong> a chapter on the<br />

subject has been added to this manual. See “Digital Signatures” on page 15.1 for more details.


Getting Started 1.11<br />

Enhanced Unicode Support<br />

Unicode support included in <strong>DLI</strong> underwent significant revision for the v3.x series. <strong>Datalogics</strong> now ships<br />

with International Components for Unicode (ICU) modules, which provide a number of benefits for users,<br />

including:<br />

• Complete TrueType, OpenType <strong>and</strong> TrueType/OpenType Collection font file support<br />

• Support for all major Unicode encoding schemes, as well as hundreds of Chinese/Japanese/Korean/<br />

Vietnamese <strong>and</strong> vendor-st<strong>and</strong>ard input formats<br />

• Support for right-to-left text ordering <strong>and</strong> automatic character combining using the Unicode<br />

BiDirectional algorithm<br />

• Faster <strong>and</strong> less-memory-intensive creation of Unicode fonts<br />

• Text output in PDF content areas as Unicode<br />

NOTE: Since Unicode font creation does not use the Adobe PDF Library to locate<br />

fonts, customers must now explicitly load fonts intended for Unicode into a<br />

DLPDFINSTANCE before use. Additionally, users must be able to specify the<br />

system location where these fonts reside. See the <strong>DLI</strong> sample application<br />

WideText for a demonstration of loading <strong>and</strong> using Unicode fonts.<br />

Addition of DLPDFTEXT Structure<br />

In support of the revised Unicode architecture, the object DLPDFTEXT has been created. This is a reusable<br />

container for text: an input string is supplied to DLPDFTEXT creation calls in an input encoding. The<br />

DLPDFTEXT object stores this text in Unicode UTF-16 format, with Big-endian or Little-endian<br />

orientation depending on the host platform.<br />

<strong>DLI</strong> Initialization now Required<br />

Initialization of <strong>DLI</strong> is now required; support for using <strong>DLI</strong> without initialization has been removed. If<br />

you intend to use <strong>DLI</strong> methods in your application, you must intialize <strong>DLI</strong> via dlpdfinit. <strong>DLI</strong> users<br />

should initialize the Adobe PDF Library through the <strong>DLI</strong> initialization call; PDFLInit <strong>and</strong> PDFLTerm<br />

should never be directly called from a <strong>DLI</strong> application.<br />

All <strong>DLI</strong> documents require an instance for creation. The dlpdfdoccreatewithinstance call has<br />

been removed from the API, <strong>and</strong> the dlpdfinit <strong>and</strong> dlpdfdoccreate call have been modified<br />

significantly (see “Updated Functions” on page 1.14). <strong>DLI</strong> should only be initialized once per process.<br />

Streaming PostScript Removed<br />

All PostScript output is produced using the Adobe PDF Library. Support for streaming PostScript created<br />

by <strong>DLI</strong> has been removed. This facility was previously deprecated in the <strong>DLI</strong> v2.2 series.


1.12 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

PDF Image Import Improvements<br />

PDF image import has been enhanced as of <strong>DLI</strong> v3.0.13. The value of the imported PDF file's Rotate<br />

key, if present, is now honored. Images are imported by <strong>DLI</strong> <strong>and</strong> placed in the rotated orientation<br />

displayed by Adobe Reader <strong>and</strong> Acrobat.<br />

For the dlpdfimagecreatefrompdf call, a value of 0 is now accepted for the Width <strong>and</strong> Depth<br />

parameters. If either are 0, then the PDF page's crop box is used to form the DLPDFIMAGE's visible<br />

region. This will be shifted using the XDisp <strong>and</strong> YDisp values to generate the imported image.<br />

New Functions<br />

dlpdfmemfiledeleteonclose<br />

This method marks a Files In Memory (FIM) file to be removed from the filesystem once the last open<br />

fileh<strong>and</strong>le for the file has been closed.<br />

NOTE: No file is automatically removed from memory, unless<br />

dlpdfmemfiledeleteonclose has been called for a specific MDFile.<br />

dlpdfmemfilesetbuffer<br />

This method configures Files In Memory to directly use the buffer passed in as the file contents.<br />

dlpdfmemfilesyssetmemlimit<br />

This method establishes an upper bound, in bytes, of the memory usage allowed for file contents by <strong>DLI</strong>.<br />

dlpdfmemfilesysgetmemusage<br />

This returns an ASSize_t with the current usage, in bytes, of memory for file contents.


Getting Started 1.13<br />

dlpdfdoccreatesignature<br />

dlpdfdocsetsignatureappearance<br />

dlpdfpageplacesignature<br />

dlpdfsignaturesetdatacallback<br />

dlpdfsignaturesetpkcs7cert<br />

dlpdfsignaturesetx509cert<br />

These new methods support Digital Signatures in documents. See the chapter on “Digital Signatures” on<br />

page 15.1 for more details.<br />

dlpdfdocasciips<br />

This method was added to support creation of PostScript output suitable for transmission through<br />

channels <strong>and</strong> to devices which do not accept binary data. Most PostScript printers cannot properly<br />

process binary PostScript input; Distiller <strong>and</strong> most print spoolers will accept binary PostScript data.<br />

dlpdfinstancesetgrcachelimits<br />

This method was added to support customers who would like to limit the amount of filesystem storage<br />

used for the <strong>DLI</strong> graphics cache. This accepts a low-water <strong>and</strong> a high-water mark, in bytes. If the graphics<br />

cache reaches the high-water mark, graphics will be removed from the cache in least recently used (LRU)<br />

order. Graphics will be removed until the cache falls to or below the low-water mark.<br />

dlpdftext<br />

This creates a DLPDFTEXT area from a string of a given length (in bytes) <strong>and</strong> an encoding.<br />

dlpdftextshowencodingnames<br />

This method can be used to obtain a list of valid Encoding names provided via the International<br />

Components for Unicode (ICU) module, for use when calling dlpdftext.<br />

dlpdftextfromutf8<br />

dlpdftextfromutf16le<br />

dlpdftextfromutf16be<br />

dlpdftextfromutf16he<br />

dlpdftextfromutf32le<br />

dlpdftextfromutf32be<br />

dlpdftextfromutf32he<br />

These are convenience functions for common Unicode encodings.


1.14 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdftextadvance<br />

This supplies the x <strong>and</strong> y advance for a string in a DLPDFTEXT area.<br />

dlpdftextstring<br />

dlpdftextlength<br />

dlpdftextstring returns the byte buffer for the stored string. dlpdftextlength returns the length,<br />

in bytes, of this buffer.<br />

dlpdftexttocontent<br />

This pastes the DLPDFTEXT string into a DLPDFCONTENT area.<br />

dlpdftextdestroy<br />

This method destroys a DLPDFTEXT area.<br />

dlpdfttload<br />

This method loads the font from a TrueType or OpenType font file, or the fonts from a TrueType/<br />

OpenType Collection font file. These fonts are loaded into the supplied DLPDFINSTANCE. Fonts loaded<br />

in this manner are used before searching the system directories for fonts.<br />

NOTE: This method does not fully support Adobe CFF-format OpenType font files.<br />

CMaps as defined in the PDF <strong>Reference</strong> Manual should be used for these fonts.<br />

<strong>Datalogics</strong> recommends creating them as CIDType0 fonts, using<br />

dlpdfcontentwidetext for setting text.<br />

Updated Functions<br />

dlpdfinit<br />

This has been revised significantly, <strong>and</strong> now requires three parameters:<br />

• the PDFLData pointer containing Adobe PDF Library initialization data<br />

• the default file system to use, or NULL for the Adobe PDF Library default filesystem<br />

• NULL; reserved for future use as an optional argument<br />

The <strong>DLI</strong> graphics cache has been enhanced to use the default ASFileSys implementation provided to<br />

dlpdfinit for caching graphics. By default, the graphics cache file size is limited to 1.5GB. Customers


Getting Started 1.15<br />

who wish to use larger graphics cache files are advised to supply a filesystem to dlpdfinit which is<br />

capable of reliably h<strong>and</strong>ling files of the larger size.<br />

dlpdfdoccreate<br />

This call no longer accepts a PostScript filename. (Use dlpdfdocsetpsname, or supply one to<br />

dlpdfdocwritePS.) The PDFNeeded flag has been removed; PDF processing is always performed. It<br />

accepts one parameter, the DLPDFINSTANCE to use for the document.<br />

dlpdfterm<br />

This call now removes memory files used for the dlpdfttload call if the Files In Memory system is<br />

used, <strong>and</strong> if these files are no longer in use.<br />

Deleted Functions<br />

dlpdfdocsevenbitsafe<br />

This method was not able to guarantee a PDF output stream safe for a seven-bit channel. The PDF<br />

specification refers to PDF as a binary format, <strong>and</strong> expects that consumers are able to accept a binary<br />

input stream.<br />

dlpdfdocHexGraphics<br />

was an API for debugging graphic output. In the <strong>DLI</strong> v2.2.x series, this was disabled.<br />

dlpdfdocsetformsascontent<br />

...<strong>and</strong>...<br />

dlpdfimageplaceascontent<br />

...were not able to generate correct PDF output for some imported PDF files. This functionality was not<br />

widely used, <strong>and</strong> these methods have been removed.<br />

dlpdfdocsetembedappwidth<br />

This method has been removed as fonts will, with the exception of the "st<strong>and</strong>ard" 14 fonts, always have<br />

their widths included in the PDF font if the font is present on the system on which a job is run, or if these<br />

widths are supplied to <strong>DLI</strong>.


1.16 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfdocseterrorfile<br />

...<strong>and</strong>...<br />

dlpdfdocsetwarningfile<br />

...are no longer supported. Functions which need to communicate errors will raise an ASException as<br />

required.<br />

dlpdfdoccreatewithinstance<br />

This has been replaced by a revised dlpdfdoccreate call. Since <strong>DLI</strong> initialization is required for v3.x<br />

releases, the dlpdfdoccreate call accepts a DLPDFINSTANCE. See “Updated Functions” on page<br />

1.14 for details.<br />

dlpdffontverifytext<br />

Given a font <strong>and</strong> a string of text, this method would ensure that every Unicode character had a valid glyph<br />

ID associated with it. Because Unicode is now h<strong>and</strong>led in the DLPDFTEXT structure <strong>and</strong> not the font, this<br />

method was no longer needed.<br />

dlpdfsetlevel<br />

This method is now reserved for internal use. Although its function has not changed from prior releases, it<br />

is no longer supported for applications built with <strong>DLI</strong>.<br />

<strong>DLI</strong> v2.2.13<br />

Default Search Path Suppression Exp<strong>and</strong>ed to All Platforms<br />

The enhancement first provided with the Adobe PDF Library v5.0.2Plus <strong>and</strong> <strong>DLI</strong> v2.2.12 release for a<br />

method of suppressing the default search path for AdobeFnt.lst on Unix platforms (see “Default<br />

Search Path Suppression” on page 1.17 below) is now exp<strong>and</strong>ed to all platforms.<br />

Image Search using Files In Memory<br />

<strong>DLI</strong> now searches the default ASFileSys (whichever filesystem was selected by the application) for<br />

graphic files, instead of automatically searching only the disk. (Graphic conversions are still cached to a<br />

temporary file on a physical file system.)


Getting Started 1.17<br />

1 Set the default file system to dlpdfmemfilesys.<br />

2 Create a file in the Files In Memory filesystem, <strong>and</strong> use dlpdfmemfilesetdata to make a region of<br />

memory into the file-in-memory.<br />

3 Call dlpdfimagecreatefromfile with the name of the file-in-memory.<br />

4 Set the default file system back to the original default, if files-in-memory is not being used for anything<br />

else.<br />

NOTE: Users currently using Files-In-Memory in their application but assuming<br />

that images are always retrieved from disk may need to modify their applications.<br />

They should either bring the images from disk into memory, or deliberately switch<br />

the default filesystem to disk temporarily, in order to pull in the graphic(s) before<br />

continuing with further processing.<br />

<strong>DLI</strong> v2.2.12<br />

Default Search Path Suppression<br />

An enhancement has been added to enable the Adobe PDF Library to ignore its default search path<br />

(which varies somewhat from one platform to another) when compiling its list of resources at<br />

initialization time on Unix platforms. This is done by adding a PDFLDataRec.flags member to<br />

PDFLInit/dlpdfinit, which can be filled with a kPDFLInitIgnoreDefaultDirectories value.<br />

This will stop the Library from searching the current working directory on startup, or writing<br />

AdobeFnt.lst entries on shutdown.


1.18 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong>


2<br />

Initializing<br />

<strong>and</strong> Terminating the<br />

Library<br />

The procedure for initializing <strong>DLI</strong> <strong>and</strong> the Adobe PDF<br />

Library defines font locations, memory management<br />

routines <strong>and</strong> resource allocation in preparation for<br />

document processing.<br />

2.1


2.2 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Overview<br />

The <strong>DLI</strong> initialization process has been simplified such that when <strong>DLI</strong> is initialized, it automatically<br />

initializes the Adobe PDF Library as well. Initialization via <strong>DLI</strong> also provides the option of enabling the<br />

<strong>Datalogics</strong> Files In Memory (FIM) system, by specifying a file system to be used for temporary files <strong>and</strong><br />

for file input/output operations.<br />

<strong>DLI</strong> must be initialized before creating any documents with <strong>DLI</strong> or making any calls to the Adobe PDF<br />

Library, should be initialized only once per composition program run, <strong>and</strong> should be terminated prior to<br />

the application shutdown.<br />

Adobe PDF Library Data Structure<br />

Initialization of <strong>DLI</strong> <strong>and</strong> the Adobe PDF Library requires a specific collection of information, maintained<br />

in the data structure PDFLDataRec. One such structure should be created <strong>and</strong> cleared to zeros before<br />

starting the Adobe PDF Library. The next few sections deal with settings of parts of this structure to<br />

prepare for initializing <strong>DLI</strong> <strong>and</strong> the Adobe PDF Library.<br />

Setting Resource Directories<br />

The PDFLDataRec record contains two fields (dirList <strong>and</strong> listLen) which are used to establish a list<br />

of paths to be searched for font resources, its AdobeFnt.lst file. (See “The AdobeFnt.lst File”<br />

below.)<br />

NOTE: <strong>DLI</strong> does not search directory paths or environmental variable entries for<br />

fonts loaded via dlpdfttload.<br />

The resource directory listing (the PDFLDataRec record ) should not be used in OS/390, but may be used<br />

in all other platforms. This list is constructed by allocating an array of pointers to strings, <strong>and</strong> filling each<br />

pointer with a pointer to a path.<br />

The field dirList should be set to point to this array. The field listLen should be set to the number of<br />

entries in the above array. Examples of this usage can be found in the accompanying <strong>DLI</strong> sample<br />

applications.<br />

The AdobeFnt.lst File<br />

The process (your Adobe PDF Library application, <strong>and</strong> also Adobe Acrobat or Adobe Reader) compiles<br />

an AdobeFnt.lst file for its own use when either constructing a PDF document or rendering/displaying


Initializing <strong>and</strong> Terminating the Library 2.3<br />

it later, for Adobe PDF Library <strong>and</strong> Adobe Acrobat applications respectively. It consists primarily of font<br />

information within files found on your machine. (Its actual name varies by product, platform or release<br />

level as AdobeFnt.lst, AdobeFnt07.lst or AdobeFnt08.lst, <strong>and</strong> possibly others; we will refer to<br />

it generically as AdobeFnt.lst here.)<br />

You should find that the AdobeFnt.lst file is only compiled if one is not already present, or if any file<br />

in the directory is timestamped more recently than the AdobeFnt.lst file itself. The creation time does<br />

of course go up if many files are present. The file is not recompiled every time the application is run, only<br />

when certain conditions are met as described above.<br />

For efficiency, try to minimize the number of files that must be searched. You can do this by running the<br />

application from another location, so that the current working directory is one with very few files in it, or<br />

alternatively make use of the kPDFLInitIgnoreDefaultDirectories flag (see “Default Search Path<br />

Suppression Exp<strong>and</strong>ed to All Platforms” on page 1.16 for further details). You must still ensure that the<br />

application gets a list of directories where its resources will be found.<br />

Since the AdobeFnt.lst file is a plaintext file, compiled on an as-needed basis by the application, you<br />

can review its contents in a text editor at any time to verify that it is finding the resources needed. Since it<br />

is possible to have many copies of AdobeFnt.lst scattered about (one may be created whenever an<br />

application is run in a new working directory for the first time), if there is any doubt as to which<br />

AdobeFnt.lst is in use by the application, you are free to delete the existing copies (or temporarily<br />

rename them in order to hide them), run the application again, <strong>and</strong> then look to see where a new copy has<br />

appeared. Reviewing that file will show you the resources found by that instance of the application.<br />

More information on this for each platform can be found in the Adobe PDF Library Overview, page 21<br />

(February 7, 2005 edition), under the subheading "Initialization Details."<br />

Setting Memory Allocation Routines<br />

You may wish to use this portion of the PDFLDataRec record when your application contains a memory<br />

allocation/deallocation schema that you want the Adobe PDF Library to share. In particular, if your


2.4 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

application does not use the system malloc/calloc/free routines, which the Adobe PDF Library will<br />

use by default, you may want to use this section.<br />

Control of memory allocation is accomplished by the creation of a new record (TKAllocatorProcs).<br />

You must allocate space for this record <strong>and</strong> fill in all of the fields in this record if you wish to establish<br />

your own memory manager.<br />

There are several procedures pointed to by this record:<br />

• allocProc — a routine to allocate memory<br />

• reallocProc — a routine to increase the size of an allocated block of memory<br />

• freeProc — a routine to free memory<br />

• memAvailProc — a routine that returns the amount of memory which may be requested without an<br />

error occurring<br />

The definitions of the interfaces for these procedures are contained in PDFInit.h. Basically, they are the<br />

interfaces for malloc (or calloc), realloc <strong>and</strong> free for st<strong>and</strong>ard UNIX. However, each contains as<br />

its first parameter a pointer to user data. This pointer is the fifth field of the TKAllocatorProcs record. See<br />

"Displaying a Square" in the Programs Links chapter for an example of setting these values.<br />

Setting Resource Allocation Routines<br />

The Adobe PDF Library contains a robust set of routines for locating resources. However, if your<br />

application wishes to control access to resources, this section is where such control is established.<br />

The TKResourceProcs record is similar to the TKAllocatorProcs record. It contains a pair of<br />

pointers to procedures for allocating <strong>and</strong> deallocating resources. The procedure interfaces are defined in<br />

PDFInit.h.


Initializing <strong>and</strong> Terminating the Library 2.5<br />

Adobe PDF Library Version Control<br />

There are two version issues that you may need to consider when building <strong>and</strong> running your application:<br />

the version of Adobe PDF Library <strong>and</strong> <strong>DLI</strong> in use, <strong>and</strong> the declared PDF version (or Compliance Level)<br />

being declared within the PDF output being generated.<br />

Obtaining Adobe PDF Library Version Number<br />

The version number of the Adobe PDF Library which was initialized may be obtained at any time after<br />

initialization as the return value of the method PDFLGetVersion:<br />

• The high-order 16 bits of the value are the Major Version Number<br />

• bits 8 through 15 are the Minor Version Number<br />

• bits 0 through 7 are the Sub-minor Version Number<br />

You may wish to have your application obtain <strong>and</strong> compare the returned Version Number to the constant<br />

kPDFLVersion to see if the version of the Adobe PDF Library being used at runtime is the same, greater,<br />

or less than the Version Number of with which it was compiled.<br />

PDF Level Declarations in Output<br />

PDF output files declare their compliance level with a particular version of the PDF St<strong>and</strong>ard; e.g.<br />

documents created with Adobe PDF Library v7.x can declare PDF v1.6. Applications reading, processing<br />

or displaying PDF output may inspect the declaration within the file to determine how to process it. In<br />

particular, Adobe Acrobat <strong>and</strong> Reader applications may produce a popup warning of possible<br />

unsupported PDF features if they detect that the declared PDF level of the document is higher than what<br />

they "know" to be the current PDF revision level at the time they were released.<br />

For example, Adobe Acrobat or Reader v6.x will generate a popup warning if it opens a document<br />

declaring PDF v1.6 compliance (output generated by Adobe PDF Library v7.x or similar). Adobe Acrobat<br />

or Reader v5.x will generate a similar warning for PDF v1.6 or v1.5, <strong>and</strong> so on, even if the document does<br />

not in fact contain any functionality unique to that higher PDF level. While this may seem like overkill,<br />

the default behavior of PDF utilities is to ignore coding that they do not underst<strong>and</strong>. Thus the popup<br />

warning is shown to the user to help avoid situations where high-level content may be quietly ignored by<br />

the utility, <strong>and</strong> the user does not notice the omission.<br />

The Adobe PDF Library is a set of routines associated with other Adobe products such as Adobe Acrobat,<br />

Adobe Acrobat Distiller <strong>and</strong> Adobe Reader. The original Adobe PDF Library was labeled as version 1.2<br />

in order to maintain consistency with the PDF st<strong>and</strong>ard of 1.2. The next version of the Library was<br />

labeled version 4.0 (<strong>and</strong> subsequently 4.05) due to the tie-in with Acrobat v4.0. Versions 4.0/4.05 of the<br />

Library complied with the PDF st<strong>and</strong>ard of 1.3. Adobe PDF Library v5.0.2Plus complied with PDF


2.6 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

St<strong>and</strong>ard 1.4, <strong>and</strong> Adobe PDF Library v6.x complied with PDF St<strong>and</strong>ard 1.5. Adobe PDF Library v7.x<br />

continues the same practice, complying with PDF St<strong>and</strong>ard 1.6.<br />

By default, the Adobe PDF Library declares the current PDF level compliance in output PDF files; e.g.<br />

Adobe PDF Library v7.x applications building pages without <strong>Datalogics</strong> Interface methods will generate<br />

PDF v1.6. In contrast, <strong>DLI</strong> output methods declare PDF v1.3 compliance unless the output file actually<br />

contains functionality introduced in a later version. (e.g. Optional Content Groups in PDF v1.5) Thus, if<br />

you generate your PDF output using Adobe PDF Library methods, the document will always declare the<br />

highest PDF version compliance; if you generate your output using <strong>DLI</strong> methods, it will declare PDF v1.3<br />

unless a higher compliance level is actually needed.<br />

Further description below applies only to PDF output generated via <strong>DLI</strong> methods.<br />

NOTE: Viewing a latest-generation PDF in a prior-version Adobe Acrobat or Adobe<br />

Reader (e.g. viewing PDF v1.6 in Acrobat or Reader v6.0 or earlier) can produce a<br />

popup warning of a PDF level mismatch, to warn the user that certain PDF features<br />

new to that version may not be supported by the viewing program. While this is<br />

only a warning, it may concern some users who have not upgraded to the latest<br />

viewer. You should ensure that your document features are backwards-compatible<br />

to older viewer versions where possible, or warn your users that a viewer upgrade<br />

will be required in order to take full advantage of features in your document, as<br />

appropriate.<br />

Selecting PDF Level Declarations via <strong>DLI</strong><br />

Applications built with Adobe PDF Library <strong>and</strong> <strong>Datalogics</strong> Interface (e.g. Adobe PDF Library v6.1.1Plus<br />

<strong>and</strong> <strong>DLI</strong> v3.0.19) <strong>and</strong> using <strong>DLI</strong> methods for output will have their output PDF compliance set<br />

appropriately by <strong>DLI</strong>. Unlike output generated solely by Adobe PDF Library methods, <strong>DLI</strong>-generated<br />

files will by default identify themselves as PDF v1.3 compliant in their simplest form, or higher values if<br />

appropriate, based on the functionality embedded in the document. You can manipulate this declared<br />

value yourself if desired.<br />

Overriding PDF Level Declarations via <strong>DLI</strong><br />

When generating PDF output, the internal PDF Compliance Level declaration to be issued is made up of<br />

two internal component values, pdfMajorVer <strong>and</strong> pdfMinorVer, which are members of the<br />

DLPDFDOC structure. pdfMajorVer defaults to 1, <strong>and</strong> when using <strong>DLI</strong> methods for PDF output,<br />

pdfMinorVer initially defaults to 3 (PDF v1.3, for Adobe Acrobat v4 compatibility). If higher-level<br />

functions are used within the output PDF document, the pdfMinorVer will be incremented as<br />

appropriate (e.g. to 4 or 5, representing PDF v1.4 or PDF v1.5 respectively). You can force the declared<br />

Compliance Level by assigning the value you desire to pdfMinorVer within your application.


Initializing <strong>and</strong> Terminating the Library 2.7<br />

Files In Memory Activation<br />

To increase the throughput of PDF generation, memory-mapped files may be used for temporary storage<br />

<strong>and</strong> for final output of the PDF content. Output of a PDF file to both memory <strong>and</strong> disk is also supported<br />

for environments where this feature is desired.<br />

In order to utilize Files In Memory (FIM), <strong>DLI</strong> must be initialized through the dlpdfinit function call,<br />

<strong>and</strong> the <strong>Datalogics</strong> memory file system must be passed to this function call. The memory file system may<br />

be obtained by calling the dlpdfmemfilesys function, detailed below (see “dlpdfmemfilesys” on<br />

page 2.9). This may be called before <strong>DLI</strong> (<strong>and</strong> hence the Adobe PDF Library) is initialized. Once set,<br />

storage of temporary files in memory is automatic.<br />

The <strong>DLI</strong> sample application MultiDoc, accompanying this release, demonstrates the coding <strong>and</strong> use of<br />

Files In Memory. It can be invoked by adding the comm<strong>and</strong>-line argument MEMORY when calling the<br />

sample application.<br />

Initializing <strong>and</strong> Terminating via <strong>DLI</strong><br />

The following comm<strong>and</strong>s should be used to initialize <strong>and</strong> terminate the Adobe PDF Library <strong>and</strong> <strong>DLI</strong>. In a<br />

single-threaded application, the initialization <strong>and</strong> termination processes must be called only once during<br />

the life of the application. Attempting to initialize the Adobe PDF Library <strong>and</strong> <strong>DLI</strong> more than once in the<br />

application may cause errors or unpredictable behavior, <strong>and</strong> is not supported. (You are free to create<br />

multiple documents <strong>and</strong>/or multiple files within the run, but the initialization <strong>and</strong> termination of the<br />

Adobe PDF Library <strong>and</strong> <strong>DLI</strong> is limited to one iteration of each. In a multi-threaded application, each<br />

thread must perform its own initialization <strong>and</strong> termination.)


2.8 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfinit<br />

This method initializes <strong>DLI</strong>, <strong>and</strong> prepares it to use the ASFileSys passed in as the second parameter;<br />

this may be NULL if the caller does not have an ASFileSys to pass to dlpdfinit, or does not have a<br />

filesystem preference.<br />

The first parameter is a PDFLInit structure used to initialize the Adobe PDF Library. It is the same<br />

structure that would be passed to the PDFLInit function call in legacy programs which use that function.<br />

The second parameter of dlpdfinit is an ASFileSys record specifying what file system should be used<br />

by <strong>DLI</strong> <strong>and</strong> the Adobe PDF Library. If NULL, the default file system operations will be used.<br />

The third parameter is NULL, reserved for future use.<br />

CAUTION: Versions of Adobe PDF Library prior to v6.1 are not thread-safe, <strong>and</strong><br />

should not be initialized more than once in a single job, either directly or via <strong>DLI</strong>.<br />

Doing so can produce undesirable results. Your application is free to create<br />

multiple output files or perform multiple tasks without exiting using the<br />

appropriate methods (see the <strong>DLI</strong> MultiDoc sample application, for example),<br />

but you must not terminate the Library until you are ready to stop the application,<br />

<strong>and</strong> once you have terminated the Library, you cannot initialize it again. You can<br />

accidentally call dlpdfinit (the <strong>DLI</strong> comm<strong>and</strong>) multiple times without problems,<br />

as it contains internal code that prevents actual initialization from occurring more<br />

than once, but you should not call PDFLInit (the Adobe PDF Library comm<strong>and</strong>)<br />

more than once as a fatal error may occur. See further discussion on thread safety<br />

in “Thread-Safe Issues” on page 2.12.<br />

The <strong>DLI</strong> initialization call dlpdfinit must occur before any other call which makes reference to any<br />

DLPDFDOC structure (with the exception of dlpdfmemfilesys, which may be called for setup<br />

purposes). It returns a DLPDFINSTANCE pointer which may then be used to create documents. The<br />

dlpdfinit function call may also return a NULL pointer, indicating that <strong>DLI</strong> or the Adobe PDF Library<br />

could not initialize. If this occurs, neither <strong>DLI</strong> nor the Adobe PDF Library should be used, <strong>and</strong> if possible,<br />

the calling program should cease execution as soon as is feasible.<br />

Specifying an Alternate File System<br />

The ASFileSys passed to dlpdfinit as its second argument will typically be either NULL (specifying<br />

that the user has no preference for how <strong>DLI</strong> manages file input <strong>and</strong> output) or the dlpdfmemfilesys<br />

call. Calling dlpdfmemfilesys will return the ASFileSys record to the <strong>Datalogics</strong> memory file system<br />

for the Adobe PDF Library. This file system keeps temporary files in memory, instead of on disk, resulting


Initializing <strong>and</strong> Terminating the Library 2.9<br />

in significantly improved processing speeds on some systems. You can create your own ASFileSys <strong>and</strong><br />

pass it in, if you wish more control over how files are manipulated.<br />

NOTE: The included fonts must still be read from disk, <strong>and</strong> the PDF document<br />

which is created will be written to a disk file, unless the steps described in<br />

"Writing PDF Output to Memory" are taken. If the user has the means to specify<br />

an alternative file system, that too may be passed into dlpdfinit.<br />

Using a Graphics Cache<br />

As of <strong>DLI</strong> v3.0.11, the <strong>DLI</strong> graphics cache has been enhanced to use the default ASFileSys<br />

implementation provided to dlpdfinit for caching graphics. By default, the graphics cache file size is<br />

limited to 1.5GB. Customers who wish to use larger graphics cache files are advised to supply a filesystem<br />

to dlpdfinit which is capable of reliably h<strong>and</strong>ling files of the larger size.<br />

NOTE: The cache size limit is checked every time a document is destroyed; the<br />

cache may therefore temporarily exceed the cache size limit. When setting the<br />

cache size limit, please note that to resize the graphics cache, free space equal to<br />

the sum of the cache limit <strong>and</strong> the "low water" mark is required. Files In Memory<br />

users with large graphics workloads are advised to lower the cache size limit to a<br />

number appropriate for their target environment.<br />

dlpdfmemfilesys<br />

This procedure returns the ASFileSys structure which represents <strong>Datalogics</strong>’ Files In Memory file<br />

system. This file system will only be used if PDF output is requested.<br />

This structure is suitable as the second parameter to the dlpdfinit function.<br />

Image Search using Files In Memory<br />

With the release of <strong>DLI</strong> v2.2.13, an enhancement was added for a method of holding graphics in memory<br />

<strong>and</strong> searching for them there, as opposed to storing <strong>and</strong> searching for graphics on disk only. This was not<br />

in the form of a separate API; instead, <strong>DLI</strong> was altered to search the default ASFileSys (whichever<br />

filesystem was selected by the application) for graphic files, instead of automatically searching only the<br />

disk. (Graphic conversions are still cached to a temporary file on a physical file system.)<br />

To take advantage of this, you would<br />

1 Set the default file system to dlpdfmemfilesys.<br />

2 Create a file in the Files In Memory filesystem, <strong>and</strong> use dlpdfmemfilesetdata to make a region of


2.10 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

memory into the file-in-memory.<br />

3 Call dlpdfimagecreatefromfile with the name of the file-in-memory.<br />

4 Set the default file system back to the original default, if files-in-memory is not being used for anything<br />

else.<br />

NOTE: Users currently using Files-In-Memory in their application but assuming<br />

that images are always retrieved from disk may need to modify their applications.<br />

They should either<br />

NOTE: • bring the images from disk into memory, or<br />

NOTE: • deliberately switch the default filesystem to disk temporarily<br />

NOTE: in order to pull in the graphic(s) before continuing with further processing.<br />

Terminating <strong>DLI</strong> <strong>and</strong> the Adobe PDF Library<br />

Termination of <strong>DLI</strong> is accomplished by calling dlpdfterm with the DLPDFINSTANCE pointer returned<br />

from the dlpdfinit function call. This call should not be made until all <strong>DLI</strong> structures, with the<br />

exception of the DLPDFINSTANCE pointer, <strong>and</strong> all PDE <strong>and</strong> PD library structures are freed. The<br />

dlpdfterm call will free the DLPDFINSTANCE pointer <strong>and</strong> the pointers set in the PDFLDataRec<br />

structure. Terminating <strong>DLI</strong> will also terminate the Adobe PDF Library.<br />

dlpdfterm<br />

This method will terminate <strong>DLI</strong> <strong>and</strong> the Adobe PDF Library. Call this function after all DLPDFDOC<br />

structures have been disposed of. In the case of multi-threaded applications, each thread that initialized<br />

the Library must also terminate it when finished.<br />

This will typically be one of the last calls of a program using <strong>DLI</strong>. The call takes a DLPDFINSTANCE<br />

pointer, which is the DLPDFINSTANCE pointer returned by the dlpdfinit function call. Any<br />

composition program using <strong>DLI</strong> <strong>and</strong> the Adobe PDF Library should call dlpdfterm to terminate <strong>DLI</strong><br />

<strong>and</strong> the Adobe PDF Library before terminating itself. The dlpdfterm function takes the<br />

DLPDFINSTANCE returned from dlpdfinit as its sole parameter.


Initializing <strong>and</strong> Terminating the Library 2.11<br />

Typical Order of Calls<br />

In summary, the overall calling sequence would be similar to the following example:<br />

PDFLDataRec InitStruct;<br />

DLPDFINSTANCE *pdfInstance = NULL;<br />

/* to use Files In Memory */<br />

pdfInstance = dlpdfinit(&InitStruct, dlpdfmemfilesys(), NULL);<br />

/* to use st<strong>and</strong>ard files */<br />

pdfInstance = dlpdfinit(&InitStruct, NULL, NULL);<br />

if (!pdfInstance) /* if not 0 then error */<br />

{<br />

printf("Error initializing <strong>DLI</strong> -- aborting\n");<br />

exit(1);<br />

}<br />

/* to close library */<br />

dlpdfterm(pdfInstance);<br />

Multi-Thread Initializations<br />

Adobe PDF Library v6.1.0Plus <strong>and</strong> <strong>DLI</strong> v3.0.11 (or higher) are re-entrant, <strong>and</strong> therefore safe for<br />

multithreaded applications. However, the Adobe PDF Library will perform cleanup work during<br />

termination if no other instances are active, which will cause the Library to not initialize correctly for any<br />

follow-on processes afterwards.<br />

Therefore, though each thread must call PDFLInit/PDFLTerm or dlpdfinit/dlpdfterm (for <strong>DLI</strong><br />

applications), take care that Adobe PDF Library <strong>and</strong> <strong>DLI</strong> are not re-initialized after the last outst<strong>and</strong>ing


2.12 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

initialization has been terminated. For example, the following sequence will cause errors when attempting<br />

to initialize Thread 2:<br />

dlpdfinit()<br />

[Thread 1 processing]<br />

dlpdfterm()<br />

dlpdfinit()<br />

[Thread 2 processing]<br />

dlpdfterm()<br />

The problem above is that when Thread 1 terminates, no other processes are seen, <strong>and</strong> so shutdown<br />

cleanup work begins, leading to errors when the initialization of Thread 2 comes along.<br />

This sequence is recommended instead:<br />

dlpdfinit()<br />

dlpdfinit()<br />

[thread 1 processing]<br />

[thread 2 processing]<br />

dlpdfterm()<br />

dlpdfterm()<br />

Thread-Safe Issues<br />

Releases of the Adobe PDF Library prior to v6.1 were not thread-safe, <strong>and</strong> so by extension neither was<br />

<strong>DLI</strong>. Adobe PDF Library v6.1 <strong>and</strong> its accompanying <strong>DLI</strong> were the first thread-safe releases in<br />

distribution. Notes on use of prior versions within multi-threaded applications are given below.<br />

It is possible to use pre-v6.1, non-thread-safe Library applications in a threaded environment under the<br />

proper configuration in certain circumstances (although you should plan to upgrade your application to a<br />

thread-safe Adobe PDF Library v6.1.x version at your next opportunity).<br />

The general idea is that your application will queue the threads' interaction with the Library functions so<br />

that they are executed one at a time. This is not too difficult to do if your pre-v6.1.x application uses a<br />

mutex (Mutual Exclusion) algorithm to ensure that only one thread has access to the Library at any given<br />

point in time. Testing has shown that execution time does not appear negatively impacted if the Library<br />

segments are efficiently grouped, so that any given thread's Library activity is over <strong>and</strong> done with before<br />

the next process calls. When properly implemented, there should be no noticeable deterioration in<br />

performance due to the mutex gatekeeper logic, <strong>and</strong> a multi-threaded application can thus use an older,<br />

pre-v6.1.x version of the Adobe PDF Library.<br />

NOTE: While these instructions should enable you to implement a multi-threaded<br />

application with an older, non-threadsafe version of the Library, you should<br />

upgrade your application to make use of the latest thread-safe release as soon as<br />

possible. Newer releases contain numerous other improvements in addition to<br />

multithread capability.


Initializing <strong>and</strong> Terminating the Library 2.13<br />

The problem revolves around the event h<strong>and</strong>ler stack. Since the Adobe PDF Library prior to v6.1.x had<br />

only one h<strong>and</strong>ler stack, multiple, concurrent processes had no means of determining whose Library<br />

activity was occurring at any given point in time, so it was possible for the Library to return a bad event<br />

for one process that could be caught by another process by mistake. With mutex coding, you can ensure<br />

that only one process has access to the Library at any given time, <strong>and</strong> the next process is granted access<br />

only after the first one is concluded.<br />

As stated, this works reasonably well as long as the Library access is efficiently arranged within the<br />

application code. That is, you should not simply put one big DURING/HANDLER/END_HANDLER around<br />

the entire algorithm, as the process will then comm<strong>and</strong>eer the Library for its entire job, to the exclusion of<br />

all others. Instead, divide the application algorithm into logical blocks of Library activity, so that Library<br />

access is more likely to be evenly divided among concurrent processes. Also try to ensure that, if possible,<br />

a given process waiting for an external event to finish will not be tying up Library access in the meantime.<br />

Writing PDF Output to Memory<br />

Output of PDF files to memory ("transient files") requires slight changes to your application, summarized<br />

below.<br />

When calling dlpdfdocsetpdfname or dlpdfdocwritepdf functions, these functions must be given<br />

a filename which marks the file as a transient file. This is done by prefacing the document's filename with<br />

the transient prefix, obtained by calling the dlpdfmemfiletransientprefix function. This returns a<br />

character string with the necessary prefix, which marks the file such that it is not written to disk.<br />

Call dlpdfdocwritepdf when the document is complete, <strong>and</strong> obtain the ASPathName for the string<br />

passed to dlpdfdocwritepdf. Obtain the MDFile representing the Files In Memory entry for the<br />

document via the dlpdfmemfileacquire (ASPathName) function. This returns the MDFile for the<br />

document. Then, the size of the memory buffer needed to contain the file can be obtained with the<br />

dlpdfmemfilesize(MDFile) call, <strong>and</strong> the information itself is returned (as a const unsigned<br />

char buffer of the size returned by the call above) by the dlpdfmemfiledata (MDFile) function.<br />

Copy the contents of the returned pointer as soon as possible. This pointer should not be changed or<br />

modified, <strong>and</strong> should not be freed. Call dlpdfmemfilerelease MDFile) to release the file, its<br />

memory <strong>and</strong> other resources once this file is finished being used. The function will return the remaining<br />

number of acquisitions for the Files In Memory file.


2.14 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

The functions to support this are:<br />

dlpdfmemfileacquire<br />

This function acquires the file given by the pathname passed in, <strong>and</strong> returns it as an MDFile. A memory<br />

file is eligible to be removed when no acquisitions are outst<strong>and</strong>ing upon it.<br />

dlpdfmemfilesize<br />

This function returns an ASSize_t value containing the smallest size of a block of memory (in bytes)<br />

which could contain the data of the given MDFile.<br />

dlpdfmemfiledata<br />

This function returns a pointer to a memory representation of this file. The contents should be copied as<br />

soon as possible, <strong>and</strong> must be neither altered nor freed.<br />

dlpdfmemfilesetdata<br />

This function sets the file passed in to contain the data passed to the function. This completely overwrites<br />

the file’s previous contents. Returns TRUE if successful, or FALSE if the file's contents could not be set.<br />

dlpdfmemfilerelease<br />

Decrements the file's acquisition counter <strong>and</strong> signals to <strong>DLI</strong> that the application no longer requires the<br />

use of this file. A file should be released for each acquisition made to the file; if it is not released, then<br />

release of the file's memory <strong>and</strong> other resources will be delayed until the end of program execution.<br />

dlpdfmemfiletransientprefix<br />

Returns a string representing the transient prefix. Memory files whose names start with the transient<br />

prefix will not be written to disk. Otherwise, the files will be written to disk upon file closure or program<br />

termination.


Initializing <strong>and</strong> Terminating the Library 2.15<br />

API Comparison<br />

The Hellodli program sample was created to provide a clear comparison between a sample program<br />

using the <strong>DLI</strong> API in conjunction with the Adobe PDF Library API, <strong>and</strong> one using the Adobe PDF<br />

Library API exclusively. The similarities <strong>and</strong> differences between the two types of applications can be seen<br />

by comparing the hellodli.c file to the helowrld.c file provided by Adobe.<br />

The two programs perform largely the same task: Produce a simple, one-page document with a line of text<br />

on it. You can compare the source code for each file to see which Adobe PDF Library methods are<br />

replaced by <strong>DLI</strong> methods. In most cases, you should find that the <strong>DLI</strong> methods are simpler <strong>and</strong> easier to<br />

implement. On a larger scale, <strong>DLI</strong> methods also enable Files In Memory processing, which in turn allows<br />

faster processing times <strong>and</strong> reduced I/O activity for intermediate work file actions.


2.16 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong>


3<br />

Beginning <strong>and</strong><br />

Ending a Document<br />

This chapter describes the methods provided in <strong>DLI</strong> to<br />

create <strong>and</strong> write a document.<br />

3.1


3.2 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Overview<br />

<strong>DLI</strong> provides a simple interface to create <strong>and</strong> write documents. It uses a document structure (DLPDFDOC)<br />

to differentiate between documents, allowing for the simultaneous creation of a number of documents.<br />

DLPDFDOC reflects the current status of the document at all times <strong>and</strong> is required input to most other <strong>DLI</strong><br />

calls. As the document is created with Adobe PDF Library support, a CosDoc <strong>and</strong> a PDDoc are created<br />

within the Library, <strong>and</strong> these may be obtained from this structure for use in calls outside of <strong>DLI</strong>.<br />

The Adobe PDF Library establishes the name <strong>and</strong> many of the attributes of a document when it is<br />

completed, rather than when it is begun. Many existing composition engines do not do this. For this<br />

reason, the document structure has a convenient set of h<strong>and</strong>les to permit the specification of such<br />

attributes at document creation time, rather than at document write time.<br />

There are a number of calls available at the Document Interface. Multiple documents may be created <strong>and</strong><br />

maintained at one time.<br />

Required Use of Exception H<strong>and</strong>lers<br />

Except for dlpdfinit <strong>and</strong> dlpdfterm, all calls to the Document Interface must be within an exception<br />

h<strong>and</strong>ler (i.e. DURING/HANDLER/END_HANDLER statements) <strong>and</strong> all <strong>DLI</strong> documents should be destroyed<br />

prior to closing the Adobe PDF Library. This can be done all at once or one step at a time. Both <strong>DLI</strong> <strong>and</strong><br />

the Adobe PDF Library may raise exceptions in the form of escapes.<br />

dlpdfinit <strong>and</strong> dlpdfterm must not be enclosed in these h<strong>and</strong>lers because they are not set up before<br />

initialization, <strong>and</strong> are freed during termination.<br />

dlpdfdoccreate<br />

This method will create <strong>and</strong> return a pointer to a new document, as a DLPDFDOC pointer. As of <strong>DLI</strong> v3.0,<br />

this call no longer accepts a PostScript filename. (Use dlpdfdocsetpsname, or supply one to<br />

dlpdfdocwritePS.) It accepts one parameter, the DLPDFINSTANCE to use for the document.<br />

dlpdfdoccompress<br />

This method should be called before any content is placed onto a page. Content placed prior to this call<br />

will not be compressed. The compression algorithm used is Flate.


Beginning <strong>and</strong> Ending a Document 3.3<br />

dlpdfdocembedfonts<br />

When this method is called, all fonts seen will be embedded in the document if possible, including Base 14<br />

fonts. The flag set by this method is in DLPDFDOC->EmbedFonts, <strong>and</strong> may be safely manipulated by the<br />

client program. It is also possible to specify embedding <strong>and</strong> subsetting on the font create call.<br />

NOTE: If a font is available but not licensed for embedding, it will be created as a<br />

referenced font rather than an embedded font. An exception is not returned for<br />

this condition, but the NotEmbedded flag of the DLPDFFONT structure can be<br />

inspected after the dlpdfdocembedfonts call, if desired.<br />

dlpdfdocsetencoding<br />

The encoding of created fonts will default to WinAnsiEncoding on Windows machines <strong>and</strong> St<strong>and</strong>ard<br />

encoding on all other platforms. You may set it to any valid encoding through this method.<br />

This encoding is used when the font create call does not include an encoding.<br />

dlpdfdocsetpdfname<br />

When the desired name of the PDF file resulting from this document is known at document creation time,<br />

it may be stored using this method <strong>and</strong> will be retrieved when the document is written.<br />

dlpdfdoclinearize<br />

When it is known at document creation time that this file should be written in a linearized form, this<br />

knowledge may be stored via this method <strong>and</strong> will be retrieved when the document is written.<br />

dlpdfdocsetdocinfo<br />

This method accepts couplets of information, each a string (encoded as PDFDocEncoding values), <strong>and</strong><br />

saves them in the document information structure of the document. This may be done at any time.<br />

dlpdfdocmakethumbnails<br />

For Adobe PDF Library v4.x <strong>and</strong> higher, this method will create a thumbnail image for each page in the<br />

document. This call may be made at any time prior to writing the document. Thumbnails will be created<br />

automatically at document write time.


3.4 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfdocwritepdf<br />

This call causes the document to be written to a PDF file. It accepts as parameters a document h<strong>and</strong>le, an<br />

optional string giving the name of the file to be written, <strong>and</strong> a flag indicating whether linearization is<br />

desired.<br />

If a name has been saved via dlpdfdocpdfname, that name will be used in the write, regardless of the<br />

specification of a name in the name parameter. If neither a name parameter nor a saved name is present,<br />

an exception (genErrBadParm) will be raised.<br />

If the linearize parameter is TRUE, or the method dlpdfdoclinearize has been used, the<br />

document will be linearized; otherwise, it will be nonlinearized.<br />

dlpdfdocencrypt<br />

This call causes the document contents to be encrypted using the Adobe PDF Library st<strong>and</strong>ard encryption<br />

mechanism. It accepts a DLPDFDOC pointer, a character pointer to the user password, a character pointer<br />

to the owner password, <strong>and</strong> a PDPerms data type. The latter must contain the security permissions as<br />

outlined in the Acrobat Core API <strong>Reference</strong> Manual in the PDPerms definition. This call may be made at<br />

any time prior to dlpdfdocwritepdf.<br />

dlpdfdocsetencryptkeylen<br />

This enables variable length encryption keys as supported by the Adobe PDF Library. It accepts a<br />

DLPDFDOC pointer, a parameter specifying the number of bytes between 5 <strong>and</strong> 16 inclusive used to<br />

determine key length used during encryption.<br />

This function can be called to set the length of the encryption key before a call to dlpdfdocencrypt if<br />

the application is to use an encryption key length other than the original 40-bit length provided in<br />

previous versions.<br />

The use of this function is optional if the original 40-bit key length is to be used. Subsequent calls to<br />

dlpdfdocencrypt will use the number of bytes specified in the call to


Beginning <strong>and</strong> Ending a Document 3.5<br />

dlpdfdocsetencryptkeylen. If the key length has not been set previously, the st<strong>and</strong>ard 5-byte value<br />

is used as the default.<br />

For more information on Encryption, refer to the beginning of section 3.5, "Encryption," in the Adobe<br />

PDF <strong>Reference</strong> manual. For information on PDDocSetNewSecurityData <strong>and</strong><br />

StdSecurityDataRec, see the Adobe Core API <strong>Reference</strong> <strong>Guide</strong>.<br />

NOTE: For applications generating multiple documents,<br />

dlpdfdocsetencryptkeylen must be called for each document for which<br />

an encryption key length other than the st<strong>and</strong>ard 5-byte value is desired.


3.6 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong>


4<br />

Fonts<br />

For most users of <strong>DLI</strong>, font creation is both one of the<br />

most important <strong>and</strong> one of the most difficult aspects of an<br />

application. Though <strong>DLI</strong> has been designed to hide most<br />

of the complexity of font creation, there is still a lot to<br />

underst<strong>and</strong> regarding font creation <strong>and</strong> usage. With the<br />

ability to use most Windows <strong>and</strong> Macintosh native code<br />

pages, as well as Unicode (using Adobe PDF Library<br />

v5.0.2Plus or higher), the <strong>DLI</strong> font mechanism is flexible<br />

enough to h<strong>and</strong>le nearly any user request.<br />

4.1


4.2 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

PDF Font Overview<br />

It is important to start by underst<strong>and</strong>ing the difference between the terms character <strong>and</strong> glyph. A<br />

character is an abstract, named entity, such as "hyphen." A glyph is the representation of a character<br />

contained within a font: the mark in the PDF file which visually represents the character, what you see onscreen<br />

or on paper. This is an important distinction, since some font types use character identifiers to<br />

typeset text; others use glyph identifiers to typeset text. For this chapter, the terms character <strong>and</strong> glyph<br />

will be used interchangeably unless the technical distinction is important, in which case this will be noted.<br />

Characters <strong>and</strong> glyphs in a PDF font can be addressed using either one-byte encodings (such as<br />

WinAnsiEncoding), multibyte encodings (such as Shift-JIS), or 2-byte glyph identifier (GID)<br />

encodings for some TrueType fonts. Some fonts support more than one method of accessing characters.<br />

There are two categories of fonts in the PDF file format:<br />

• Simple fonts<br />

• Composite fonts<br />

Simple Fonts<br />

Simple fonts are those fonts which are addressed using one byte per glyph or character. PostScript Type1<br />

fonts <strong>and</strong> most TrueType fonts fall into this category. With these fonts, no more than 255 characters are<br />

addressable. <strong>DLI</strong> offers the flexibility to easily encode which characters are accessible by accepting an<br />

encoding array. The widths of these characters can also be controlled by providing an array of character<br />

widths.<br />

PDF TrueType fonts which have a post table can use encoding vectors to access fonts outside the Adobe<br />

st<strong>and</strong>ard one-byte encodings.<br />

Composite Fonts<br />

Composite fonts are fonts which use multibyte encodings or GID values. These are known as CID fonts<br />

(for "Character ID") or Type0 fonts, even though many are not accessed using a CID value.<br />

There are two varieties of Type0 fonts:<br />

• CIDType0<br />

• CIDType2


Fonts 4.3<br />

CIDType0 Fonts<br />

CIDType0 fonts use the CMap file format as specified by Adobe, <strong>and</strong> will accept a number of different<br />

encodings, though these CMap files are typically somewhat narrow in their range of addressable<br />

characters. A CIDType0 font is usable with a set of CMap files; this is the only way to access characters.<br />

CIDType2 Fonts<br />

CIDType2 fonts are also TrueType font streams, but are addressed using 2-byte glyph identifiers (glyph<br />

IDs). These should not be created using CMaps, since the fonts are not keyed by character but by glyph.<br />

Instead, a CIDToGID map is used to convert the 2-byte character in the PDF text strings to glyph IDs for<br />

the font.<br />

For font files loaded into a DLPDFINSTANCE, <strong>DLI</strong> uses the International Components for Unicode (ICU)<br />

to translate Unicode inputs <strong>and</strong> a large array of vendor-defined multibyte encodings to output text. The<br />

DLPDFTEXT structure is used to properly combine characters <strong>and</strong> support right-to-left reading order. For<br />

CIDType2 fonts, a mapping from the DLPDFTEXT input to glyph IDs for output is generated. Whenever<br />

possible, the output text in the PDF file is in UTF16 big-endian format.<br />

The Adobe PDF Library <strong>and</strong> <strong>DLI</strong> also allow CIDType2 fonts to be used for a number of single-byte<br />

vendor encodings. Output is in two-byte glyph IDs which correspond to glyph identifiers in the embedded<br />

font stream. Text is input using the DLPDFCONTENT text calls as if using a single-byte font.<br />

Most TrueType <strong>and</strong> OpenType font files can be used to create either TrueType (single-byte) or CIDType2<br />

PDF fonts. In all cases, TrueType <strong>and</strong> CIDType2 fonts should be both embedded <strong>and</strong> subset to ensure<br />

reliable results when viewing <strong>and</strong> printing. In this chapter, the term "TrueType font" means a PDF<br />

TrueType font using a one-byte encoding, <strong>and</strong> the term "CIDType2 font" means a TrueType or OpenType<br />

font using GID values to access characters in the PDF file.<br />

Structure of a <strong>DLI</strong> Font<br />

A font is reflected in the structure DLPDFFONT. These structures are created by the font creation calls on a<br />

per-document basis. They may be used only within the document they were created with. Fonts are<br />

tracked within the document, <strong>and</strong> destroyed when the document is destroyed. Pointers to fonts are invalid<br />

after the destruction of their document. All DLPDFFONT structures for a given document will be released<br />

when that document is destroyed. Therefore, methods that use DLPDFFONT as a parameter (i.e.<br />

dlpdfcontenttext, dlpdfcontentwidetext, dlpdfcontenttextwidth,<br />

dlpdfcontentwidetextwidth) must be called before the document is destroyed


4.4 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Font Embedding Status<br />

The field DLPDFFONT->NotEmbedded will be TRUE only if a request was made to subset the font but<br />

the request procedure failed. If the font could not embed due to license restrictions (i.e. the request<br />

procedure functioned correctly, but the font itself is not licensed for embedding), an exception will be<br />

raised instead.<br />

Font Subsetting Status<br />

The field DLPDFFONT->SubSetMap will be NULL if a font is not subset. The field will be not NULL if a<br />

font is (or will be) subset.<br />

Font Attributes<br />

The field DLPDFFONT->RequestedFontAttr is a PDEFontAttrs structure. It is populated with the<br />

font attributes of the system font actually used to create the font, with the alterations requested by the<br />

calling application.<br />

Document EmbedFonts Flag<br />

If the document that contains the font carries the flag EmbedFonts (normally set by<br />

dlpdfdocembedfonts), then all fonts for that document will be embedded, regardless of the call used<br />

to create those fonts.<br />

All fonts will be subset unless either<br />

• they were created with a call to explicitly not embed the fonts, or<br />

• license restrictions prevent the font from being embedded.<br />

NOTE: If a font is available but not licensed for embedding, it will be created as a<br />

referenced font rather than an embedded font. An exception is not returned for<br />

this condition, but the NotEmbedded flag of the DLPDFFONT structure can be<br />

inspected after the dlpdfdocembedfonts call, if desired.<br />

Entries in the DLPDFFONT structure should not be altered after a font is created. Except for certain<br />

specific exceptions to be noted here, changes made to this structure will not be subsequently reflected in<br />

the font that is created <strong>and</strong> placed in the PDF document.


Fonts 4.5<br />

Font Creation Calls<br />

There are several procedures available for creating a DLPDFFONT structure:<br />

• dlpdffontcreate<br />

• dlpdffontcreateembedded<br />

• dlpdffontcreatewithmetrics<br />

• dlpdffontcreatewithmetricsembedded<br />

All of these calls create the DLPDFFONT structure described above. They are listed in increasing order of<br />

control given over font characteristics, <strong>and</strong> according to the amount of information a user is required to<br />

have about a given font. Those near the top of the list above require less initial information from the user<br />

than those further down.<br />

The dlpdffontcreatewithmetrics <strong>and</strong> dlpdffontcreatewithmetricsembedded calls can be<br />

used to modify the character width table <strong>and</strong> the character encoding vector array, as well as all the font<br />

attributes which are reflected in the PDEFontAttrs structure these calls require.<br />

Repetitive Font Creation Calls<br />

A DLPDFDOC maintains a list of defined fonts by the name <strong>and</strong> font attributes requested. Second <strong>and</strong><br />

subsequent calls to create a font structure of a given name <strong>and</strong> attributes will return the same font<br />

structure as the first call. For example, if you ask for the Type1 font Baskerville 20 times, with the same<br />

attributes every time, only a single PDF font structure for Baskerville will be created, <strong>and</strong> only a single<br />

DLPDFFONT structure will be created for Baskerville. However, if these requests supply differing font<br />

attributes, more than one copy of Baskerville is created.<br />

NOTE: The dlpdffontcreate family of calls will always allow the creation of<br />

the Adobe st<strong>and</strong>ard type 1 fonts. The names of these 14 fonts (sometimes referred<br />

to as the Base 14 fonts) can be found in the PDF <strong>Reference</strong>.<br />

dlpdffontcreate<br />

This is the basic font access method. It accepts a font name <strong>and</strong> optionally a font type, both as strings.<br />

When the font type is present, the method will attempt to find a font which matches both that type <strong>and</strong><br />

name. If none is found, it will attempt to match the specified name in any type of font.<br />

Font Searching Sequence<br />

The specific dlpdffontcreate search procedure follows this sequence, in order, until a font fitting the<br />

search parameters is identified. For each test below, the order of preference when searching for a match is


4.6 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

for Type 1 fonts first, then TrueType fonts, <strong>and</strong> finally CID fonts. If no match occurs, the next test in the<br />

sequence below is attempted.<br />

1 The current DLPDFDOC is searched for fonts with the same name <strong>and</strong> type as requested. If one was<br />

already created, it is returned.<br />

2 If a Base 14 font is requested <strong>and</strong> is not to be embedded, it is created <strong>and</strong> returned.<br />

3 If the name is matched in the DLPDFINSTANCE font cache, the font is copied to the current<br />

DLPDFDOC <strong>and</strong> returned. (This is where fonts loaded via dlpdfttload are processed.)<br />

4 The system is searched for a font of explicit name <strong>and</strong> type requested by the user. If found, it is created<br />

<strong>and</strong> returned.<br />

5 The system is searched for a font of explicit name (without regard to type) requested by the user. If<br />

found, it is created <strong>and</strong> returned.<br />

6 If any font of the same family <strong>and</strong> typeface style is found, it is created <strong>and</strong> returned.<br />

If a font using a one-byte encoding is found for this name, its width table in the document’s encoding will<br />

be loaded into the DLPDFFONT->WidthTable. If the document indicates that all fonts are to be<br />

embedded, this font will be embedded <strong>and</strong> subset if possible. The font structure created will carry all of<br />

the metrics of this font, so that if it is not embedded <strong>and</strong> is not present on the imaging platform, a<br />

Multiple Master (or "multi-master") font can be used to provide imaging of the document.<br />

The encoding used in this font will be the encoding specified in dlpdfdocsetencoding, if that call has<br />

been used; otherwise it will default depending on the system in use: WinAnsiEncoding will be used on<br />

Windows systems <strong>and</strong> Adobe st<strong>and</strong>ard encoding will be used on UNIX, OS/390 <strong>and</strong> AS/400 systems.<br />

If dlpdffontcreate is called without a font name, it will raise a genErrBadParm exception ("Bad<br />

Parameters") <strong>and</strong> exit.<br />

dlpdffontcreateembedded<br />

This method behaves like dlpdffontcreate, except that:<br />

• The font will be embedded (if possible) regardless of the overall document settings.<br />

• If the subset flag is TRUE, the embedded font will be subset.<br />

• If the subset flag is FALSE, the embedded font will not be subset.<br />

NOTE: Type0 fonts must be subset if they are embedded.


Fonts 4.7<br />

dlpdffontcreatewithmetrics<br />

This method allows the user greater control over the font selection process, <strong>and</strong> permits alteration of the<br />

width table, encoding vector <strong>and</strong> font attributes of the font returned. This call should be used when the<br />

characteristics of a font need to be altered.<br />

The application using this function should initialize the PDEFontAttrs structure with NULL values<br />

before calling. It should then fill out the name of the font to be located. Supplied parameters, with the<br />

exception of the psName <strong>and</strong> cidFontType fields (<strong>and</strong> the font name given, if the font returned has a<br />

different name), will be used to change the characteristics of the font if these are set.<br />

CAUTION: It is not difficult to create an invalid font by setting these values<br />

incorrectly. Therefore, the application should set only the fields that it is<br />

concerned with affecting in the returned font, <strong>and</strong> leave the rest as NULL values.<br />

The dlpdffontcreatewithmetrics function will match system fonts based on the parameters in the<br />

PDEFontAttrs structure:<br />

• If a system font is found, it will be altered to reflect the values in the PDEFontAttrs structure (with<br />

the exceptions noted above).<br />

• If no system font is found, a font will be created if a valid width table <strong>and</strong> set of PDEFontAttrs are<br />

passed into this function.<br />

• If no system font is found <strong>and</strong> an invalid width table or set of font attributes is passed to this function,<br />

an exception will be raised.<br />

The encoding field in the PDEFontAttrs font attributes structure is an ASAtom containing one of the<br />

significant strings listed in "Predefined Font Encodings," or the name of a predefined encoding or CMap<br />

file (as given in the PDF <strong>Reference</strong> manual). This should correspond to the encoding format in which the<br />

font’s text is to be typeset.<br />

NOTE: Not all the predefined encodings may be used with all fonts. Details on<br />

which types will accept which values are given in the section on predefined font<br />

encodings later in this chapter.<br />

The type field in the PDEFontAttrs font attributes structure should be filled in by the user. If it is not<br />

(i.e. currently ASAtomNull), then any type of font (Type1, TrueType, etc.) may be used. Otherwise, a


4.8 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

font of the matching type will be selected if present. If no font of the matching type is found, any suitablynamed<br />

font will be returned.<br />

The charSet field in the PDEFontAttrs font attributes structure may be set to "Roman" or<br />

ASAtomNull. With an ASAtom value of "Roman," only a font containing the Adobe st<strong>and</strong>ard character<br />

set will be used; with ASAtomNull, any character set will be acceptable.<br />

The wMode field in the PDEFontAttrs font attributes structure may be set to 0 (horizontal) or 1<br />

(vertical) to select a font of the appropriate writing mode.<br />

The other fields in the font attributes structure are explained in Adobe PDF Library documentation.<br />

Width Table<br />

A width table may be included with this method for use with TrueType or Type1 fonts. Generally, you<br />

should include such a table specifically in cases where you expect that the font is not known either to the<br />

Adobe PDF Library or to Adobe Reader, or when character widths have to be altered — for example, in<br />

the case where an encoding vector (described below) is used. This table is arranged from the first character<br />

to the 256th character for the encoding or encoding vector used to create the font.<br />

A font not present on the system must be represented by a width table.<br />

Encoding Vector<br />

You may wish to modify the encoding vector for a Type1 or TrueType font. There are many reasons for<br />

doing this. It is required if you must access characters within the font not normally encoded. It may be<br />

done as a convenience when your data is encoded differently from the default encoding of the font.<br />

Encodings which are not based on any of the predefined font encodings may also be created <strong>and</strong> used in<br />

this manner.<br />

The encoding vector is an array of 256 pointers to strings. The values of the strings are the glyph names of<br />

the encoded characters, as these are defined in the font. Positions which are not encoded should contain<br />

the string .notdef.<br />

Type0 fonts may not be encoded. Further, some TrueType fonts may behave unpredictably if an encoding<br />

vector is supplied. The PDF <strong>Reference</strong> Manual recommends that encoding vectors not be supplied for<br />

TrueType fonts. Please see the PDF <strong>Reference</strong> Manual for further details.<br />

dlpdffontcreatewithmetricsembedded<br />

This method behaves the same as dlpdffontcreatewithmetrics, but with the following exception:<br />

all fonts created with this method will be embedded (if possible), regardless of the setting of the


Fonts 4.9<br />

document's embed fonts flag; if subset is TRUE the embedded font will be subset, if it is FALSE, the<br />

font will be fully embedded, regardless of the document's font embedding settings. If the requested font is<br />

not found by <strong>DLI</strong>, or the font is not embeddable due to license restrictions, an exception will be raised.<br />

By manipulating the font calls within the hellodli.c sample program, you can compare results of using<br />

font references, embedded fonts <strong>and</strong> multi-master fonts.<br />

Predefined Font Encodings<br />

Use of an ASAtomNull for a font encoding will yield a font which uses its "Built-In" encoding; this is<br />

recommended for symbol (e.g. Pi) fonts where a named encoding is not desired. <strong>DLI</strong> recognizes a number<br />

of strings that, when used to create ASAtoms <strong>and</strong> passed into <strong>DLI</strong> functions requiring a font encoding,<br />

serve to denote certain predefined encodings for a font.<br />

Setting the document encoding via dlpdfdocsetencoding does not affect the encoding used for<br />

symbol fonts, to prevent these from becoming inadvertently invalidated. Named encodings passed into the<br />

font creation calls above, however, will be reflected in symbol fonts.<br />

The strings, <strong>and</strong> the font types they are valid for, are enumerated below:<br />

Table 4-1: Encoding Font Types<br />

Encoding String Value<br />

AdobeSt<strong>and</strong>ardEncoding<br />

WinAnsiEncoding<br />

MacRomanEncoding<br />

Valid Font Types<br />

Type1,TrueType<br />

Type1,TrueType<br />

Type1,TrueType<br />

MacExpertEncoding Type1,TrueType<br />

Identity-H<br />

Identity-V<br />

Other Predefined CMaps<br />

CIDType0,CIDType2<br />

CIDType0,CIDType2<br />

CIDType0<br />

Adobe PDF Library v5.x <strong>and</strong><br />

higher only:<br />

WinCP1250<br />

WinCP1251<br />

WinCP1253<br />

WinCP1254<br />

WinCP1255<br />

CIDType2<br />

CIDType2<br />

CIDType2<br />

CIDType2<br />

CIDType2


4.10 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Encoding String Value<br />

WinCP1256<br />

WinCP1257<br />

WinCP1258<br />

MacCentralEuropean<br />

MacCentralEuropean<br />

MacCroatian<br />

MacRomanian<br />

MacCyrillic<br />

MacUkranian<br />

MacGreek<br />

MacCentralEuropean<br />

MacTurkish<br />

MacArabic<br />

MacHebrew<br />

Valid Font Types<br />

CIDType2<br />

CIDType2<br />

CIDType2<br />

CIDType2<br />

CIDType2<br />

CIDType2<br />

CIDType2<br />

CIDType2<br />

CIDType2<br />

CIDType2<br />

CIDType2<br />

CIDType2<br />

CIDType2<br />

CIDType2<br />

Unicode Text Support<br />

Unicode text support is available for customers using Adobe PDF Library v5.x or higher. It is highly<br />

recommended that customers use CIDType2 fonts whenever possible when setting Unicode text.<br />

CIDType2 fonts may be created from most system TrueType <strong>and</strong> OpenType fonts.<br />

Code Page Support<br />

Users of Adobe PDF Library v5.x (or higher) <strong>and</strong> CIDType2 fonts are also able to access automatic<br />

translations for many Windows <strong>and</strong> Macintosh platform encodings. Text to be set in these fonts should be<br />

in a NULL-terminated string in the one-byte platform encoding the font was created with. <strong>DLI</strong> <strong>and</strong> the<br />

Adobe PDF Library will automatically translate this into a string of 2-byte GID values.


Fonts 4.11<br />

Performance Considerations<br />

Creation of fonts can be resource-intensive. For users creating multiple documents, the DLPDFINSTANCE<br />

structure for a document caches most information for fonts which have been created for other documents.<br />

This adds a significant speedup for creators of multiple documents over previous versions of <strong>DLI</strong>.<br />

However, to obtain the best performance from <strong>DLI</strong>, users should remember the following:<br />

• Fonts created for a document have most of their characteristics, including their system fonts <strong>and</strong><br />

translation tables, cached in the DLPDFINSTANCE used to create the document.<br />

• TrueType <strong>and</strong> Type1 fonts allow for faster processing than CIDType0 <strong>and</strong> CIDType2 fonts. They<br />

should therefore be used whenever possible.<br />

Accessing Fonts<br />

Font access for the Library is dependent on both the Adobe PDF Library version <strong>and</strong> the operating<br />

system. It is explained in the Adobe PDF Library Overview manual for all systems other than OS/390.<br />

OS/390 Font Access<br />

For OS/390, the font access method is based on the UNIX method for v1 of the Library. It will attempt to<br />

locate resources via several methods, in this sequence:<br />

1 It will first look for a DD statement named ADOBERES<br />

2 If that is not found, it will look for the PDS member SYS1.PARMLIB(ADOBERES)<br />

3 If that is not found, it will look for ADOBE.PDFLIB.RESOURCE.INDEX(ADOBERES).<br />

4 CMAPS are found by looking for ADOBE.PDFLIB.RESOURCE.INDEX(ADOBECMP).<br />

The ADOBERES listing found at one of those locations is assumed to be a pointer to a listing of 1 entry:<br />

ADOBE.PDFLIB.RESOURCE.INDEX(FONTS). The content of these files is expected to be encoded<br />

using EBCDIC.<br />

The ADOBECMP listing has 1 entry: ADOBE.PDFLIB.RESOURCE.INDEX(CMAPS) This member<br />

contains a lookup table for the CMAP files.


4.12 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong>


5<br />

Multibyte<br />

Text Work<br />

<strong>DLI</strong> has been enhanced over the years to provide<br />

significant support of Unicode <strong>and</strong> of multibyte character<br />

set encodings. This chapter discusses those enhancements,<br />

<strong>and</strong> the methods available for multibyte text work.<br />

5.1


5.2 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Introduction<br />

Beginning with its v3.0 release, <strong>DLI</strong> underwent significant enhancements for support of Unicode <strong>and</strong> of<br />

multibyte character set encodings. With the inclusion of the International Components for Unicode (ICU),<br />

<strong>DLI</strong> was able to properly set text in hundreds of multibyte encodings <strong>and</strong> all the common Unicode<br />

encodings. <strong>DLI</strong> can now set text in scripts which flow from right to left (e.g. Arabic), support the Unicode<br />

BiDirectional algorithm, <strong>and</strong> feature character shaping <strong>and</strong> glyph combining. Unicode text composition is<br />

also significantly faster <strong>and</strong> less memory-intensive than previous <strong>DLI</strong> Unicode implementations.<br />

NOTE: The previous support for Unicode, as introduced in <strong>DLI</strong> v2.2, has been<br />

phased out <strong>and</strong> is no longer available.<br />

There are two components to this support:<br />

• Enhancements to the DLPDFFONT functionality<br />

• A new DLPDFTEXT structure<br />

To use these enhancements, fonts must be explicitly loaded into the DLPDFINSTANCE for a job; once<br />

loaded, they are available to all documents created with the DLPDFINSTANCE. The fonts are used to set<br />

text (in Unicode or multibyte encodings) into a DLPDFTEXT area. The text in the DLPDFTEXT area is<br />

stored in Unicode UCS-2 format (in host-order endianness), <strong>and</strong> may be manipulated or extracted. The<br />

DLPDFTEXT is placed into a DLPDFCONTENT area, to place the text into the PDF content area. Text is<br />

written to the PDF file in UCS-2 big-endian format whenever possible. All fonts loaded are automatically<br />

subset to ensure proper output in generated PDF documents.<br />

Please see information on the <strong>DLI</strong> sample “WideText” on page 17.18 for a demonstration of how to use<br />

the new <strong>DLI</strong> font <strong>and</strong> text functions to typeset Unicode <strong>and</strong> multibyte text.


Multibyte Text Work 5.3<br />

Loading <strong>and</strong> Creating Fonts<br />

To use the enhanced <strong>DLI</strong> text functionality, fonts must first be loaded into a DLPDFINSTANCE, then<br />

created using the dlpdffontcreate calls.<br />

dlpdfttload<br />

Loading the font is done using the dlpdfttload function. This call accepts TrueType, OpenType <strong>and</strong><br />

TrueType collection files.<br />

NOTE: Adobe CFF OpenType font files may not properly subset at this time. The<br />

sample “WideText” on page 17.18 shows the recommended usage for these fonts,<br />

using the DLPDFCONTENT multibyte text h<strong>and</strong>ling.<br />

int dlpdfttload (DLPDFINSTANCE, ASFile, ASAtom[], int)<br />

• The first argument provides a DLPDFINSTANCE into which the font is loaded; once that is done, any<br />

document using the instance may create the font.<br />

• The second argument is a font file, supplied as an ASFile for the second parameter; please see the<br />

sample “WideText” on page 17.18 for an example of creating an ASFile from a file on disk.<br />

• The third argument is an array of ASAtoms. Because a font file may contain more than one font, the<br />

caller must supply an array of ASAtoms as the third parameter.<br />

• The fourth argument is the number of array entries. The dlpdfttload function will fill the array with<br />

ASAtoms of the fonts loaded, up to the size of the ASAtom array. If the array is too small to hold all the<br />

font names, the additional fonts will still be loaded, but the names will not be returned. <strong>Datalogics</strong><br />

recommends that this array be allocated to hold a sufficient number of entries to prevent this. In<br />

practice, a dozen ASAtom entries should be sufficient.<br />

The dlpdfttload function returns the number of fonts loaded from the font file. An exception may be<br />

raised for invalid parameters, if the font file could not be opened, or if there was a problem invoking the<br />

font loader.<br />

NOTE: If a given font file has already been loaded, dlpdfttload returns a -1,<br />

<strong>and</strong> does not re-parse the font file (for performance reasons).<br />

Once loaded, the font may then be created using the dlpdffontcreate calls (see “Font Creation Calls”<br />

on page 4.5). The easiest means of creating the DLPDFFONT structure is to call<br />

dlpdffontcreateembedded, supplying the DLPDFDOC in which to use the font, the name of the font<br />

loaded (use the ASAtomGetString call to obtain a C-string representation of the font name), <strong>and</strong> a


5.4 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

NULL or "Type0" for the third parameter. The fourth parameter must be True, since it is illegal to embed<br />

Type0 fonts without subsetting.<br />

Because the DLPDFINSTANCE font cache is searched for fonts before the system is searched, a font loaded<br />

with dlpdfttload will be found before the system is examined, unless a more specific font creation call<br />

is used. If both single-byte <strong>and</strong> multibyte versions of a font are required for a <strong>DLI</strong> document, use the<br />

dlpdffontcreatewithmetrics calls, specifying Type0 as the font type for multibyte fonts, <strong>and</strong><br />

either Type1 or TrueType as appropriate for the single-byte font.<br />

An easier alternative is to create the single-byte versions of the required fonts before loading the fonts into<br />

the DLPDFINSTANCE. However, it is recommended that you use the multibyte font for all text output if<br />

possible, to ensure optimal PDF file viewing performance <strong>and</strong> file size.<br />

Creating DLPDFTEXT Areas<br />

A DLPDFTEXT area is a container for multibyte <strong>and</strong> Unicode text. Text is placed into the container using<br />

the dlpdftext function (or one of the shortcut functions) described below. This text is converted into<br />

Unicode, in UTF-16 format, stored in host-endian byte order (little-endian for the Win32 <strong>and</strong> Intel/Linux<br />

platforms, big-endian elsewhere), <strong>and</strong> automatically shaped <strong>and</strong> processed through the Unicode<br />

BiDirectional (BiDi) algorithm. This text may then be placed into a DLPDFCONTENT area for output.<br />

dlpdftext<br />

The dlpdftext method is used to create a DLPDFTEXT area from a buffer of text in a given encoding.<br />

DLPDFTEXT *dlpdftext(void *, ASUns32, ASAtom)<br />

• The first parameter is passed in as a pointer to a data buffer.<br />

• The second parameter is the number of bytes in this buffer.<br />

• The third parameter is the encoding of the supplied text. An exception will be raised for invalid<br />

parameters, or if the text could not be properly converted from the input encoding to the platformendian<br />

Unicode representation.


Multibyte Text Work 5.5<br />

dlpdftextshowencodingnames<br />

There are over 1200 encodings <strong>and</strong> encoding aliases that may be used as input encodings, corresponding<br />

to the format of the input text for a DLPDFTEXT area. To obtain a list of these encodings, use the<br />

dlpdftextshowencodingnames function call:<br />

void dlpdftextshowencodingnames(char *)<br />

This function call will write out a file containing a list of valid encoding names <strong>and</strong> aliases to the<br />

pathname supplied as the input parameter. It will raise an exception if unable to write this file.<br />

dlpdftext Shortcut Functions<br />

For NULL-terminated Unicode text (the NULL terminator will vary from encoding to encoding), the<br />

following shortcut functions are provided, each using the encoding listed in parentheses:<br />

• DLPDFTEXT *dlpdftextfromutf8(void *) (utf-8)<br />

• DLPDFTEXT *dlpdftextfromutf16be(void *) (utf-16be)<br />

• DLPDFTEXT *dlpdftextfromutf16he(void *) (utf-16be or utf-16le, by platform)<br />

• DLPDFTEXT *dlpdftextfromutf16le(void *) (utf-16le)<br />

• DLPDFTEXT *dlpdftextfromutf32be(void *) (utf-32be)<br />

• DLPDFTEXT *dlpdftextfromutf32he(void *) (utf-32be or utf-32le, by platform)<br />

• DLPDFTEXT *dlpdftextfromutf32le(void *) (utf-32le)<br />

These shortcut functions require the input text to be NULL-terminated, but do not require a Unicode byteorder<br />

marker. An exception will be raised for invalid input, or if the input text could not be properly<br />

converted to the platform-endian Unicode representation.


5.6 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Working With DLPDFTEXT Areas<br />

Once created, a DLPDFTEXT area may not be altered. Users may wish to create a new DLPDFTEXT area<br />

containing a portion of the text in a previously created DLPDFTEXT area to fit text lines to document<br />

boundaries, or to accomplish other tasks. Users may obtain the text from a DLPDFTEXT area <strong>and</strong> use this<br />

as the basis for a new DLPDFTEXT area, using the dlpdftextstring <strong>and</strong> dlpdftextlength calls:<br />

dlpdftextstring<br />

void *dlpdftextstring(DLPDFTEXT *)<br />

This call returns the text contained in a DLPDFTEXT area, in UTF-16 format. This text is in host-endian<br />

format (little-endian for Win32 <strong>and</strong> Intel/Linux platforms, big-endian elsewhere) <strong>and</strong> does not include a<br />

Unicode byte-order marker. An exception will be raised if an invalid DLPDFTEXT area is supplied.<br />

dlpdftextlength<br />

ASUns32 dlpdftextlength(DLPDFTEXT *)<br />

This call returns the length of the text in a DLPDFTEXT area, in bytes. The buffer returned by the<br />

dlpdftextstring call will be this length. With the buffer <strong>and</strong> the length returned by these two calls, a<br />

user may make a new DLPDFTEXT area with a subset of the returned text, using the dlpdftext call <strong>and</strong><br />

the appropriate Unicode encoding ASAtom.<br />

dlpdftextadvance<br />

The most common use for making new text areas from portions of a DLPDFTEXT area is to copyfit text to<br />

composed lines. The dlpdftextadvance function call is used to supply the width <strong>and</strong> height change for<br />

a string of text, <strong>and</strong> accounts for character shaping <strong>and</strong> combining, as well as horizontal reading<br />

direction. The dlpdfcontentwidetextwidth function call may be used to get a rough estimate of the<br />

width or height change for a string. The dlpdfcontentwidetextwidth call does not take character<br />

shaping or combining into account, <strong>and</strong> assumes a left-to-right line data orientation. The


Multibyte Text Work 5.7<br />

dlpdftextadvance call looks much like the dlpdfcontentwidetextwidth calls, but with some<br />

enhancements.<br />

void dlpdftextadvance (DLPDFTEXT *, DLPDFFONT *,<br />

PDEGraphicState *,<br />

PDETextState *,<br />

ASFixed, ASFixed,<br />

dlpdftext_X,<br />

ASFixed, ASFixedPoint *)<br />

• The first argument is a DLPDFTEXT area that contains text to be set...<br />

• ...in the indicated DLPDFFONT...<br />

• ...using the supplied graphics of PDEGraphicState...<br />

• ...<strong>and</strong> text states of PDETextState.<br />

• The fifth argument describes the point size of the font;<br />

• the sixth argument describes the set width of the font;<br />

• the seventh argument, the dlpdftext_X parameter, is one of DLPDFTEXT_X_LEFT or<br />

DLPDFTEXT_X_RIGHT, used to indicate whether the starting location is the left or right end<br />

(respectively) of the text, distinguishing a left-to-right line order (e.g. English) from a right-to-left line<br />

order (e.g. Arabic);<br />

• the eighth argument indicates the angle of text (in counterclockwise degrees), supplied as an ASFixed<br />

value;<br />

• the ninth argument is a pointer to an ASFixedPoint; the X <strong>and</strong> Y position change resulting from this<br />

call is returned in ASFixed units in this ASFixedPoint.<br />

An exception will be raised for invalid parameters, or if the text advance could not be calculated.<br />

dlpdftexttocontent<br />

Once a line of text to be set is generated, it can be placed into a content area using the<br />

dlpdftexttocontent function call. It is similar in declaration to the dlpdftextadvance call, but


5.8 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

note the addition of the DLPDFCONTENT area pointer as the second parameter. Also note the additional<br />

ASFixed parameters:<br />

void dlpdftexttocontent (DLPDFTEXT *, DLPDFCONTENT *,<br />

DLPDFFONT *,<br />

PDEGraphicState *,<br />

PDETextState *,<br />

ASFixed, ASFixed, ASFixed, ASFixed,<br />

dlpdftext_X, ASFixed)<br />

• The first argument is a DLPDFTEXT area that contains text to be set...<br />

• ...to be placed in the indicated DLPDFCONTENT...<br />

• ...in the indicated DLPDFFONT...<br />

• ...using the supplied graphics of PDEGraphicState...<br />

• ...<strong>and</strong> text states of PDETextState.<br />

• The sixth parameter, the first of four ASFixed parameters, denotes font point size;<br />

• the seventh parameter is set width;<br />

• the eighth parameter is the X-axis value of the starting baseline position;<br />

• the ninth parameter is the Y-axis value of the baseline position;<br />

• the tenth parameter, dlpdftext_X, is one of DLPDFTEXT_X_LEFT or DLPDFTEXT_X_RIGHT, used<br />

to indicate whether the starting location is the left or right end (respectively) of the text, distinguishing<br />

a left-to-right line order (e.g. English) from a right-to-left line order (e.g. Arabic);<br />

• the eleventh parameter indicates the angle of text (in counterclockwise degrees), supplied as an<br />

ASFixed value.<br />

dlpdftextdestroy<br />

After placing the DLPDFTEXT area, or after finishing with any DLPDFTEXT area, destroy the text area<br />

with the dlpdftextdestroy function call:<br />

void dlpdftextdestroy (DLPDFTEXT *)<br />

After destroying a DLPDFTEXT area, the memory for the text <strong>and</strong> other information is released, <strong>and</strong> the<br />

text area may no longer be used by an application.


Multibyte Text Work 5.9<br />

Performance Considerations<br />

The Unicode <strong>and</strong> multibyte functions in <strong>DLI</strong> described above represent an order of magnitude of<br />

performance improvements <strong>and</strong> run-time memory usage. In addition, <strong>Datalogics</strong> can offer some notes <strong>and</strong><br />

tips on performance <strong>and</strong> other considerations:<br />

• Do not create separate DLPDFCONTENT areas for each DLPDFTEXT string. In general, each<br />

DLPDFCONTENT area created represents additional overhead during both creation <strong>and</strong> processing of a<br />

PDF file, increased file size, <strong>and</strong> slower rendering of a PDF page. Best performance is usually obtained<br />

by using one DLPDFCONTENT area per page, <strong>and</strong> pasting all content into this content area.<br />

• Avoid using both single-byte <strong>and</strong> multibyte versions of fonts. This results in increased creation time to<br />

subset two different fonts, as well as slower rendering <strong>and</strong> processing of PDF files.<br />

• If you are typesetting in Chinese, Japanese or Korean, <strong>and</strong> are certain that readers of a PDF file will<br />

have the appropriate Acrobat language pack installed for their reader, consider using the Adobe<br />

OpenType fonts (subtype 0 CID fonts), <strong>and</strong> not embedding or subsetting. Though you will not be able<br />

to use the functionality described in this chapter, this could prove to generate faster <strong>and</strong> smaller PDF<br />

files. See the WideText sample application included beginning with the <strong>DLI</strong> v3.0.4 release for a<br />

demonstration of how to set Unicode text using these fonts.


5.10 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong>


6<br />

Working with<br />

Pages<br />

This chapter explains pages <strong>and</strong> defines the calls available<br />

at this level.<br />

6.1


6.2 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Introduction to Page Interface<br />

<strong>DLI</strong> presumes that pages will be added to the end of the document only. This is required for optimal<br />

generation of the PDF Page Tree Structures, <strong>and</strong> matches the most common modes for creating<br />

documents. If output to PDF is desired <strong>and</strong> local PostScript is not, you may use <strong>DLI</strong> to create most pages,<br />

<strong>and</strong> then add pages out of order to the document via the COS Layer interface. If local PostScript is<br />

enabled, these added pages will be placed as if they were following the last page.<br />

Page Structure<br />

A page is represented in <strong>DLI</strong> by the data structure DLPDFPAGE. These data structures, one per page, are<br />

tracked within the package <strong>and</strong> destroyed when the document is destroyed. Pointers to these structures<br />

remain valid until the document is destroyed.<br />

Page Interface Calls<br />

Calls available to the Page Interface in <strong>DLI</strong> are:<br />

dlpdfpagefindfromnumber<br />

This procedure will return the DLPDFPAGE construct for the specified page. This is provided to allow<br />

pages to be modified after creation without having to keep pointers to all of the pages in the application.<br />

If the page number specified has not yet been created, a NULL pointer will be returned. The first page is<br />

considered to be page number one.<br />

dlpdfpagecreate<br />

This procedure will create a new page in the current document. It will be positioned following all other<br />

pages in the current document. If the specified document does not exist, an exception genErrBadParm<br />

will be raised. Width <strong>and</strong> Height must be specified as greater than zero, <strong>and</strong> are assumed to be in points.


Working with Pages 6.3<br />

dlpdfpagerotate<br />

This function will cause the page to be rotated clockwise to the specified angle. Permissible rotation angles<br />

are increments of 90 degrees only. Angle values greater than 360 will be reduced by 360 degrees, then<br />

rounded to the nearest 90-degree increment.<br />

This call may be issued at any time after a page is created <strong>and</strong> will be effective in PDF <strong>and</strong> Adobe<br />

PostScript.<br />

dlpdfpagecosobj<br />

This function will return a COS object that represents the page in the Adobe PDF Library. It may be used<br />

to apply COS Layer operations to the page beyond those functions defined in the package.<br />

dlpdfpagenumber<br />

This function will return the sequence number of the specified page. This number may be used in<br />

conjunction with the PDDoc returned by dlpdfdocpddoc to acquire a PDPage for the specified page.<br />

This PDPage will permit Edit Layer functions to be applied to the page beyond those defined in this<br />

package.<br />

dlpdfpagesetid<br />

This function will add an ID Entry to the page dictionary. This is generally a page’s FOLIO.


6.4 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong>


7<br />

Containers<br />

within Pages<br />

This chapter describes containers within pages <strong>and</strong><br />

provides examples of various applications.<br />

7.1


7.2 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

What are Containers?<br />

Container may be a misleading name. These structures “contain” text <strong>and</strong> drawing comm<strong>and</strong>s in the<br />

meaning of structure or hierarchy, but they do not have a limited geometry in the sense of edges or<br />

boundaries. They “contain” text in data processing terms, but are not visual constructs like lines <strong>and</strong><br />

columns, <strong>and</strong> hence are not containers in the typographic sense.<br />

The best way to think of these structures is as a boundless plane. This plane may be positioned, rotated, or<br />

scaled relative to the media on which the text will eventually be imaged. There is no restriction on the<br />

order or placement of things within a container. That is, within the container you are not constrained to<br />

move from left to right, or top to bottom. Nor are you limited to the quadrant that is the range of positive<br />

values. Negative positions within the plane may be used as well as positive positions.<br />

You may use as many containers within a page as you wish, <strong>and</strong> they may be positioned in any way. There<br />

is an overhead for the use of a container, however, <strong>and</strong> keeping the number small is desirable.<br />

The simplest use of containers is to create one for each page, <strong>and</strong> leave it positioned at its default location<br />

<strong>and</strong> rotation. In this case, drawing on the plane <strong>and</strong> drawing on the page are identical operations. The<br />

default configuration of a plane is<br />

• positioned with its origin at the lower left h<strong>and</strong> corner of the media<br />

• scaled 1.0 in both horizontal <strong>and</strong> vertical directions<br />

• oriented with positive values of X proceeding to the right<br />

• oriented with positive values of Y proceeding upward<br />

Often, an existing composition engine will use other positioning. For instance, if your engine assumes that<br />

(0, 0) is the upper left h<strong>and</strong> corner of the page <strong>and</strong> positive values of leading proceed down the page, then<br />

repositioning the container will allow you to use the X/Y values you have already calculated without<br />

changing them.<br />

<strong>DLI</strong> contains three calls that will permit you to modify the location, scaling or rotation of a container<br />

(<strong>and</strong> its content) relative to a page. These may be used at any time before a container is committed to a<br />

page. Other transformations (mirroring, shearing, etc.) may be accomplished by directly modifying the<br />

field AreaXform within the content structure <strong>and</strong> calling dlpdfcontentrotate to make that new<br />

transformation effective.<br />

CAUTION: The transform applied here will also apply to all contents, <strong>and</strong> many of<br />

the possible transformations may not be desirable.


Containers within Pages 7.3<br />

Simplest Container Case<br />

In the simplest case, all of the composed data contain X/Y coordinates in (points * 100), calculated<br />

from the lower left h<strong>and</strong> corner of the page:<br />

"C" Example: Simplest Container Case<br />

void WritePage (DLPDFDOC *Doc, ASFixed Width, ASFixed Depth,<br />

userdata *UserData)<br />

{<br />

DLPDFPAGE *Page = dlpdfdoccreatepage (Doc, Width, Depth);<br />

DLPDFCONTENT *Content = dlpdfcontentcreate (Doc);<br />

USERDATA *UserWork = UserData;<br />

while (UserWork)<br />

{<br />

WriteLine (UserWork, Content);<br />

UserWork = UserWork->next;<br />

}<br />

}<br />

dlpdfcontenttopage (Content, Page);<br />

Scaling<br />

This case assumes all of the above, but distances are in (points * 10) vertically <strong>and</strong> (points *<br />

1000) horizontally. Note that all of your distances, including point sizes <strong>and</strong> font widths, must conform<br />

to this for this single simple solution:<br />

"C" Example: Container with Scale<br />

void WritePage (DLPDFDOC *Doc, ASFixed Width, ASFixed Depth,<br />

userdata *UserData)<br />

{<br />

DLPDFPAGE *Page = dlpdfdoccreatepage (Doc, Width, Depth);<br />

DLPDFCONTENT *Content = dlpdfcontentcreate (Doc);<br />

}<br />

dlpdfcontentscale (Content,<br />

FloatToFixed (1/ 1000),<br />

FloatToFixed (1/10));<br />

USERDATA *UserWork = UserData;<br />

while (UserWork)<br />

{<br />

WriteLine (UserWork, Content);<br />

UserWork = UserWork->next;<br />

}<br />

dlpdfcontenttopage (Content, Page);


7.4 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Inversion<br />

This case assumes that the data in your text will originate in the upper right h<strong>and</strong> corner of the page. Scale<br />

factors remain as for the previous example. Note that in the data writing routine, all vertical positions<br />

must be inverted: e.g. something placed at 4 points below the top of the page would be specified to <strong>DLI</strong> as<br />

-4.<br />

"C" Example: Container Moved to Top of Page<br />

void WritePage (DLPDFDOC *Doc, ASFixed Width, ASFixed Depth,<br />

userdata *UserData)<br />

{<br />

DLPDFPAGE *Page = dlpdfdoccreatepage (Doc, Width, Depth);<br />

DLPDFCONTENT *Content = dlpdfcontentcreate (Doc);<br />

}<br />

dlpdfcontenttranslate (Content, 0, Depth);<br />

dlpdfcontentscale (Content,<br />

FloatToFixed (1/ 1000),<br />

FloatToFixed (1/10));<br />

userdata *UserWork = UserData;<br />

while (UserWork)<br />

{<br />

WriteLine (UserWork, Content);<br />

UserWork = UserWork->next;<br />

}<br />

dlpdfcontenttopage (Content, Page);


Containers within Pages 7.5<br />

Areas<br />

If your composition engine describes lines as being members of an area <strong>and</strong> positions within that area,<br />

then you may want to create a container for each area, <strong>and</strong> distort it to match your definition of an area:<br />

"C" Example: Container within an Area<br />

void WritePage (DLPDFDOC *Doc, ASFixed Width, ASFixed Depth,<br />

areadata *AreaData)<br />

{<br />

DLPDFPAGE *Page = dlpdfdoccreatepage (Doc, Width, Depth);<br />

areadata *CurrentArea = AreaData;<br />

ASFixedMatrix Matrix;<br />

while (AreaData)<br />

{<br />

DLPDFCONTENT *Content = dlpdfcontentcreate (Doc);<br />

/* Calculate rotated lower left corner */<br />

Matrix.a = Matrix.d = fixedOne;/* Unity Matrix */<br />

Matrix.b = Matrix.c = 0;<br />

/* Translate the matrix to the lower left corner of the<br />

* area to be rotated */<br />

Matrix.h = AreaData->X;<br />

Matrix.v = Depth - AreaData->Y - AreaData->Depth;<br />

/* Rotate the matrix to the desired angle */<br />

dlpdfmatrixrotate (&Matrix, AreaData->Rotation);<br />

/* Translate the width <strong>and</strong> depth of the area to the<br />

* desired angle */<br />

Point.h = AreaData->Width;<br />

Point.v = AreaData->Depth;<br />

FixedMatrixTransform (&Point, &Matrix, &Point);<br />

/* Translate to the upper left corner of the rotated area */<br />

dlpdcontenttranslate (Content,<br />

Point.h - AreaData->Width,<br />

Point.v - AreaData->Depth);<br />

dlpdfcontentrotate (Content, AreaData->Rotation);<br />

WriteLines (AreaData->UserData, Content);<br />

dlpdfcontenttopage (Content, Page);<br />

}<br />

AreaData = AreaData->Next;


7.6 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Collection of Areas<br />

In this example, the page content is divided into areas. Each area has a location relative to the top left of<br />

the page, a width, a depth <strong>and</strong> a rotation. Each area’s contents are specified as an X/Y coordinate relative<br />

to the top left of the area. For simplicity, assume that all data is in points <strong>and</strong> is in ASFixed format:<br />

"C" Example: Multiple Containers per Page with Rotation<br />

void WritePage (DLPDFDOC *Doc, ASFixed Width, ASFixed Depth,<br />

areadata *AreaData)<br />

{<br />

DLPDFPAGE *Page = dlpdfdoccreatepage (Doc, Width, Depth);<br />

areadata *CurrentArea = AreaData;<br />

while (AreaData)<br />

{<br />

DLPDFCONTENT *Content = dlpdfcontentcreate (Doc);<br />

dlpdcontenttranslate (Content, AreaData->X,<br />

Depth - AreaData->Y);<br />

dlpdfcontentrotate (Content, AreaData->Rotation);<br />

WriteLines (AreaData->UserData, Content);<br />

dlpdfcontenttopage (Content, Page);<br />

AreaData = AreaData->Next;<br />

}<br />

For the rotation to work correctly in the preceding example, the composition engine must supply the X/Y<br />

coordinates of the area as the upper left corner viewed from the text, regardless of rotation. That is:<br />

u.l<br />

no<br />

rotation<br />

u.l<br />

90<br />

rotation<br />

u.l<br />

180<br />

rotation<br />

u.l<br />

270<br />

rotation<br />

When the area is always viewed as upright, i.e. the position of the area is always given as the highest,<br />

leftmost point on the page where that is area to be placed with no rotation, the previous example should<br />

be used instead.


8<br />

Working<br />

with Content<br />

This chapter explains content <strong>and</strong> defines the calls<br />

available at this level.<br />

8.1


8.2 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Overview of Content Interface<br />

The Content Interface contains the bulk of the interface. At this level, you make marks on paper. Those<br />

marks may be on a Page or on a Forms XObject. They may be text, line drawings, or images. The marks<br />

made in a content area may also be used in a patterned color.<br />

Control Structures<br />

Control of style is maintained in the Adobe PDF Library structures PDEGraphicState <strong>and</strong><br />

PDETextState. These structures are created <strong>and</strong> modified exactly as if the Adobe PDF Library were<br />

used without <strong>DLI</strong>.<br />

When created, content structures are always associated with a given document. They may be filled with<br />

arbitrarily complex text. After filling, they are associated with a Page or with a Forms XObject.<br />

Association destroys the structure. A single content element may be associated with a Forms XObject.<br />

Any number of elements may be associated with a Page.<br />

A set of transforms may be associated with a content element to position it within the Forms XObject or<br />

Page. This permits simple definition of text in columns or areas.<br />

Layering of text is straightforward:<br />

• The first mark made is considered to be on the bottom; all following marks are above it.<br />

• When an Image or a Form is included in a page, it is above all preceding text <strong>and</strong> below all following<br />

text.<br />

• When multiple content elements are contained in a page, they are layered in the order they are added to<br />

the page.<br />

A content element is represented by the structure DLPDFCONTENT. These structures are destroyed when<br />

associated with a page or form, <strong>and</strong> pointers to them should not be used after that time.


Working with Content 8.3<br />

Content Interface Calls<br />

The following sections contain information about the calls available for content elements.<br />

Creation <strong>and</strong> Positioning<br />

These calls are used to create <strong>and</strong> position a text container.<br />

Background colors, textures, <strong>and</strong> graphics may also be created for a container by the use of image <strong>and</strong><br />

drawing comm<strong>and</strong>s, although special functions have not been supplied to accomplish these.<br />

dlpdfcontentcreate<br />

This function will create a new content element. It will be created with a rotation of zero degrees, a<br />

position of (0,0), <strong>and</strong> scaling of (1,1).<br />

dlpdfcontentrotate<br />

This procedure will rotate all of the contents of a given content structure by the specified amount. The<br />

given value may be any amount, but will be reduced to between 0 <strong>and</strong> 360 degrees. It is expressed in<br />

degrees of counter-clockwise rotation about the content structure’s lower-left corner.<br />

dlpdfcontentscale<br />

This procedure will scale all of the content of a given content structure by the specified amount, which<br />

must be a positive number greater than 0.0001.<br />

dlpdfcontenttranslate<br />

This procedure will move all of the contents of a content structure by the specified amounts, which are<br />

assumed to be in points. Positive values move up or right, depending on the axis; negative values move<br />

down <strong>and</strong> left.


8.4 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Text Placement<br />

These calls are used to position text within a container.<br />

dlpdfcontenttext<br />

This procedure adds a NULL-terminated string of text to the content. It will be placed such that the<br />

baseline of the left edge of the first character aligns with the given position (XPos,YPos) in points. The<br />

baseline should also proceed at the angle specified in Rotate, where zero is to the right <strong>and</strong> positive<br />

numbers produce counter-clockwise rotation in degrees. It will be set in the specified font at the specified<br />

PointSize <strong>and</strong> SetWidth. The parameters of PDEGraphicState <strong>and</strong> PDETextState will be<br />

observed.<br />

dlpdfcontentwidetext<br />

Same as dlpdfcontenttext, but permits Unicode <strong>and</strong> MultiByte text.<br />

Text Width Evaluation<br />

On occasion, it is necessary to know the width of text. The following calls will accomplish that.<br />

dlpdfcontenttextwidth<br />

This procedure is included as an aid to composition, <strong>and</strong> to transforming widths, particularly word space<br />

widths, into PDF units. The procedure will return the width (in points) of the specified text.<br />

Its calling parameters include:<br />

• the specified Font<br />

• the text to be measured<br />

• its current SetWidth (horizontal point size)<br />

• Current Text State, a pointer to a PDETextState structure, which may be NULL. It can also be<br />

declared memset() to all 0 values, <strong>and</strong> used right away; no further initialization is required, nor is it<br />

provided for.<br />

dlpdfcontentwidetextwidth<br />

Same as dlpdfcontenttextwidth, but permits multi-byte (Unicode) text.


Working with Content 8.5<br />

Line Drawing<br />

These calls are used to draw lines within an area, <strong>and</strong> to fill or stroke those lines. Common to all of these<br />

calls is the PDEGraphicState, which defines line drawing parameters (Line Width, Join, Miter,<br />

etc.) <strong>and</strong> the Paint Operator, which defines how the path defined should be treated (kPDEStroke,<br />

kPDEFill, kPDEEoFill, or a combination of these).<br />

There are two color definitions within the PDEGraphicState:<br />

• Fill Color will be used with the operators kPDEFill or kPDEEoFill.<br />

• Stroke Color will be used with the operator kPDEStroke.<br />

All of the fields within PDEGraphicState will be honored.<br />

NOTE: Stroking will colorize to a given width, while filling will colorize within the<br />

borders. To draw lines, use stroking to give the line a width.<br />

Functions are provided here to produce commonly-used shapes. The general path operator<br />

dlpdfcontentpath can image arbitrarily complex shapes.<br />

All of the coordinate values <strong>and</strong> sizes specified below are considered to be in points. The content element<br />

in which these are placed may translate, scale or rotate the image.<br />

dlpdfcontentclip<br />

This call is used to establish a clipping path. Note that clipping paths are not established automatically for<br />

images, forms, or line drawings. Generally, PDF images page more efficiently if there is no clipping<br />

involved.<br />

A clipping region is considered a part of the content structure, <strong>and</strong> will be ended at the end of a content<br />

structure. Clipping regions may be nested, but each nested region must fit within the previous region. A<br />

clipping region can, <strong>and</strong> should, be ended as soon as possible, using the dlpdfcontentclipend call.<br />

The Path <strong>and</strong> Pathlen oper<strong>and</strong>s of this call are identical to the dlpdfcontentpath oper<strong>and</strong>s. The<br />

EOClip oper<strong>and</strong> should be FALSE for a normal clip <strong>and</strong> TRUE for an Even/Odd clip.<br />

dlpdfcontentclipend<br />

This call is used to manually end a clipping region prior to the end of the content structure. It should be<br />

called as soon as possible after a clipping region is established.


8.6 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfcontentpath<br />

This procedure will mark a path within the content. The path is specified as an array of ASFixed values,<br />

pointed to by Path, with PathLen entries in the array. This is in all ways the same path as would be used<br />

by the Adobe PDF Library path operators. Such a path may be created manually or by use of the Edit<br />

Layer of the Adobe PDF Library. If created with the Adobe PDF Library, the pointer returned by<br />

PDEPathGetData is sufficient for this call.<br />

NOTE: The length returned by that call is the number of entries in the list, not the<br />

size in bytes of the list.<br />

dlpdfcontentrect<br />

This procedure marks a rectangle in the content. It will be located such that its lower left h<strong>and</strong> corner is at<br />

(X,Y); it will be Width wide, <strong>and</strong> Height high. Width <strong>and</strong> Height may not be specified as zero but may<br />

be specified as negative numbers, which results in flopping the rectangle.<br />

dlpdfcontentline<br />

This procedure will mark a line in the content. The line will extend from (X1,Y1) to (X2,Y2).<br />

dlpdfcontentarc<br />

This procedure is included as an aid in transitioning from PostScript to PDF. It will draw an arc centered<br />

at (X1, Y1), at a radius of Radius, from Angle1 to Angle2, counter-clockwise, where the angles are<br />

considered to be in degrees.<br />

dlpdfcontentarcn<br />

This procedure is included as an aid in transitioning from PostScript to PDF. It will draw an arc centered<br />

at (X1, Y1), at a radius of Radius, from Angle1 to Angle2, clockwise, where the angles are considered<br />

to be in degrees.<br />

dlpdfcontentarcto<br />

This is a convenience method to mimic the PostScript ArcTo operator. It will locate the intersections of<br />

the line (X1,Y1)->(Xint, Yint), <strong>and</strong> (X2,Y2)->(Xint, Yint), <strong>and</strong> draw an arc of the specified radius<br />

tangent to those two lines. The line segment from (X1,Y1) to the arc will be drawn. Unlike the PostScript<br />

ArcTo operator, the segment from the tangent to (X2,Y2) will also be drawn.


Working with Content 8.7<br />

dlpdfcontentpieslice<br />

This procedure is included as an aid in graph construction. It will draw a pie slice, centered at (X1,Y1), at<br />

a radius of Radius, from Angle1 to Angle2, counter-clockwise, where the angles are specified in<br />

degrees.<br />

dlpdfcontentpieslicen<br />

This procedure is included as an aid in graph construction. It will draw a pie slice, centered at (X1,Y1), at<br />

a radius of Radius, from Angle1 to Angle2, clockwise, where the angle is specified in degrees.<br />

dlpdfcontentcircle<br />

This procedure is included as an aid in transitioning from PostScript to PDF. It will draw a circle centered<br />

at (X1,Y1), at a radius of Radius.<br />

dlpdfcontentellipse<br />

This procedure is included as an aid in transitioning from PostScript to PDF. It will draw an ellipse<br />

centered at (X1,Y1), at a vertical radius of RadiusV <strong>and</strong> a horizontal radius of RadiusH.<br />

Paths<br />

Paths are created in the context of a document <strong>and</strong> represented as a structure, DLPDFPATH.<br />

dlpdfpathcreate<br />

Used to construct a path, this method accepts no parameters. It will return a pointer to DLPDFPATH or<br />

raise an exception indicating that no memory is available.<br />

dlpdfpathdestroy<br />

Used to destroy, this method accepts a pointer to a DLPDFPATH structure <strong>and</strong> will return nothing. It will<br />

raise the exception Bad Parameter if the pointer is not valid.<br />

dlpdfpathclear<br />

Used to reset a path, this method sets the current position to UNSET, the matrix to UNITY, <strong>and</strong> removes<br />

any path segment present. It will not deallocate the array used to hold the path, however, since its primary<br />

purpose is to lower the overhead associated with allocation <strong>and</strong> deallocation. It will raise the exception<br />

Bad Parameter if it is called with a NULL pointer.


8.8 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfpathcurrentx<br />

This method will return the current X position as an ASFixed integer.<br />

dlpdfpathcurrenty<br />

This method will return the current Y position as an ASFixed integer.<br />

dlpdfpathsize<br />

This method will return the current size of the path array (as a count of ASFixed integers) as an integer.<br />

dlpdfpatharray<br />

This method will return a pointer to the first member of the array of ASFixed integers, which is the path.<br />

Appending Line Segments to an Existing Path<br />

The following methods append line segments to an existing path. Each of these accepts a pointer to a path<br />

as the first parameter, <strong>and</strong> may or may not have additional parameters describing the line segment to be<br />

built. These methods will return nothing, but may raise an exception if the parameters are not properly<br />

formed.<br />

dlpdfpathaddline<br />

This method accepts three parameters:<br />

• The first is a pointer to the path.<br />

• The second is the absolute Xposition.<br />

• The third is the absolute Yposition.<br />

A line will be drawn from the current position to the specified new position. If the current position is the<br />

same as the new position, no line segment will be added to the path, <strong>and</strong> no notice will be given<br />

(Optimizing). The current position following this comm<strong>and</strong> will be the specified position.


Working with Content 8.9<br />

dlpdfpathaddliner<br />

This methods accepts two parameters, the coordinates of the destination to draw to:<br />

• The first is the distance from the current Xposition to the specified Xposition.<br />

• The second is the distance from the current Yposition to the specified Yposition.<br />

A line will be drawn from the current position to the specified new position. If the distances specified are<br />

both zero, no line segment will be added to the path <strong>and</strong> no notice will be given (Optimizing). The<br />

position following this comm<strong>and</strong> will be the position derived by applying the X <strong>and</strong> Y offsets to the prior<br />

position.<br />

dlpdfpathaddmove<br />

This method accepts two parameters, the coordinates of the destination to move to:<br />

• The first is an Xposition relative to the current context.<br />

• The second is a Yposition relative to the current context.<br />

The current position will be moved to the specified position without adding a stroked line. If the current<br />

position is the same as the specified new position, no line segment will be added to the path, <strong>and</strong> no notice<br />

will be given (Optimization). The position following this comm<strong>and</strong> will be the specified position.<br />

dlpdfpathaddmover<br />

This method accepts two parameters:<br />

• The first is an Xposition relative to the current context.<br />

• The second is a Yposition relative to the current context.<br />

The current position will be moved to the specified position without adding a stroked line. If the current<br />

position is the same as the specified new position, no line segment will be added to the path, <strong>and</strong> no notice<br />

will be given (Optimization). The position following this comm<strong>and</strong> will be the specified position.


8.10 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfpathaddarc<br />

This method accepts six parameters:<br />

• The first is a pointer to the path.<br />

• The second is an Xposition of the arc center point.<br />

• The third is the Yposition of the arc center point.<br />

• The fourth is the radius of the arc.<br />

• The fifth is the start angle (where zero is directly to the right of center) where the arc is to begin.<br />

• The sixth is the end angle where the arc is to end.<br />

If the current position does not coincide with the position defined by X1, Y1, Radius <strong>and</strong> Start<br />

Angle, then a straight line segment will be added from the current position to this point. A smooth curve<br />

of the specified radius will be drawn from that specified point counter-clockwise to the point specified<br />

by X1, Y1, Radius, End Angle. The current position will be set to that ending point. If the starting <strong>and</strong><br />

ending points specify the same angle, a full circle will be drawn. The position following this comm<strong>and</strong> will<br />

be the specified position.<br />

dlpdfpathaddarcn<br />

This method accepts six parameters:<br />

• The first is a pointer to the path.<br />

• The second is an Xposition of the arc center point.<br />

• The third is the Yposition of the arc center point.<br />

• The fourth is the radius of the arc.<br />

• The fifth is the start angle (where zero is directly to the right of center) where the arc is to begin.<br />

• The sixth is the end angle where the arc is to end.<br />

If the current position does not coincide with the position defined by X1, Y1, Radius <strong>and</strong> Start<br />

Angle, then a straight line segment will be added from the current position to this point. A smooth curve<br />

of the specified radius will be drawn from that specified point clockwise to the point specified by X1,<br />

Y1, Radius, End Angle. The current position will be set to that ending point. If the starting <strong>and</strong> ending<br />

points specify the same angle, a full circle will be drawn. The position following this comm<strong>and</strong> will be the<br />

specified position.


Working with Content 8.11<br />

dlpdfpathaddarcto<br />

This method accepts six parameters:<br />

• The first is a pointer to the path.<br />

• The second is an Xposition of the intersection of tangents.<br />

• The third is the Yposition of the intersection of tangents.<br />

• The fourth is the Xposition of a point defining the second tangent.<br />

• The fifth is the Yposition of a point defining the second tangent.<br />

• The sixth is the radius of the arc.<br />

The two lines (CurrX, CurrY)->(X1,Y1) <strong>and</strong> (X2,Y2)->(X1,Y1) are joined by an arc of radius (R). The<br />

line segment from the current position to the start of the arc is drawn, followed by the arc itself. The line<br />

segment from the end of the arc to the point X2,Y2 is not drawn. The position following this comm<strong>and</strong><br />

will be the intersection of the arc with the line (X2,Y2)->(X1,Y1). If the two lines are colinear, a straight<br />

line segment is drawn from current position to (X1,Y1), which then becomes the current point.<br />

dlpdfpathaddelliparc<br />

This method accepts seven parameters:<br />

• The first is a pointer to the path.<br />

• The second is an Xposition of the arc center point.<br />

• The third is the Yposition of the arc center point.<br />

• The fourth is the horizontal radius (HRad) of the ellipse defining an arc segment.<br />

• The fifth is the vertical radius (VRad) of the same ellipse. The HRad <strong>and</strong> VRad functions support<br />

creating arc segments from an elliptical shape, instead of a circular shape as described in<br />

dlpdfpathaddarc. If the same horizontal <strong>and</strong> vertical radii are passed to this function, it behaves<br />

identically to dlpdfpathaddarc.<br />

• The sixth is the start angle (where zero is directly to the right of center) where the arc is to begin.<br />

• The seventh is the end angle where the arc is to end. If the current position does not coincide with<br />

the position defined by X1, Y1, Radius <strong>and</strong> Start Angle, then a straight line segment will be added<br />

from the current position to this point. A smooth curve of the specified radius will be drawn from<br />

that specified point counter-clockwise to the point specified by X1, Y1, Radius <strong>and</strong> End Angle. The<br />

current position will be set to that ending point.<br />

If the starting <strong>and</strong> ending points specify the same angle, a full circle will be drawn. The position following<br />

this comm<strong>and</strong> will be the specified position.


8.12 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfpathaddelliparcn<br />

This method accepts seven parameters:<br />

• The first is a pointer to the path.<br />

• The second is an Xposition of the arc center point.<br />

• The third is the Yposition of the arc center point.<br />

• The fourth is the horizontal radius (HRad) of the arc.<br />

• The fifth is the vertical radius (VRad) of the arc. The HRad <strong>and</strong> VRad support drawing elliptical arc<br />

segments.<br />

• The sixth is the start angle (where zero is directly to the right of center) where the arc is to begin.<br />

• The seventh is the end angle where the arc is to end. If the current position does not coincide with<br />

the position defined by X1, Y1, Radius <strong>and</strong> Start Angle, then a straight line segment will be added<br />

from the current position to this point.<br />

A smooth curve of the specified radius will be drawn from that specified point clockwise to the point<br />

specified by X1, Y1, Radius <strong>and</strong> End Angle. The current position will be set to that ending point. If the<br />

starting <strong>and</strong> ending points specify the same angle, a full circle will be drawn. The position following this<br />

comm<strong>and</strong> will be the specified position.<br />

dlpdfpathaddelliparcto<br />

This method accepts seven parameters:<br />

• The first is a pointer to the path.<br />

• The second is the Xposition of the intersection of tangents.<br />

• The third is the Yposition of the intersection of tangents.<br />

• The fourth is the Xposition of a point defining the second tangent.<br />

• The fifth is the Yposition of a point defining the second tangent.<br />

• The sixth is the horizontal radius (HRad) of the arc.<br />

• The seventh is the vertical radius (VRad) of the arc.<br />

The HRad <strong>and</strong> VRad support drawing elliptical arc segments. The two lines (CurrX,CurrY)->(X1,Y1)<br />

<strong>and</strong> (X2,Y2)->(X1,Y1) are joined by an arc of radius (R). The line segment from the current position to<br />

the start of the arc is drawn, followed by the arc itself. The line segment from the end of the arc to the<br />

point X2,Y2 is not drawn.<br />

The position following this comm<strong>and</strong> will be the intersection of the arc with the line (X2,Y2)->(X1,Y1). If<br />

the two lines are colinear, a straight line segment is drawn from the current position to (X1,Y1), which<br />

then becomes the current point.


Working with Content 8.13<br />

dlpdfpathaddcurve<br />

This method accepts seven parameters:<br />

• The first is a pointer to a path.<br />

• The second <strong>and</strong> third are the X <strong>and</strong> Y positions of a point which will be Control Point 1.<br />

• The fourth <strong>and</strong> fifth are the X <strong>and</strong> Y positions of a point which will be Control Point 2.<br />

• The sixth <strong>and</strong> seventh are the X <strong>and</strong> Y positions of a point which will be the end point of the curve.<br />

A smooth curve (a cubic Bézier) will be drawn from the current position to the end position, under<br />

direction of the two control points. The current position will be the end position of the line at completion<br />

of this operation. If the end position specified is identical to the current position, no segment will be<br />

appended, <strong>and</strong> no notice will be given (Optimization).<br />

dlpdfpathaddcurver<br />

This method accepts seven parameters:<br />

• The first is a pointer to a path.<br />

• The second <strong>and</strong> third are the distance from current point to the X <strong>and</strong> Y positions of a point which will<br />

be used for Control Point 1.<br />

• The fourth <strong>and</strong> fifth are the distance from current point to the X <strong>and</strong> Y positions of a point which will<br />

be Control Point 2.<br />

• The sixth <strong>and</strong> seventh are the distance from the control point to the X <strong>and</strong> Y positions of a point which<br />

will be the end point of the curve.<br />

A smooth curve (A cubic Bézier) will be drawn from the current position to the end position, under<br />

direction of the two control points. The current position will be the end position of the line at completion<br />

of this operation. If the end position specified is identical to the current position, no segment will be<br />

appended, <strong>and</strong> no notice will be given (Optimization).<br />

dlpdfpathaddcurvev<br />

This method accepts five parameters:<br />

• The first is a pointer to a path.<br />

• The second <strong>and</strong> third are the X <strong>and</strong> Y positions of a point which will be used for Control Point 2.<br />

• The fourth <strong>and</strong> fifth are the X <strong>and</strong> Y positions of the end point of the curve.<br />

A smooth curve (a cubic Bézier) will be drawn from the current position to the end position, under<br />

direction of the two control points. Control Point 1 is the current position. The current position will be<br />

the end position of the line at completion of this operation. If the end position specified is identical the<br />

current position, no segment will be appended, <strong>and</strong> no notice will be given (Optimization).


8.14 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfpathaddcurvey<br />

This method accepts five parameters:<br />

• The first is a pointer to a path.<br />

• The second <strong>and</strong> third are the X <strong>and</strong> Y positions of a point which will be used for Control Point 1.<br />

• The fourth <strong>and</strong> fifth are the X <strong>and</strong> Y positions of the end point of the curve.<br />

A smooth curve (a cubic Bézier) will be drawn from the current position to the end position, under<br />

direction of the two control points. Control Point 2 is the end position. The current position will be the<br />

end position of the line at completion of this operation. If the end position specified is identical to the<br />

current position, no segment will be appended, <strong>and</strong> no notice will be given (Optimization).<br />

dlpdfpathaddrect<br />

This method accepts five parameters:<br />

• The first is a pointer to a path.<br />

• The second <strong>and</strong> third are the X <strong>and</strong> Y positions of a point which will be one corner of the box.<br />

• The fourth will be the width of the box.<br />

• The fifth will be the depth of the box.<br />

If the specified position is not the current position, a MoveTo to the specified position will be made. A<br />

rectangle will be added to the path, starting at the specified position <strong>and</strong> proceeding upward (unless the<br />

depth is negative) <strong>and</strong> to the right (unless the width is negative). The end position after this operation<br />

will be the specified position.<br />

If the width <strong>and</strong> depth are both zero, no segment will be appended, but the current position will still be<br />

updated.<br />

dlpdfpathaddclose<br />

This method accepts no oper<strong>and</strong>s. It will append to the path a close path operator <strong>and</strong> leave the<br />

current position as the first specified position in the path.<br />

dlpdfpathsetmatrix<br />

This method accepts a pointer to a path <strong>and</strong> a pointer to a matrix. The specified matrix will be<br />

concatenated (i.e. applied) to the matrix of each container in which this path is drawn, affecting all on the<br />

current path. This allows the user complete <strong>and</strong> flexible control of the shape drawn by the path. If the<br />

pointer to the path or the matrix is NULL, a genErrBadParm exception will be raised.


Working with Content 8.15<br />

dlpdfmatrixrotate<br />

This function will modify the specified matrix so as to effect counter-clockwise rotation of any marks<br />

drawn via this matrix. Angle is an angle in degrees <strong>and</strong> fractions of degrees.<br />

Patterns<br />

Patterns are created in the context of a document, <strong>and</strong> represented by the structure DLPDFPATTERN.<br />

They contain a content block, whose contents become one tile of the pattern. The size, shape, <strong>and</strong> location<br />

of a given tile can be modified by the specified matrix.<br />

The size of the tile is set by the BBox (Bounding Box) parameter.<br />

Spacing between adjacent tiles is set by the Xstep <strong>and</strong> Ystep parameters. Tiles may overlap, be placed<br />

adjacent, or be placed with space between them.<br />

The TileType parameter may be 1, 2 or 3, corresponding to the Adobe TileType parameter (see the<br />

Portable Document Format <strong>Reference</strong> Manual).<br />

The Colored parameter, if true, indicates that the pattern contains its own color specifications which<br />

should be used in place of any fill/stroke color specification. If the Colored parameter is FALSE, it<br />

indicates that the fill/stroke specification should be used for color.<br />

dlpdfpatterncreate<br />

This creates a patterned color space, <strong>and</strong> returns a pointer to that space. The pointer may be used in<br />

dlpdfcontentusefillpattern or dlpdfcontentusestrokepattern to apply this colored<br />

pattern to all following material. All patterns will be destroyed <strong>and</strong> their h<strong>and</strong>les invalidated in the<br />

destruction of the document that contains them.<br />

dlpdfcontentusefillpattern<br />

See dlpdfpatterncreate above. Note that this call with a NULL pointer to a pattern will turn off<br />

patterned color space.<br />

dlpdfcontentusestrokepattern<br />

Similar to dlpdfcontentusefillpattern above.


8.16 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Referencing Predefined Structures<br />

These calls permit the inclusion in content of complex pre-built structures. These structures may be<br />

arbitrarily positioned, scaled <strong>and</strong> rotated when placed into the content.<br />

dlpdfcontentreferenceform<br />

This procedure places a copy of a Form into the current content. All of the markings in the Form will<br />

appear. The lower left h<strong>and</strong> corner of the Form will be positioned at (X, Y). The Form will be rotated<br />

counter-clockwise as per rotate <strong>and</strong> scaled as per ScaleX <strong>and</strong> ScaleY.<br />

dlpdfcontentreferenceimage<br />

This procedure places a copy of the referenced image into the current content. It will be placed so as to<br />

align its lower left h<strong>and</strong> corner with (X, Y), will be scaled as per ScaleX <strong>and</strong> ScaleY, <strong>and</strong> rotated as per<br />

Rotate.<br />

The Scale Factors will determine the resulting size of the image. You need to know the original image<br />

resolution <strong>and</strong> its intended size in order to determine whether a Scale Factor on either axis is required. In<br />

<strong>DLI</strong> v2.2.5 <strong>and</strong> higher, the dlpdfimagegetsize method can retrieve image sizing data for you, <strong>and</strong><br />

dividing the intended print size by the file size for each dimension (delivered by dlpdfimagegetsize)<br />

will yield a Scale Factor ratio which dlpdfcontentreferenceimage will use to calculate the final<br />

output image size.<br />

The typical scaling calculation using values returned by dlpdfimagegetsize would be to divide the<br />

intended print size by the image size on each axis; e.g.<br />

dlpdfcontentreferenceimage(Content, Image,<br />

Int32ToFixed(72), Int32ToFixed(92), 0,<br />

ASFixedDiv(xPoints, Int32ToFixed(xRasters)),<br />

ASFixedDiv(yPoints, Int32ToFixed(yRasters)));<br />

An image in which each pixel of each raster line represents one PDF unit of output will return the same<br />

values for both image dimension (xRasters <strong>and</strong> yRasters) <strong>and</strong> print size (xPoints <strong>and</strong> yPoints),<br />

<strong>and</strong> thus a Scale Factor of 1 on both axes.<br />

dlpdfimagegetsize<br />

The Scale Factors specified in dlpdfcontentreferenceimage will determine the resulting size of the<br />

image. This method gives you the image information necessary to calculate those values, dividing the<br />

intended print size by the file size for each dimension. This yields a Scale Factor ratio which<br />

dlpdfcontentreferenceimage uses to calculate the final output image size.


Working with Content 8.17<br />

Associating Content to Page<br />

The dlpdfcontenttopage call places the content onto a page. Once made, the content is no longer<br />

accessible via the <strong>DLI</strong> Package, <strong>and</strong> the pointer to the content structure is no longer valid.<br />

dlpdfcontenttopage<br />

This procedure will make the markings placed into content a part of the specified page. Following this<br />

call, the content structure no longer exists: pointers to it are then invalid <strong>and</strong> should no longer be used.<br />

Adding Comments to Content Elements<br />

dlpdfcontentcomment<br />

This method will insert the specified text string, in the order provided, into the content elements. This<br />

string will always be placed on a separate line, preceded by "%" to mark it as a comment. The comment<br />

text must not contain a newline character, unless the character following that newline is a percent sign<br />

("%"). The content element must be valid; the comment pointer must point at a valid non-NULL, non-zerolength<br />

string.


8.18 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong>


9<br />

Working<br />

with Forms<br />

This chapter explains Forms XObjects <strong>and</strong> defines the<br />

calls available.<br />

9.1


9.2 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Overview of Forms<br />

Forms, in this sense, are predefined content that may be placed into a document many times. A form’s<br />

content will be included in the PDF or PostScript document only once, but it may be imaged in the<br />

document any number of times. Defining forms is a powerful means of reducing the size of a document. It<br />

also considerably reduces the time needed to create a document.<br />

Forms Structure<br />

A form is represented in <strong>DLI</strong> as a structure, DLPDFFORM. Any number of forms may be defined, on a perdocument<br />

basis: if the same form is needed in multiple documents, multiple copies of it must be created.<br />

Forms are tracked within the document structure, <strong>and</strong> all forms for a document are destroyed when the<br />

document is destroyed. Pointers to forms become invalid when the document is destroyed <strong>and</strong> must not be<br />

used after that time.<br />

The content of a form may be arbitrarily complex. Forms may contain images as well as other forms.<br />

Form Calls<br />

There are only a few calls which involve forms.<br />

dlpdfformcreate<br />

This function will create a new form in the document specified as Doc, with the content previously placed<br />

into the container Content.<br />

The form will be considered to be of the size specified in BBox. This is an Adobe PDF Library ASFixed<br />

Rectangle, whose contents are assumed to be in points. The Bounding Box need not be located at (0,0);<br />

however, it must have a positive Width <strong>and</strong> Depth. The content block used to create a form is destroyed<br />

in the form’s creation, <strong>and</strong> any h<strong>and</strong>les to it become invalid after that point.<br />

dlpdfcontentreferenceform<br />

<strong>Reference</strong> to a form in content is made via dlpdfcontentreferenceform.


Working with Forms 9.3<br />

dlpdfformdestroy<br />

This destroys the named form, releasing its resources. It invalidates the form h<strong>and</strong>le.


9.4 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong>


10<br />

Displaying<br />

Line Drawings<br />

Line drawings are pictures made up of lines connecting<br />

specified points. These lines may be stroked (covered in a<br />

fixed width <strong>and</strong> colored marking) or filled (the space<br />

defined by the inside of the lines is painted with a defined<br />

color or pattern). The areas defined by such a set of lines<br />

need not be contiguous.<br />

10.1


10.2 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Overview<br />

This chapter contains calls used to draw lines within an area, <strong>and</strong> fill or stroke those lines while producing<br />

commonly-used shapes. Common to all of these calls is the PDEGraphicState, which defines line<br />

drawing parameters (Line Width, Join, Miter, etc.) <strong>and</strong> the Paint operator, which defines how the<br />

path defined should be treated (kPDEStroke, kPDEFill, kPDEEoFill, or a combination of these).<br />

There are two color definitions within the PDEGraphicState:<br />

• Fill Color will be used with the operators kPDEFill or kPDEEoFill<br />

• Stroke Color will be used with the operator kPDEStroke.<br />

All of the fields within PDEGraphicState will be honored.<br />

NOTE: Stroking will colorize to a given width, while filling will colorize within the<br />

borders. To draw lines, use stroking to give the line a width.<br />

Functions are provided in this chapter to produce commonly-used shapes. The general path operator<br />

dlpdfcontentpath can image arbitrarily complex shapes.<br />

All of the coordinates <strong>and</strong> sizes specified below are considered to be in points. The content element in<br />

which these are placed may translate, scale, or rotate the image.<br />

Approaches to Line Drawing<br />

There are two approaches to line drawing supported by <strong>DLI</strong>. The first uses a simple interface to construct<br />

or fill <strong>and</strong> stroke a structure. The second permits the user to construct an arbitrarily complex collection of<br />

markings, <strong>and</strong> then place that collection within any number of content structures.


Displaying Line Drawings 10.3<br />

Directly-Drawn Methods<br />

In general, the directly-drawn methods are the simplest to use, <strong>and</strong> the best choice for operations like<br />

underlining, page rules <strong>and</strong> area borders. This collection of directly-drawn structures is derived from the<br />

operators for PostScript graphics, <strong>and</strong> common usage of those operators.<br />

All of these operators have their first three parameters in common. These are:<br />

• The container in which the structure will be drawn<br />

• The current state in which all parameters are used<br />

• The Painting operator, which defines how the path defined should be treated. It must be one of the<br />

following, or a combination of these:<br />

• kPDEStroke — stroke the lines of the structures<br />

• kPDEFill — fill the areas defined by the lines<br />

• kPDEEOFill — stroke the area contained an odd number of times by the area.<br />

In the case of these structures, there can be no multiple containment, <strong>and</strong> hence EOFill <strong>and</strong> Fill will<br />

have the same results.<br />

All of the methods have additional parameters, specifying the location <strong>and</strong> size of the structure drawn.<br />

These will be different for each structure, but will always be ASFixed values.<br />

If the content area in which these structures are drawn is itself distorted (i.e. its AreaMatrix is not the<br />

unity matrix; see the discussion of containers <strong>and</strong> matrix manipulation beginning with “What are<br />

Containers?” on page 7.2), then the structures drawn will be positioned <strong>and</strong> shaped to reflect that<br />

distortion.<br />

dlpdfcontentrect<br />

This will draw a rectangle. The four parameters are ASFixed values reflecting X position, Y<br />

position, Width <strong>and</strong> Depth. If Width <strong>and</strong> Depth are positive numbers, the rectangle will be<br />

positioned with its lower left h<strong>and</strong> corner at the position (X,Y).<br />

dlpdfcontentline<br />

This will draw a line. There are four parameters, reflecting ASFixed values for (X,Y) start <strong>and</strong> (X,Y) end.<br />

NOTE: The Fill operator is meaningless with this structure.


10.4 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfcontentarc<br />

This will draw a curved line.<br />

• The first two parameters are ASFixed values reflecting the (X,Y) position of the center of the circle of<br />

which this arc is a portion.<br />

• The third parameter is the ASFixed value of the Radius of that circle.<br />

• The fourth <strong>and</strong> fifth parameters are the Start Angle <strong>and</strong> End Angle at which the arc starts <strong>and</strong><br />

ends respectively.<br />

The arc is drawn counter-clockwise from Start Angle to End Angle. The angles are specified in<br />

degrees, with Zero degrees pointing to the right. If the start <strong>and</strong> end angles are coincident, a full circle will<br />

be drawn.<br />

dlpdfcontentarcn<br />

This is identical to the previous, except that the arc is drawn clockwise.<br />

dlpdfcontentarcto<br />

This is an implementation of the PostScript arcto comm<strong>and</strong>, included as a convenience to output drivers<br />

which currently support PostScript.<br />

• The first two parameters are the ASFixed values of the (X,Y) position of the Line Start.<br />

• The third is the ASFixed value of the Radius of the Arc Segment.<br />

• The fourth <strong>and</strong> fifth are the ASFixed values of the (X,Y) position of the Intersection.<br />

• The sixth <strong>and</strong> seventh are the ASFixed value of the (X,Y) position of the Line End.<br />

NOTE: This implementation will draw the line segment from the end of the arc to<br />

the end position, which would not be drawn in PostScript.<br />

dlpdfcontentpieslice<br />

This method was included as a convenience operator for the construction of pie charts.<br />

• The first two parameters are the ASFixed values for (X,Y) of the center of the pie the slice is taken<br />

from.<br />

• The third is the ASFixed value for the Diameter of the pie slice.<br />

• The fourth <strong>and</strong> fifth are the Start Angle <strong>and</strong> End Angle, in degrees, of the pie slice.<br />

The angles are counter-clockwise from right. The arc of the pie will be drawn counter-clockwise. If the<br />

angles are coincident, a full circle will be drawn.


Displaying Line Drawings 10.5<br />

dlpdfcontentpieslicen<br />

This is identical to dlpdfcontentpieslice above, except that the arc will be drawn clockwise from<br />

the Start Angle to the End Angle.<br />

dlpdfcontentcircle<br />

This method will draw a circle whose center is the first two parameters <strong>and</strong> whose radius is the third<br />

parameter.<br />

dlpdfcontentellipse<br />

This method will draw an ellipse whose center is the first two parameters, the ASFixed value of the X<br />

Radius is the third parameter, <strong>and</strong> the ASFixed value of the Y Radius is the fourth parameter.<br />

dlpdfcontentpath<br />

This method will draw an arbitrary path. The path is an array of ASFixed values, constructed according<br />

to the PDF rules for path construction. These can be found in the Adobe PDF Library API <strong>Reference</strong><br />

Manual under PDEPathAddSegment.<br />

The path may have been constructed via PDEPath operators, or constructed manually.<br />

NOTE: If constructed via PDEPath, then PDEPathGetData must be used to<br />

obtain the array <strong>and</strong> array size used in this call.<br />

The first parameter is a pointer to an array of ASFixed; the second is a count of the number of entries in<br />

that array.<br />

Path Drawing Sample<br />

In an accompanying codesamples folder you should find a sample file entitled line drawing using<br />

draw fixed structure.txt. This sample source file will create a document with one page,<br />

containing a square whose lower left corner is one inch above the bottom <strong>and</strong> one inch right of the left<br />

edge of the page. The square will be red, edged in black. From outer edge to outer edge, the square will be<br />

74 points wide <strong>and</strong> tall.


10.6 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Path Drawing Methods<br />

The directly-drawn shapes are useful for a great number of graphics, but they do not permit filling of<br />

complex arbitrary shapes without the construction of a path. For that reason, a second set of drawing<br />

operators was added. These operators simply construct <strong>and</strong> draw a path, which may be arbitrarily<br />

complex. It may also be disjointed.<br />

The DLPDFPATH structure will contain a path of any size, allocating additional memory as needed. Path<br />

construction is via methods which add segments to the existing path. These methods seek to include both<br />

the PDF <strong>and</strong> PostScript graphics operators. When completed, the path may be added to a content area.<br />

The path is not destroyed when imaged <strong>and</strong> may be reused any number of times. The DLPDFPATH<br />

structure also includes a provision for a CTM Matrix, which may be used to transform the position <strong>and</strong><br />

appearance of the path.<br />

Within the path, a current point is maintained. This will be undefined initially, or after a<br />

dlpdfpathaddclose, <strong>and</strong> will be the end point of the segment added at all other times. Some operators<br />

require that the current point be established prior to adding a segment of that type. Others will add a<br />

straight line segment drawn from the current position to the start of the defined segment prior to a<br />

segment. This behavior mimics the drawing mechanism in PostScript.<br />

The first parameter of all of these methods, except dlpdfpathcreate <strong>and</strong> dlpdfcontentdrawpath,<br />

is a pointer to a valid DLPDFPATH structure.<br />

dlpdfpathcreate<br />

This method will return a pointer to a new DLPDFPATH structure. The path’s contents will be empty, its<br />

current position will be undefined, <strong>and</strong> its matrix will be set to the unity matrix. This structure will persist<br />

until specifically deleted by the dlpdfpathdestroy method.<br />

The DLPDFPATH is not specific to a document or content structure. It may be shared across many<br />

documents <strong>and</strong> placed within any number of content structures.<br />

dlpdfpathclear<br />

This method will remove all content from an existing DLPDFPATH structure <strong>and</strong> restore it to the state it<br />

was in following the call to dlpdfpathcreate. It is included to lower the overhead of creating many<br />

paths.<br />

dlpdfpathdestroy<br />

This method will destroy a DLPDFPATH structure <strong>and</strong> free all resources that it used.


Displaying Line Drawings 10.7<br />

dlpdfpathaddmove<br />

This method will change the current position of a DLPDFPATH structure without drawing a line. It may be<br />

used to establish the starting point of a path or to add a disjunction to an existing path. It accepts two<br />

operators, an X <strong>and</strong> a Y position, as ASFixed values. The current position following this method will be<br />

the specified (X,Y) position.<br />

dlpdfpathaddmover<br />

This method also sets the current position, but sets it relative to the existing current position. If there is no<br />

current position, this method will raise an exception (genErrBadParm). This method accepts two<br />

parameters, an X <strong>and</strong> a Y displacement, as ASFixed values. The current position following this method<br />

will reflect the application of the X <strong>and</strong> Y displacements.<br />

dlpdfpathaddline<br />

This method draws a line from the current position to the position specified by its two parameters, X <strong>and</strong><br />

Y position as ASFixed values. If there is no current position established, this method will raise an<br />

exception (genErrBadParm). The current position following this method is the specified (X,Y) position.<br />

dlpdfpathaddliner<br />

This method also draws a line segment, drawn from the current position to a new position, specified by X<br />

<strong>and</strong> Y displacement as ASFixed values. If there is no current position established, this method will raise<br />

an exception (genErrBadParm). The current position following this method will reflect the application<br />

of the X <strong>and</strong> Y displacements.<br />

dlpdfpathaddarc<br />

This method will append an arc segment to the current path. The parameters specify an (X,Y) position, in<br />

ASFixed values, of the center of the arc, a Radius as an ASFixed value, <strong>and</strong> two angles in degrees as<br />

ASFixed angles.<br />

If there is a current position, a line segment will be added from the current position to the start angle of<br />

the arc. If there is no current position, a move to the start angle of the arc will be appended to the path.<br />

The arc will be drawn counter-clockwise from the start angle to the end angle. If the angles are coincident,<br />

a full circle will be drawn. The angles will be interpreted such that zero degrees is pointing right.<br />

After completion, the position of the end of the arc will be the current position.


10.8 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfpathaddarcn<br />

This method is identical to dlpdfpathaddarc, except that the arc will be drawn clockwise.<br />

dlpdfpathaddarcto<br />

This method will draw a straight line segment from the current position toward the X <strong>and</strong> Y coordinates<br />

specified by the first two parameters. This line will terminate at the intersection of an arc connecting this<br />

line to a second line, drawn from the first specified (X,Y) to the second (X,Y) specified by the third <strong>and</strong><br />

fourth parameters, at a Radius specified by the fifth parameter.<br />

Xint1/<br />

Yint1<br />

X1/Y1<br />

Xint2/<br />

Yint2<br />

Current Position<br />

X2/Y2<br />

NOTE: The straight segment from Xint2/Yint2 -> X2/Y2 is not drawn. The<br />

current position is set to Xint2/Yint2.<br />

If there is no current position when this method is called, an exception (genErrBadParm) will be raised.<br />

dlpdfpathaddelliparc<br />

This method will append an arc segment to the current path. The parameters specify an (X,Y) position, as<br />

ASFixed values, of the center of the arc, a Horizontal Radius <strong>and</strong> Vertical Radius as ASFixed<br />

values, <strong>and</strong> two angles in degrees as ASFixed angles.<br />

The Horizontal Radius <strong>and</strong> Vertical Radius values create arc segments from an elliptical shape,<br />

instead of the circular arc segments of dlpdfpathaddarc. If the same horizontal <strong>and</strong> vertical radii are<br />

passed to this function, it behaves identically to dlpdfpathaddarc.<br />

If there is a current position, a line segment will be added from the current position to the start angle<br />

of the arc. If there is no current position, a move to the start angle of the arc will be appended to the<br />

path. The arc will be drawn counter-clockwise from the start angle to the end angle. If the angles<br />

are coincident, a full circle will be drawn. The angles will be interpreted such that zero degrees is pointing<br />

right.<br />

After completion, the position of the end of the arc will be the current position.


Displaying Line Drawings 10.9<br />

dlpdfpathaddelliparcn<br />

This method is identical to dlpdfpathaddelliparc, except that the arc will be drawn clockwise.<br />

dlpdfpathaddelliparcto<br />

This method will draw a straight line segment from the current position toward the X <strong>and</strong> Y coordinates<br />

specified. This line will terminate at the intersection of an arc connecting this line to a second line, drawn<br />

from the first specified (X,Y) to the second (X,Y) specified, at a specified Horizontal Radius <strong>and</strong><br />

Vertical Radius.<br />

dlpdfpathaddcurve<br />

This is the first of the four methods which add a spline, or cubic Bézier curve, to the path.<br />

All Bézier curves consist of four points:<br />

Xctrl1/<br />

Yctrl1<br />

Xend/<br />

Yend<br />

Xstart/<br />

Ystart<br />

Xctrl2/<br />

Yctrl2<br />

This method (as well as the following three) uses current position as the starting point of the curve. If no<br />

starting point is specified, the method will raise an exception (genErrBadParm).<br />

The first two parameters of this method are the position of Control Point 1, the second two parameters<br />

are the position of Control Point 2, <strong>and</strong> the last two parameters are the position of the end point of the<br />

curve.<br />

Following this method, the current position will be the end point of the curve.<br />

dlpdfpathaddcurver<br />

This method is identical to dlpdfpathaddcurve, except that the positions are expressed as relative<br />

distances from the current point, not absolute distances from the origin.


10.10 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfpathaddcurvev<br />

This method is identical to dlpdfpathaddcurve, except that both the start <strong>and</strong> first control point are<br />

assumed to be the current position.<br />

Xend/<br />

Yend<br />

Xstart/<br />

Ystart<br />

Xctrl1/<br />

Yctrl1<br />

Xctrl2/<br />

Yctrl2<br />

dlpdfpathaddcurvey<br />

This method is identical to dlpdfpathaddcurve, except that the second control point is assumed to be<br />

the ending position.<br />

Xctrl1/<br />

Yctrl1<br />

Xstart/<br />

Ystart<br />

Xend/<br />

Yend<br />

Xctrl2/<br />

Yctrl2<br />

dlpdfpathaddrect<br />

This method will draw a rectangle. The first two parameters specify the (X,Y) position of a corner, <strong>and</strong> the<br />

next two specify the width <strong>and</strong> depth of the rectangle. A positive width will draw to the right, <strong>and</strong> a<br />

positive depth will draw upward.<br />

Current position need not be set before this method is called, <strong>and</strong> current position will be set to the<br />

specified (X,Y) position after it is used.


Displaying Line Drawings 10.11<br />

dlpdfpathaddclose<br />

This method will append a straight line segment from the current position to the start of the first element<br />

in the path. If a current position is not set, it will have no effect.<br />

Following this method, the current position will be unset.<br />

NOTE: This does not need to be the last segment of a path. Additional, disjoint<br />

segments may be set.<br />

dlpdfcontentdrawpath<br />

This method is used to add a drawn path to content.<br />

• Its first element is the DLPDFCONTENT onto which this path is to be drawn.<br />

• Its second parameter is the DLPDFPATH structure to be drawn.<br />

• Its third parameter is a pointer to a PDEGraphicState structure. This structure contains definitions<br />

of colors to be applied, <strong>and</strong> line sizes <strong>and</strong> parameters to be used when drawing a path.<br />

• The fourth <strong>and</strong> last parameter is the Path Painting operator. This must be one of<br />

— kPDEStroke<br />

— kPDEFill<br />

— kPDEEoFill<br />

— kPDEStroke | kPDEFill<br />

— kPDEStroke | kPDEEoFill<br />

Path Drawing Sample<br />

In an accompanying codesamples folder you should find a sample file entitled drawing a<br />

rectangle <strong>and</strong> ellipse in path operators.txt. This program sample shows the use of an<br />

arbitrarily complex path while creating a rectangle with an ellipse embedded within it.


10.12 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Transformation Matrices<br />

A Transformation Matrix can be applied to the path as a whole when it is drawn in order to resize or<br />

reposition it. This matrix will be concatenated with the matrix of the container in which the path is<br />

drawn.<br />

Matrix Arguments<br />

The matrix consists of six ASFixed values (a, b, c, d, h <strong>and</strong> v):<br />

• Values a <strong>and</strong> b control the movement in X <strong>and</strong> Y coordinates produced by a movement in X.<br />

• Values c <strong>and</strong> d control the movement in X <strong>and</strong> Y coordinates of a movement in Y.<br />

• Values h <strong>and</strong> v are horizontal <strong>and</strong> vertical offsets to the position of the drawing (positive values are up<br />

<strong>and</strong> right).<br />

dlpdfpathsetmatrix<br />

This method will set a matrix which will be applied to the path as a whole when it is drawn. This matrix<br />

will be concatenated with the matrix of the container in which the path is drawn. The method accepts a<br />

single parameter, a pointer to an ASFixedMatrix.<br />

Matrix Translations<br />

The unity matrix ([1, 0, 0, 1, 0, 0]) causes a 1 unit movement in X to be a 1 unit movement in X<br />

<strong>and</strong> a zero unit movement in Y; a 1 unit movement in Y becomes a 0 unit movement in X <strong>and</strong> a 1 unit<br />

movement in Y.<br />

More precisely:<br />

RealX = X * a + Y * c + h<br />

RealY = X * b + Y * d + v<br />

Hence:<br />

• the matrix [1 0 0 -1 0 0] will invert the figure drawn<br />

• the matrix [-1 0 0 1 0 0] will mirror-image the figure<br />

• the matrix [.707 .707 -.707 .707 0 0] will rotate it 45 degrees<br />

Image Translation<br />

Translation is the simple movement of the image, <strong>and</strong> is accomplished by modifying h <strong>and</strong>/or v. These<br />

values are interpreted in the un-transformed space. For more details, please see section 4.2.2, "Common<br />

Transformations," in the Portable Document Format <strong>Reference</strong> Manual.


Displaying Line Drawings 10.13<br />

Image Rotation<br />

A matrix may be rotated by using the method dlpdfmatrixrotate. This method accepts a pointer to a<br />

matrix, <strong>and</strong> transforms it to accomplish a rotation of the specified angle (in degrees, as an ASFixed<br />

value, counter-clockwise).<br />

Image Shearing <strong>and</strong> Scaling<br />

Shearing of an image may be accomplished by modifying b or c only. Scaling may be accomplished by<br />

modifying a <strong>and</strong>/or d only.<br />

CAUTION: Be sure to scale before rotating, if you are doing both.


10.14 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Graphic State <strong>and</strong> Line Drawing<br />

This is a brief discussion of the graphic state parameters. For a fuller explanation, please see section 4.3,<br />

"Graphics State," in the Portable Document Format <strong>Reference</strong> Manual. The fields listed are components<br />

of the PDEGraphicState structure as defined by the Adobe PDF Library SDK.<br />

fillColorSpec<br />

This is the specification of color to be used when kPDEFill or kPDEEoFill is specified as a path, or<br />

when a structure is drawn. Refer to “Library Color Descriptions” on page 12.2 for a full discussion of<br />

setting this value.<br />

NOTE: If a pattern has been set for the container in which this figure is drawn,<br />

that pattern may be used in place of, or in addition to, this color specification.<br />

strokeColorSpec<br />

This is the specification of color to be used when kPDEStroke is specified as a path, or when a structure<br />

is drawn. Refer to “Library Color Descriptions” on page 12.2 for a full discussion of setting this value.<br />

NOTE: If a pattern has been set for the container in which this figure is drawn,<br />

that pattern may be used in place of, or in addition to, this color specification.<br />

lineWidth<br />

This is an ASFixed value in scaled units. Note that a DLPDFPATH matrix, which specifies scaling, will<br />

affect this value. This value must be set specifically when the graphic state structure is created.<br />

lineJoin<br />

• A value of zero for this parameter continues the joined lines to a point.<br />

• A value of 1 rounds over the join at lineWidth Radius.<br />

• A value of 3 butts the line ends <strong>and</strong> fills the notch with stroke color, causing it to be beveled.<br />

If the value is 0, <strong>and</strong> the extension of the line to a point exceeds the miterLimit, then the line will be<br />

beveled as with a value of 3.


Displaying Line Drawings 10.15<br />

lineCap<br />

• A value of zero produces butt-ended lines, ending at the end point of the segment.<br />

• A value of 1 produces round-ended lines, with a diameter equal to lineWidth.<br />

• A value of 2 produces square-ended lines, extending 1/2 line width beyond their end point.<br />

miterLimit<br />

Miter is the shape of the intersection of two lines. This parameter limits the length of a miter as a function<br />

of the line thickness. It is specified as an ASFixed value <strong>and</strong> must be greater than 1. For more<br />

information, see "Miter Limit" in section 4.3.2 of the Adobe PDF <strong>Reference</strong> Manual v1.5.<br />

flatness<br />

Controls the amount of error permitted between a path’s ideal position <strong>and</strong> the actual position in which it<br />

is placed. This is an ASFixed value, between 0 <strong>and</strong> 100. A value of zero permits the device to use its own<br />

flatness value, <strong>and</strong> is usually the best choice.<br />

dash<br />

A means of producing dashed, dotted or otherwise broken lines in stroking a path. Note that a patterned<br />

color space should not be used in stroking a path (although it can be), because the result will be the<br />

intersection of the pattern <strong>and</strong> the path, rather than the pattern following the path.<br />

The dash parameter is a pointer to a PDEDash structure. In essence, this structure allows you to define a<br />

pattern of off/on changes to be used in stroking a line to achieve a wide variety of dashed <strong>and</strong> dotted lines.<br />

For more information, see "PDEDash" within the Declarations section of the Adobe Acrobat Core API<br />

<strong>Reference</strong> Manual, <strong>and</strong> "Line Dash Pattern" in section 4.3.2 of the Adobe PDF <strong>Reference</strong> Manual.


10.16 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong>


11<br />

Image<br />

Display<br />

Images are predefined collections of shapes <strong>and</strong> colors<br />

which are included into the document as a picture. They<br />

may be as simple as a single bitmap or as complex as a<br />

complete PDF page.<br />

11.1


11.2 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Overview<br />

Inclusion of graphics is accomplished in two ways. The first is an image, in the sense of a PDF or<br />

PostScript Image Operator. The second is a Encapsulated PostScript (EPS) file. Note that images included<br />

as EPS will not appear in PDF pages on-screen (e.g. when displayed by Adobe Reader or Adobe Acrobat),<br />

but will appear in both PostScript pages <strong>and</strong> Adobe PDF PostScript pages. Adobe Normalizer Server, also<br />

available from <strong>Datalogics</strong>, can be used to distill EPS images to PDF format in order to make EPS sources<br />

visible in PDF output.<br />

The interfaces provided in <strong>DLI</strong> for images are intentionally very low-level. They presume that any<br />

graphics conversions have already been completed. Public-domain packages for the conversion of graphics<br />

from common formats (PNG, GIF, TIFF, etc.) are readily available <strong>and</strong> can create data in the form these<br />

interfaces expect.<br />

Graphic Image Structures<br />

<strong>DLI</strong> manages graphics via the structure DLPDFIMAGE. This structure is used for both image <strong>and</strong> EPS<br />

data.<br />

There are four functions to create images depending on the format (Bitmap, EPS, PDF, <strong>and</strong> a convenience<br />

function for several other graphic formats), <strong>and</strong> one function to use an image<br />

(dlpdfcontentreferenceimage).<br />

NOTE: Encapsulated PostScript (EPS) is not a valid graphic format for PDF. The EPS<br />

function available through <strong>DLI</strong> will enable you to embed the EPS image in the PDF<br />

document, but it will not be visible until the document is printed. (Adobe<br />

Normalizer, also available from <strong>Datalogics</strong>, can be used to distill EPS images to PDF<br />

format in order to make EPS sources visible in PDF output.)<br />

Image structures are created on a per-document basis. If the same image is used in multiple documents,<br />

multiple copies of that image must be created. Images are tracked within the document <strong>and</strong> all images are


Image Display 11.3<br />

destroyed when the document is destroyed. Pointers to images become invalid on document destruction<br />

<strong>and</strong> must not be used after that time.<br />

A document may contain any number of images. Each image will be included in the document only once,<br />

but may be referenced within that document many times.<br />

The image is considered to be a part of the document, <strong>and</strong> may not be used in any document other than<br />

the one in which it was created. Images need not be directly destroyed, since they will be destroyed<br />

automatically when the document that contains them is destroyed.<br />

Images are tracked <strong>and</strong> reused via the ImageName value. The same image data with a different Image<br />

Name is considered a different image. Image data is passed into the creation routines via strings in<br />

memory. These strings may be freed after the call to create the image.<br />

<strong>Implementation</strong>s of <strong>DLI</strong> on UNIX <strong>and</strong> Windows include public-domain libraries to convert a number of<br />

common graphic forms into bitmaps usable by PDF.<br />

NOTE: The public-domain graphic-conversion libraries used on Unix <strong>and</strong> Windows<br />

are not available on OS/390 <strong>and</strong> OS/400 platforms. Consequently some image<br />

creation procedures are not available under OS/390 <strong>and</strong> OS/400.<br />

Graphic Image Forms<br />

Predefined images typically fall into one of two major varieties:<br />

• Bitmap Graphic Forms<br />

• Graphical Language Forms<br />

Bitmap Graphic Forms<br />

This is the most basic form of image. It consists of a stream of bits; indications of the number of samples<br />

per line, <strong>and</strong> the number of lines; a description of the samples (color model, sample size); <strong>and</strong> a<br />

description of ordering. It may also contain a description of resolution (samples per inch horizontal <strong>and</strong>/<br />

or vertical). The stream may be compressed, in which case the compression algorithm <strong>and</strong> parameters<br />

must also be given.<br />

These images may be expressed at various levels, from something as simple as “Here is a bitmap of n lines<br />

by n samples in 1-bit gray scale,” to more-complex references to st<strong>and</strong>ards for graphics encoding <strong>and</strong><br />

compression (e.g. JPEG/JPG, TIFF, GIF, PNG, etc.). However, the Adobe PDF Library package contains


11.4 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

no logic to transform bitmaps, so they must all be presented to the Adobe PDF Library in a common<br />

manner.<br />

This excerpt from the graphical image example shows the logic for inserting a raw bitmapped graphic into<br />

a document.<br />

"C" Example: Bitmapped Graphic via dlpdfimagecreatefrombmp<br />

/* Allocate memory to hold the image bitmap */<br />

ImageString = malloc (ImageWidth * ImageDepth);<br />

/* Open read the bitmap, <strong>and</strong> close the bitmap file */<br />

ImageFile = fopen (ImageName, "rb");<br />

fread (ImageString, 1, ImageWidth * ImageDepth, ImageFile);<br />

fclose (ImageFile);<br />

/* Get the color space DeviceGray as a COS object */<br />

GraySpace = PDEColorSpaceCreateFromName (ASAtomFromString<br />

("DeviceGray"));<br />

PDEColorSpaceGetCosObj (GraySpace, &Color);<br />

/* Create a DLPDFIMAGE object from the bitmap */<br />

Image = dlpdfimagecreatefrombmp (Doc, "Bear", ImageString,<br />

ImageDepth * ImageWidth,<br />

ImageWidth, ImageDepth,<br />

8, Color, FALSE);<br />

/* Free the image string from memory */<br />

free (ImageString);<br />

/* "Paste" the image into the container, centered over the<br />

* red box */<br />

dlpdfcontentreferenceimage (Content, Image,<br />

(fixedFour * 72) - ((Image->BBox.left + Image->BBox.right)/2),<br />

(fixedFour * 72) - ((Image->BBox.top + Image->BBox.bottom)/2),<br />

0, fixedOne, fixedOne);<br />

Graphical Language Forms<br />

These forms of graphics are described via line drawing operators, fill <strong>and</strong> stroke parameters, <strong>and</strong><br />

text. They may also include bitmapped graphics. These forms exist solely in the context of a st<strong>and</strong>ard<br />

language definition (e.g. PDF: Portable Document Format; CGM: Computer Graphics Metafile; WMF:<br />

Windows Metafile Format; QuickDraw drawing comm<strong>and</strong>s; etc.).


Image Display 11.5<br />

Image Creation Methods<br />

With the exception of PDF, for which this package is eminently suitable, all of the graphic forms must be<br />

converted into a stream of line drawing, imaging <strong>and</strong> text drawing comm<strong>and</strong>s before being used as an<br />

image.<br />

<strong>DLI</strong> supports creating graphical images from a range of sources via the following methods:<br />

dlpdfimagecreatefrombmp<br />

This method creates a DLPDFIMAGE from a bitmap <strong>and</strong> user-supplied information.<br />

• Its first parameter is the document of which the image is to be a part.<br />

• Its second parameter is a name to be used to identify this image.<br />

• Its third <strong>and</strong> fourth parameters are pointers to an array of bytes containing the bitmap <strong>and</strong> the length of<br />

that bitmap.<br />

• Its fifth parameter is the length of a line in samples.<br />

• Its sixth parameter is the number of lines.<br />

• Its seventh parameter is the size of a sample.<br />

• The eighth parameter is a COS Object which describes the color model used for the image.<br />

• The last parameter is a flag. When TRUE, this object will be embedded in the document each time it is<br />

used. When FALSE, it will be embedded only once.<br />

NOTE: <strong>DLI</strong> will merge inline all bitmapped images under 500 bytes. However, if<br />

the image is equal to one bitmap, then <strong>DLI</strong> will automatically set the image as an<br />

imagemask. Please see “Creating Transparent Graphics” on page 11.10<br />

This method assumes that the bitmap is ordered into samples within lines, that the first line presented is<br />

the top of the image, <strong>and</strong> that the first sample presented is the left edge of the image.<br />

Order of Values within Color Models<br />

The type of color model will determine whether the image contains one value per sample (/DeviceGray<br />

or /Indexed color models), three values per sample<br />

(/DeviceRGB), or four values per sample (/DeviceCMYK).<br />

Each value is assumed to have the number of bits specified in the sample size. For<br />

/DeviceRGB they are assumed to be ordered Red/Green/Blue; for /DeviceCMYK they are assumed to be<br />

ordered Cyan/Magenta/Yellow/Black.


11.6 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Image Compression <strong>and</strong> Filtering<br />

If the document specifies compression, the bitmap will be compressed with Flate compression. If the<br />

document specifies Seven-Bit Safe mode, the bitmap will be filtered via ASCII85 to force it into a seven<br />

bit safe data format.<br />

dlpdfimagecreatefromps<br />

This method will create a EPS pass-through object in the PDF document. The EPS graphic is carried in the<br />

document, but not imaged by the document reader. Extracting the document to PostScript will include the<br />

object, <strong>and</strong> it will display in PostScript. This option is not generally used, but may be needed on occasion.<br />

This method assumes that the text of the EPS object is present as a string in memory.<br />

• The first parameter is a pointer to a document in which this object is to be created.<br />

• The second is a name to be given to this graphic.<br />

• The third <strong>and</strong> fourth are pointers to a string containing the EPS text <strong>and</strong> the length of that string.<br />

• The last parameter is a flag. If it is FALSE, this object will be inserted into the document only once. If it<br />

is TRUE, it will be inserted once for each usage.<br />

This segment of the complete graphics example inserts an EPS pass-through object, which will display a<br />

graphic in the PostScript produced from PDF, but not in the PDF document itself:<br />

Inserting a EPS Image with dlpdfimagecreatefromps<br />

/* Open read the bitmap, <strong>and</strong> close the PostScript file */<br />

ImageFile = fopen ("Image.eps", "rb");<br />

fseek (ImageFile, 0, SEEK_END);<br />

ImageSize = ftell (ImageFile);<br />

fseek (ImageFile, 0, SEEK_SET);<br />

/* Allocate memory to hold the image */<br />

ImageString = malloc (ImageSize);<br />

fread (ImageString, 1, ImageSize, ImageFile);<br />

fclose (ImageFile);<br />

Image = dlpdfimagecreatefromps (Doc, "Grid", ImageString,<br />

ImageSize, FALSE);<br />

/* "Paste" the image into the container, centered over the<br />

* red box */<br />

dlpdfcontentreferenceimage (Content, Image,<br />

(fixedFour * 72) - ((Image->BBox.left + Image->BBox.right)/2),<br />

(fixedFour * 72) - ((Image->BBox.top + Image->BBox.bottom)/2),<br />

0, fixedOne, fixedOne);


Image Display 11.7<br />

dlpdfimagecreatefrompdf<br />

This method will create an image from a PDF file. The image will be of a single specified page of the image<br />

document.<br />

• The first parameter is a h<strong>and</strong>le for the document in which this image is to be placed.<br />

• The second is the name of the file containing the PDF image page.<br />

• The third <strong>and</strong> fourth are ASFixed values giving the desired width <strong>and</strong> depth of the image. If either is 0,<br />

the PDF page's crop box is used to form the DLPDFIMAGE's visible region.<br />

• The fifth <strong>and</strong> sixth are ASFixed values giving the offset within the image document at which the image<br />

should be displayed, relative to the position at which the image page is set.<br />

• The last parameter is an integer which is used as a page number (starting from 1) to access the image<br />

document <strong>and</strong> to select the image page displayed.<br />

This segment of the complete <strong>DLI</strong> Graphics example inserts a PDF image into the document:<br />

Inserting a PDF Image with dlpdfimagecreatefrompdf<br />

/* Open the file <strong>and</strong> obtain the bounding box of page 0 */<br />

{<br />

PDDoc<br />

pdDoc;<br />

PDPage<br />

pdPage;<br />

ASFixedRect<br />

BB;<br />

/* Open the document */<br />

pdDoc = PDDocOpen ("Image.pdf", NULL, NULL, TRUE);<br />

pdPage = PDDocAcquirePage (pdDoc, 0);<br />

PDPageGetBBox (pdPage, &BB);<br />

PDPageRelease (pdPage);<br />

PDDocClose (pdDoc);<br />

Image = dlpdfimagecreatefrompdf (Doc, "Image.pdf",<br />

BB.right - BB.left,<br />

BB.top - BB.bottom,BB.left,BB.bottom,1);<br />

/* "Paste" the image into the container, centered over the<br />

* red box */<br />

dlpdfcontentreferenceimage (Content, Image,<br />

(fixedFour * 72) - ((Image->BBox.left + Image->BBox.right)/2),<br />

(fixedFour * 72) - ((Image->BBox.top + Image->BBox.bottom)/2),<br />

0, fixedOne, fixedOne);<br />

}


11.8 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfimagecreatefromfile<br />

This method invokes various conversion routines to allow a user to simply specify the file name <strong>and</strong><br />

obtain a valid DLPDFIMAGE object. All conversions are done internally to <strong>DLI</strong>.<br />

NOTE: The public-domain graphic-conversion libraries used on Unix <strong>and</strong> Windows<br />

are not available on OS/390 <strong>and</strong> OS/400 platforms. Consequently some image<br />

creation procedures are not available under OS/390 <strong>and</strong> OS/400.<br />

This method accepts only 2 parameters:<br />

• a h<strong>and</strong>le to a document in which the image is to be placed<br />

• a file name which should contain the image<br />

Currently, this method will support JPEG/JPG, GIF, TIFF, PNG <strong>and</strong> PDF files on the NT <strong>and</strong> UNIX<br />

platforms, <strong>and</strong> PDF only on OS/390.<br />

From the complete <strong>DLI</strong> sample of inserting graphic images, this segment inserts a PDF image via<br />

dlpdfimagecreatefromfile:<br />

"C" Example: Inserting a PDF image with dlpdfimagecreatefromfile<br />

Image = dlpdfimagecreatefromfile (Doc, "math.pdf");<br />

/* "Paste" the image into the container, centered over the<br />

* red box */<br />

dlpdfcontentreferenceimage (Content, Image,<br />

(fixedFour * 72) - ((Image->BBox.left + Image->BBox.right)/2),<br />

(fixedFour * 72) - ((Image->BBox.top + Image->BBox.bottom)/2),<br />

0, fixedOne, fixedOne);<br />

The DLPDFIMAGE objects contains an ASFixedRect object called BBox (Bounding Box), which is set to<br />

the actual size <strong>and</strong> displacement of the image, as defined by its originator. This may be used in decisions<br />

about positioning <strong>and</strong> scaling the image.<br />

dlpdfimageplaceascontent<br />

Some applications have difficulty parsing PDF Form XObjects within pages as well as marked content<br />

blocks. Additionally, some applications are known to misinterpret marked content blocks between<br />

different versions of the application. The default action of <strong>DLI</strong> is to create a Form XObject for each


Image Display 11.9<br />

imported PDF graphic, so that it may be referenced repeatedly without inflating the size of the resulting<br />

output file.<br />

This call will flag an imported PDF graphic file to have any marked content tags removed, <strong>and</strong> to be set<br />

into the current page's content stream instead of as a form reference.<br />

NOTE: This call may increase the size of PDF files where a graphical object is<br />

referenced repeatedly, as the PDF graphic is appended to the content stream at the<br />

point of insertion.<br />

LoadGraphicList<br />

This method is available on OS/390 only. It reads a cross-reference file which maps graphics keys to their<br />

physical location. The cross-reference table is accessed by the GetGraphicFromList method <strong>and</strong>, once<br />

read, is stored in memory for the duration of the job. The cross-reference file must be created without line<br />

numbers. The OS/390 distribution includes a sample cross-reference in<br />

ADOBE.PDFLIB.RESOURCE.GRPHLIST(GRPIDX):<br />

Pic1 ADOBE.PDFLIB.RESOURCE.IMAGE.PDF<br />

Pic2 ADOBE.PDFLIB.RESOURCE.DLLOGO.PDF<br />

The parameter containing the graphic list file name is the DDName of the cross-reference file, as in:<br />

LoadGraphicList(“graphics”);<br />

with the associated JCL line:<br />

//GRAPHICS DD DSN=ADOBE.PDFLIB.RESOURCE.GRPHLIST(GRPIDX),DISP=SHR<br />

GetGraphicFromList<br />

This method is available on OS/390 only. It accepts a DLPDFDOC pointer <strong>and</strong> graphic key string, <strong>and</strong><br />

returns the appropriate DLPDFIMAGE pointer. Multiple usage of the same graphic key within a document<br />

is tracked by <strong>DLI</strong>, resulting in only one instance of the graphic being placed in the document.<br />

NOTE: The graphic key must be passed as an ASCII string.


11.10 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Creating Transparent Graphics<br />

A PDF file may contain imagemasks. These are images which are used to mask, or block, the painting of<br />

areas beneath the mask, in the manner of a stencil. Imagemasks are one-bit graphics, where a value of 0<br />

means that the pixel beneath the image is not to show through, <strong>and</strong> a value of 1 means that the pixel<br />

beneath is visible.<br />

<strong>DLI</strong> will automatically set any bitmap image created with the dlpdfimagecreatefrombmp function,<br />

having one bit per pixel <strong>and</strong> no color space (a CosNull object for the ColorSpace parameter), to be an<br />

imagemask. The mask will paint marked regions with the current fill color, <strong>and</strong> will leave unmarked<br />

regions untouched; page marks below these regions will be visible <strong>and</strong> not painted over.<br />

To change an image into a mask, simply insert the Imagemask key, with the value of TRUE as a Boolean,<br />

into the image’s dictionary. Then, remove the ColorSpace key from the image's dictionary. (This can be<br />

accomplished through the cosImage member of the DLPDFIMAGE structure.) If the imagemask is to be<br />

placed over an image, it need not be the same size or resolution as any of the images it masks; in fact, the<br />

use of an imagemask of significantly higher resolution than the image to be masked is a useful way to<br />

simulate gradations of transparency.<br />

Transparent Graphics via Imagemasks Sample<br />

In an accompanying /codesamples folder you should find a sample file entitled creating<br />

transparent graphics using imagemasks.txt. This demonstrates how to create a mask from a<br />

suitable graphic which is approximately 11 times as wide <strong>and</strong> high as the image to be masked.<br />

NOTE: The files in the /Codesamples folder are not intended to be buildable<br />

source as-is, only to be demonstrations of correct comm<strong>and</strong> syntax for different<br />

purposes.<br />

dlpdfcontentgstate<br />

This method enables a user to set a graphics state in a PDF file, for graphics operations which normally<br />

have no such state associated with them.<br />

For example, when creating an imagemask to create a green mask, an appropriate color <strong>and</strong> colorspace<br />

must be specified. Thus dlpdfcontentgstate is called to set the graphics state of the specified<br />

DLPDFCONTENT to that of the PDEGraphicState. This may be done at any point during content<br />

placement operations.


12<br />

Color<br />

<strong>and</strong> its Use<br />

This chapter discusses Adobe PDF Library color<br />

descriptions, colors in images, patterned color spaces,<br />

creating <strong>and</strong> destroying color spaces, <strong>and</strong> more.<br />

12.1


12.2 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Library Color Descriptions<br />

Color can be added to pages produced via <strong>DLI</strong> only with the color fields of the PDEGraphicState. There<br />

are two fields which establish color:<br />

• strokeColorSpec<br />

• fillColorSpec<br />

strokeColorSpec defines the color that applied to lines which are stroked <strong>and</strong> fillColorSpec<br />

defines the color applied to areas which are filled.<br />

NOTE: Type is generally filled rather than stroked.<br />

Color Description Components<br />

The color description consists of two components:<br />

• The first is a pointer to a PDEColorSpace structure, which describes a color space. This identifies the<br />

type of color: Black <strong>and</strong> White, RGB, CMYK, etc.<br />

• The second component is an array of from one to seven ASFixed values, which describe the amount of<br />

color in each of the components of the given color model. These components are frequently called color<br />

channels. For example, the color Black can be described variously as (RGB, 0.0, 0.0, 0.0),<br />

(grayScale, 0.0) or (CMYK 0.0, 0.0, 0.0, 1.0); all are different ways of saying “Black.”<br />

Patterned Colors<br />

Patterned colors, which may be used in addition to (or instead of) a solid color, are carried in a separate<br />

field within the DLPDFCONTENT structure, <strong>and</strong> are set with a specific set of calls to DLPDFCONTENT.<br />

Colors in Images<br />

Color spaces may also be used separately with images if those images are bitmaps. A color model must be<br />

specified as a CosStructure when using dlpdfimagecreatefrombmp. The CosObj form of a color<br />

is obtained from the PDE form by the call PDEColorSpaceGetCosObj. Creating the PDE form is<br />

explained below.<br />

When images are created with any of the other dlpdfimagecreate-type calls, color spaces will be<br />

constructed as needed.


Color <strong>and</strong> its Use 12.3<br />

Creating <strong>and</strong> Destroying Color Spaces<br />

For the basic colors, the color spaces used in your document will be in the form of a PDEColorSpace.<br />

This is not a document object, <strong>and</strong> therefore can be shared between documents. A COS form of that space<br />

will be created <strong>and</strong> inserted into each document where that color space is used. These color models can be<br />

created when the Adobe PDF Library is initialized, <strong>and</strong> should be destroyed before it is closed.<br />

CAUTION: If color models are not freed, a close error will result.<br />

Color spaces for the basic colors (DeviceRGB, DeviceCMYK <strong>and</strong> DeviceGray) are created by a call to<br />

the Adobe PDF Library in this form:<br />

"C " Example: Creating a Gray Color Space<br />

PDEColorSpace GrayModel:<br />

AsAtom GrayAtom;<br />

GrayAtom = ASAtomFromName (“DeviceGray”);<br />

GrayModel = PDEColorSpaceCreateFromName (GrayAtom);<br />

"BAL" Example: Creating A Gray Color Space<br />

In Assembler for OS/390:<br />

GrCol @DLPDFS<br />

DSECT=NO, *<br />

STRUCT=__T_PDECOLORVALUE<br />

GrName ds A“GrayScale”<br />

GrAtom dc h’0’<br />

@DLPDFC<br />

DLFUNC=AsAtomFromEBCDICName,<br />

DLPARAM=(GrName),<br />

DLRETURN=GrAtom<br />

DLPDFC<br />

DLFUNC=pdecolorspacecreatefromname,<br />

dlparam1=(GrAtom),<br />

DLRETURN=GrCol


12.4 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Color Space Creation<br />

For Adobe PDF Library v4.0 <strong>and</strong> higher, all of the color spaces may be created by the procedure<br />

PDEColorSpaceCreate.<br />

NOTE: A COS object is a document object, <strong>and</strong> cannot be shared between<br />

documents. However, the PDEColorSpace created from a document-specific<br />

COS Object is not a document object, <strong>and</strong> may be shared.<br />

For example, to create a Calibrated Gray Scale color space, you would need the following code fragment:<br />

Creating Calgray Color Space for Adobe PDF Library v4.0 <strong>and</strong> later<br />

PDEColorSpace CIEGrey;<br />

PDEGrayCalFlt CIEGreyDesc;<br />

CIEGreyDesc.gamma = 0;<br />

CIEGreyDesc.whitePoint.x = 0.9506;<br />

CIEGreyDesc.whitePoint.y = 1.0;<br />

CIEGreyDesc.whitePoint.z = 1.0890;<br />

CIEGreyDEsc.blackPoint.x = 0.0;<br />

CIEGreyDEsc.blackPoint.y = 0.0;<br />

CIEGreyDesc.blakcPoint.z = 0.0;<br />

CIEGrey = CreateColorSpace (AsAtomFromName (“CalGray”),<br />

(PDEColorSpaceStruct *)&CIEGreyDesc);


Color <strong>and</strong> its Use 12.5<br />

Values for Color Channels<br />

The values specified for the color channels vary from space to space, but the most common values range<br />

between zero <strong>and</strong> 1. Since these values are specified to the Adobe PDF Library as ASFixed values, this<br />

allows 16 bits of precision.<br />

Value Conversion <strong>and</strong> Inversion<br />

Your own system may specify color internally with a greater or lesser precision, or in inverted values.<br />

These must be converted to the Adobe PDF Library’s view of color to function correctly.<br />

Generally, you should first correct the precision, matching it to the Adobe PDF Library’s 16 bit precision,<br />

then correct the inversion (if there is one) by subtracting the number from an ASFixed one.<br />

When the precision difference is a matter of powers of two (as it often is), precision is corrected by<br />

shifting the value to match the Adobe PDF Library’s ASFixed format; e.g. if you are carrying color as a<br />

value of 0-255, shifting left 8 bits will correct precision.<br />

When the color specification is not in binary, e.g. zero to 100 or zero to 1000, try converting via floating<br />

point numbers. You may also create a subroutine to convert color values in precision <strong>and</strong> direction from<br />

the source system to the Adobe PDF Library’s system.<br />

Basic Color Spaces<br />

The Device color spaces below presume to render color as an absolute value. These are the basic color<br />

spaces, <strong>and</strong> are fully supported throughout PDF <strong>and</strong> PostScript.<br />

CIE Calibrated Color Spaces<br />

Calibrated color spaces are colors with perception qualifiers. These are defined by CIE <strong>and</strong> are intended to<br />

permit a more faithful rendition of color, given a knowledge of the display device characteristics.<br />

A full discussion of the CIE models is beyond the scope of this document, but you can find a great deal of<br />

information on them in the Adobe PDF Specifications document or the PostScript Language <strong>Reference</strong>.


12.6 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Device Gray<br />

This space allows you to use black <strong>and</strong> white or levels of gray. It has a single channel of color data, which<br />

is viewed by the imaging engine as a value between 1 (White) <strong>and</strong> zero (Black).<br />

Since the value is specified to the system as an ASFixed value, 16 bits of precision are possible. Generally,<br />

this will be rounded down to 4 decimal positions of precision when written to the PDF file.<br />

The atom used to create this color model is DeviceGray. It is assumed to be present in all levels of PDF,<br />

<strong>and</strong> does not need to be added to the resource directory as a color space name.<br />

Device RGB<br />

This space allows you to use full color by encoding the color as three channels, one for each of the<br />

Radiant primary colors Red, Green <strong>and</strong> Blue. Each channel has a value between zero (none of this color)<br />

<strong>and</strong> 1 (highest level of this color).<br />

The color channels are always<br />

• color[0] = RED<br />

• color[1] = GREEN<br />

• color[2] = BLUE<br />

If your internal model uses a different sequence, you must reorder the colors when setting color values.<br />

The atom used to create an RGB color space is DeviceRGB.<br />

Device CMYK<br />

This space allows you to use full color by encoding the color as 4 channels, one for each of the absorbent<br />

colors Cyan, Magenta <strong>and</strong> Yellow, <strong>and</strong> a fourth channel for Black. Each channel has a value between zero<br />

(No Absorption) <strong>and</strong> 1 (Full Absorption).<br />

The channels are arranged as<br />

• color[0] = CYAN<br />

• color[1] = MAGENTA<br />

• color[2] = YELLOW<br />

• color[3] = BLACK<br />

The atom used to create a CMYK color space is DeviceCMYK.


Color <strong>and</strong> its Use 12.7<br />

Calibrated Gray<br />

This is a calibrated color space, intended to make use of the knowledge of the display device’s<br />

characteristics to more accurately depict levels of gray. The values for this color space are identical to<br />

those of device gray (i.e. zero to 1, where zero is darkest <strong>and</strong> 1 is lightest), but for Calibrated Gray, you<br />

must also add to the color space definition the conditions under which the original colors were viewed.<br />

This color space may not be created from PDEColorSpaceCreateFromName. When created via<br />

PDEColorSpaceCreate, its atom is CalGray <strong>and</strong> the color structure must be a PDEGrayCalFlt.<br />

Calibrated RGB<br />

This is a calibrated color space, intended to make use of the knowledge of the display device’s<br />

characteristics to more accurately depict colors. The values are identical to the DeviceRGB color channels<br />

in value <strong>and</strong> sequence.<br />

This color space may not be created with PDEColorSpaceCreateFromName. When created with<br />

PDEColorSpaceCreate, its atom is CalRGB, <strong>and</strong> the color structure must be a PDERGBCalFlt.<br />

CIE Lab<br />

This is a calibrated color space intended to display color. It uses three channels (L, A, <strong>and</strong> B) in that order:<br />

• The range of the L channel is always zero to 100.<br />

• The range of the A <strong>and</strong> B channels are specified within the color space model, but must always be in the<br />

range of -128 to +127.<br />

This color space cannot be created with PDEColorSpaceCreateFromName. When created with<br />

PDEColorSpaceCreate, the atom used to specify this color space is Lab, <strong>and</strong> the color structure must<br />

be a PDELabCalFlt.


12.8 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

ICC Based<br />

This is a color model promoted by the International Color Consortium (ICC). Its purpose is to encode<br />

color intent, so that this intent may be correctly realized in any medium.<br />

This color model includes a Color Profile, which specifies the number of channels in use, <strong>and</strong> the range<br />

<strong>and</strong> limits of those values. In essence, this is a calibrated color space schema, which permits grayScale,<br />

RGB, CMYK <strong>and</strong> Lab specifications within itself.<br />

This color model may not be created by PDEColorSpaceCreateFromName. When it is created by<br />

PDEColorSpaceCreate, its atom is ICCBased, <strong>and</strong> the color structure must be<br />

PDEICCBasedColorData.<br />

Advanced Color Spaces<br />

The preceding color spaces all represent colors as a spectrum, from lighter to darker. The following color<br />

spaces do not do so: instead, each color is viewed as an individual.<br />

Separation<br />

This color space names a color, where the color value is a number between zero (none of this tint applied)<br />

to 1 (full tint applied).<br />

If the name specified in this space is known to the display device, then that tint will be used. If it is not<br />

known, a fallback color model will be used, <strong>and</strong> a transformation function from the tint amount to that<br />

fallback model’s color channel is provided in the model.<br />

This color space may not be created from PDEColorSpaceCreateFromName. When created by<br />

PDEColorSpaceCreate, its atom is Separation <strong>and</strong> the color structure used must be a<br />

PDESeparationColorData.


Color <strong>and</strong> its Use 12.9<br />

DeviceN<br />

This color space is a generalization of the separation model. In it, an array of names is specified, rather<br />

than a single name. The number of color channels used by a DeviceN color is the number of names<br />

specified in the DeviceN name array. The value of each channel is from zero to 1.<br />

NOTE: The structure PDColorValue, used to set values for colors, permits only<br />

4 channels.<br />

This color space may not be created by PDEColorSpaceCreateFromName. When created by<br />

PDEColorSpaceCreate, its atom name is DeviceN, <strong>and</strong> it must use a color structure of<br />

PDEDeviceNColorData.<br />

Indexed<br />

Indexed color spaces are most often used in images, but are by no means limited to images.<br />

An indexed color space first selects a device color space in which it will be rendered. This must be<br />

DeviceRGB, DeviceGray, DeviceCMYK, DeviceN or ICCBased.<br />

It then supplies an array of from 1 to n entries, each entry having the value of a color in the selected<br />

model. (For DeviceGray, there would be one entry per color; for DeviceRGB, three; <strong>and</strong> so on).<br />

Color is specified as a single channel, which must be an integer between zero <strong>and</strong> n-1. This value is used<br />

as an index to the array of colors, <strong>and</strong> the selected entry is imaged in the underlying color space.<br />

This color space cannot be created with PDEColorSpaceCreateFromName. When created with<br />

PDEColorSpaceCreate, its atom is Indexed <strong>and</strong> the color structure must be a<br />

PDEIndexedColorData.<br />

Patterned<br />

A patterned color space is not really a color space at all. Rather, it is an image which will fill or stroke an<br />

area or line. It may contain colors of its own, or it may be a black-<strong>and</strong>-white image which is colored per<br />

the underlying color space.<br />

Any valid PDF marking comm<strong>and</strong>s may be used to construct the pattern image. The image itself is<br />

constructed as a rectangular space, which is overlaid on the area being filled or stroked. Specification of


12.10 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

how far apart each tile is to be placed (horizontally <strong>and</strong> vertically) permits the appearance of nonrectangular<br />

areas.<br />

<strong>DLI</strong> contains an interface (dlpdfpatterncreate) which will accept a container <strong>and</strong> convert it into a<br />

patterned color space. This space may then be used within a container via the interface’s<br />

dlpdfcontentusefillpattern or dlpdfcontentusestrokepattern methods.<br />

Building Patterned Color Spaces<br />

<strong>DLI</strong> permits patterned color spaces to be easily defined <strong>and</strong> used.<br />

A patterned color space is created by marking a container, exactly as if writing text, then converting that<br />

container into a patterned color space. It is used by instructing the container in which marks are made to<br />

use a particular patterned color space for filling or stroking.<br />

For example, to make a patterned color space like this:<br />

1 Define one tile of the angled line, by creating a content area <strong>and</strong> drawing that line in that area.<br />

2 Create a pattern of that tile with dlpdfpatterncreate.<br />

3 Set the current container fill pattern to that pattern via dlpdfcontentusefillpattern.<br />

For example, the following code fragment can be used to build patterned color spaces:


Color <strong>and</strong> its Use 12.11<br />

"C" Example: Filling An Area With A Pattern<br />

DLPDFPATTERN<br />

*Pattern;<br />

DLPDFCONTENT<br />

*PatContent, *PageCont;<br />

PDGraphicState State;<br />

ASFixedMatrix Matrix;<br />

ASFixedRect BBox;<br />

/* Initialize the graphics state */<br />

State.strokeColorSpec.space = State.fillColorSpec.space =<br />

PDEColorSpaceCreateFromName(ASAtomFromString("DeviceGray"));<br />

State.strokeColorSpec.value.color[0] =<br />

State.strokeColorSpec.value.color[0] = 0;<br />

State->GState.miterLimit = fixedTen;<br />

State->GState.flatness = fixedOne;<br />

State->GState.lineWidth = fixedTwo;<br />

/* Draw the pattern “tile” */<br />

PatContent = dlpdfcontentcreate (Doc);<br />

dlpdfcontentline (PatContent, &State, kPDEStroke,<br />

0, 0, fixedTen + fixedTwo, fixedTen + fixedTwo);<br />

BBox.left = BBox.bottom = 0;<br />

BBox.right = BBox.top = fixedTen + fixedTwo;<br />

Matrix.a = Matrix.d = fixedTwo / 3;<br />

Matrix.b = Matrix.c = Matrix.h = Matrix.v = 0;<br />

Pattern = dlpdfpatterncreate (Doc, PatContent, &BBox, &Matrix,<br />

FALSE, 1, BBox.right - fixedTwo, BBox.top - fixedTwo);<br />

/* Set this pattern as the fill pattern */<br />

dlpdfcontentusefillpattern (PageCont, Pattern);<br />

/* Draw <strong>and</strong> fill the structure */<br />

...<br />

/* Cancel the fill pattern */<br />

dlpdfcontentusefillpattern (PageCont, NULL);<br />

NOTE: A fill pattern is never destroyed. It becomes a part of the document, <strong>and</strong><br />

the space used to define the pattern will be freed automatically when the<br />

document is freed.<br />

Repeating Pattern <strong>Reference</strong>s<br />

Most often, you will want to create a repertoire of fill patterns that matches the capabilities of your<br />

existing composition engine or of the display devices you have been using prior to PDF. If you do this, <strong>and</strong><br />

save the pointers to the patterns in a findable manner, then the patterns can be used repeatedly throughout<br />

a document. Note that they are specific to a document, however, so you may not share them between<br />

documents.


12.12 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Conversion between Models<br />

On some occasions, it is useful to be able to convert color values between color spaces. This does not<br />

occur often, as most composition engines permit only a single definition of color, but you may<br />

occasionally, for example, need to collapse colors to fewer models, such as when using grayscale in place<br />

of RGB when the color selected is a gray.<br />

The folowing examples assume a gray image encoded as RGB or CMYK.<br />

Collapsing RGB to Gray<br />

If all three channels of the RGB color are the same value, then the color specified is a gray. It may be<br />

simulated in gray by using that value as the gray color value.<br />

"C" Example: Collapsing RGB to Gray<br />

if (State->fillColorSpec.space) == GlobalRGBSpace)<br />

{<br />

if ((State->fillColorSpec.value.color[1] ==<br />

State->fillColorSpec.value.color[2]) &&<br />

(State->fillColorSpec.value.color[2] ==<br />

State->fillColorSpec.value.color[3]))<br />

{<br />

State->fillColorSpec.Space = GlobalGraySpace;<br />

}<br />

}<br />

Collapsing CMYK To Gray<br />

If the first three channels of the CMYK color are the same, then the color is gray. The amount is 1 minus<br />

the sum of one of the first three channels, plus the fourth channel. If this is less than zero, then the amount<br />

is zero.


Color <strong>and</strong> its Use 12.13<br />

"C" Example: Collapsing CMYK to Gray<br />

if (State->fillColorSpec.space) == GlobalCMYKSpace)<br />

{<br />

if ((State->fillColorSpec.value.color[1] ==<br />

State->fillColorSpec.value.color[2]) &&<br />

(State->fillColorSpec.value.color[2] ==<br />

State->fillColorSpec.value.color[3]))<br />

{<br />

State->fillColorSpec.Space = GlobalGraySpace;<br />

State->fillColorSpec.value.color[0] =<br />

(fixedOne - (State->fillColorSpec.value.color[0] +<br />

State->fillColorSpec.value.color[3]));<br />

if (State->fillColorSpec.value[0] < 0)<br />

State->fillColorSpec.Value[0] = 0;<br />

}<br />

}<br />

Converting RGB to CMYK<br />

RGB <strong>and</strong> CMY are complements, so we can turn one to the other by subtracting the value from 1.<br />

However, the “K” component of CMYK (Black) is present to enhance the distribution of ink on a printer,<br />

<strong>and</strong> should be maintained correctly across such conversions.<br />

In converting RGB to CMYK, we complement each of the channels, then identify the smallest of the three<br />

values, subtract it from each channel, <strong>and</strong> use it as the value for channel 4.<br />

"C" Example: Converting RGB to CMYK<br />

if (State->fillColorSpec.space) == GlobalRGBSpace)<br />

{<br />

State->fillColorSpec.space = GlobalCMYKSpace;<br />

State->fillColorSpec.value.color[3] = fixedOne;<br />

for (i = 0; i < 3; i++)<br />

{<br />

State=>fillColorSpec.value.color[i] =<br />

fixedOne - State->fillColorSpec.value.color[i];<br />

if (State->fillColorSpec.value.color[i] <<br />

State->fillColorSpec.value.color[3])<br />

{<br />

State->fillColorSpec.value.color[3] =<br />

State->fillColorSpec.value.color[i];<br />

}<br />

}<br />

for (i = 0; i < 3; i++)<br />

State->fillColorSpec.value.color[i] -=<br />

State->fillColorSpec.value.color[3];<br />

}<br />

Converting CMYK to RGB<br />

Very similar to conversion of RGB to CMYK, of course.


12.14 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

"C" Example: Converting CMYK to RGB<br />

if (State->fillColorSpec.space) == GlobalCMYKSpace)<br />

{<br />

State->fillColorSpec.space = GlobalRGBSpace;<br />

for (i = 0; i < 3; i++)<br />

State->fillColorSpec.value.color[i] +=<br />

State->fillColorSpec.value.color[3];<br />

for (i = 0; i < 3; i++)<br />

{<br />

State=>fillColorSpec.value.color[i] =<br />

fixedOne - State->fillColorSpec.value.color[i];<br />

if (State->fillColorSpec.value.color[i] < 0)<br />

State->fillColorSpec.value.color[i] = 0;<br />

}<br />

}


13<br />

Annotations<br />

<strong>and</strong> Links<br />

Annotations are structures within the PDF document, as<br />

children or subordinate structures to a page, which<br />

permit special actions to be initiated by the user. <strong>DLI</strong><br />

supports the creation of text annotations <strong>and</strong> link<br />

annotations within the document.<br />

13.1


13.2 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Overview<br />

Pages may contain text annotations, which are notes appended to the document, <strong>and</strong> link annotations,<br />

which indicate that an area of the page (always a rectangular area) connects to another area of this or<br />

another document. Links to external documents must be supported externally to this package.<br />

The methods used for creation of annotations return the CosObj which is the annotation. This object<br />

need not be picked up by the application, <strong>and</strong> does not need to be deallocated by the application.<br />

Modifying for Other Actions<br />

The objects may be modified, either immediately after creation or at any time prior to writing the<br />

document, to permit access to functionalities beyond those described in these method interfaces. There are<br />

fourteen or more different annotation types, <strong>and</strong> not all are represented by <strong>DLI</strong> methods, so in some<br />

circumstances you will need to create an object as one type, but then modify it to be another.<br />

Therefore, if you plan to change the annotations to perform other actions, you must make your changes<br />

before the document is released from the resources. See following sections of this chapter for further<br />

details.<br />

Annotation Components<br />

All annotations consist of two parts: a hot spot, which is defined as a rectangular area of the page, <strong>and</strong> an<br />

action.<br />

Hot Spots<br />

The hot spot can be defined as an ASFixedRectangle, or as a reference to a name contained in a<br />

special Name Tree within the document.<br />

Actions<br />

Actions can be specified in a number of ways, depending on the complexity of the action.<br />

<strong>DLI</strong> directly supports the most basic forms of annotations, <strong>and</strong> returns the created CosObj for all<br />

annotations, so that your application can easily construct more complex forms by modifying the basic<br />

forms provided here.


Annotations <strong>and</strong> Links 13.3<br />

Borders<br />

Borders may be placed around an annotation hot spot to highlight it to the user. Prior to version v4.0, the<br />

Adobe PDF Library allowed a definition of a border as an array of three ASFixed values:<br />

• Horizontal Corner Radius<br />

• Overcall Corner Radius<br />

• Border Width<br />

When Border Width is zero, the border is not drawn.<br />

<strong>DLI</strong> directly supports this definition only. In the following methods, a reference to borders is presumably<br />

to a NULL pointer, in which case the border is omitted, or a pointer to an array of three ASFixed values,<br />

interpreted as above.<br />

Annotation <strong>and</strong> Link Colors<br />

Color has a different meaning for each type of annotation:<br />

• For text annotations, it is the color to be used for the background of the closed annotation.<br />

• For links, it is the border color.<br />

Prior to v4.0 of the Adobe PDF Library, colors could be specified only as an array of three ASFixed<br />

values, representing an RGB color. When used below, color means a pointer to such an array, or NULL. If<br />

NULL, then the viewer will select a color.


13.4 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfpageaddtextannotation<br />

The simplest annotation in PDF is a text annotation. This appears as a “sticky note” in Adobe Acrobat or<br />

Adobe Reader <strong>and</strong> can be opened to display a text message.<br />

• The first parameter is a pointer to the page which will contain this annotation.<br />

• The second parameter is a pointer to an ASFixedRectangle whose upper left corner will be the<br />

upper left corner of the closed annotation.<br />

• The third is a pointer to a border specification.<br />

• The fourth is a pointer to a color specification.<br />

• The fifth is a pointer to a string, which will be used as a title of the opened annotation. This may be a<br />

NULL pointer.<br />

• The sixth parameter is a pointer to a string which is the content of this annotation. If this is a NULL<br />

pointer, the method will raise an exception (genErrBadParm).<br />

• Finally, the seventh parameter is a flag. If TRUE, then this annotation will be open when first displayed.<br />

If FALSE, it will be closed.<br />

From the full example of creating annotations:<br />

"C" Example: Creating Text Annotations<br />

DLPDFDOC *Doc;<br />

DLPDFPAGE *Page1, *Page2;<br />

ASFixedRect NoteRect;<br />

ASFixed Border[3], Color[3];<br />

dlpdfpageaddtextannotation (Page1, &NoteRect, Border,<br />

Color, "Page 1 Note",<br />

"This is a closed note placed on page one", FALSE);<br />

dlpdfpageaddtextannotation (Page2, &NoteRect, Border,<br />

Color, "Page 2 Note",<br />

"This is an open note placed on page Two", TRUE);


Annotations <strong>and</strong> Links 13.5<br />

dlpdfpageaddlinkannotation<br />

This is the most frequently used annotation. It links an area of the page which contains this annotation to<br />

a separate area on that or another page. The viewer uses these links, when selected, to modify the view of<br />

the document to display the destination area.<br />

This method assumes that the destination will be specified as a page number, an ASFixedRectangle<br />

describing a portion of that destination page, <strong>and</strong> a FitDescription, saying how the portion of the<br />

page should be displayed.<br />

• The first 4 parameters of this method are identical to the text annotation above, except that the<br />

ASFixedRectangle is used for both location <strong>and</strong> size, <strong>and</strong> defines the hot spot where the user might<br />

select this link.<br />

• The fifth parameter is the page number of the destination page. The first page is considered to be page<br />

0. The page referenced need not have been created yet.<br />

• The sixth parameter is the FitType. This is a text string which is one of the set of “XYZ”, “Fit”,<br />

“FitH’, “FitV”, “FitR”, “FitB”, “FitBH”, or “FitBV”. The meanings of these various types can<br />

be seen in the Adobe PDF Library <strong>Reference</strong> <strong>Guide</strong>, or the PDF Specification, section 7.3.1.<br />

• The seventh parameter defines a rectangle which will be fitted according to the sixth parameter. In<br />

general, this should describe the extent of the text that you want the user to see when selecting this link.<br />

The values actually used will vary with the FitType specified.<br />

• The eighth parameter is a zoom amount, used only with fit type “XYZ”. It is an ASFixed value, where<br />

1.0 is no zoom, 2.0 is double size, <strong>and</strong> 0.5 is 1/2 size. If you want the view to remain unchanged, set<br />

this value to PDViewDestNull.<br />

From the full example of creating annotations:<br />

"C" Example: Creating A Link Annotation<br />

DLPDFPAGE *Page1<br />

ASFixedRect BBLink1, PageRect;<br />

ASFixed Border[3], Color[3];<br />

/* Set up the border <strong>and</strong> color arrays */<br />

Border[0] = Border[1] = 0; /* This is a square box */<br />

Border[2] = fixedTwo; /* Two points in thickness */<br />

Color[0] = Color[2] = 0; /* Its color will be blue */<br />

Color[1] = fixedOne;<br />

dlpdfpageaddlinkannotation (Page1, &BBLink1, Border,<br />

Color, 1, "Fit", &PageRect, PDViewDestNULL);


13.6 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfpageaddlinkannotationfromname<br />

An optional structure within the PDF document is a name tree. This consists of an ordered collection of<br />

strings (names) <strong>and</strong> a value for each name, which is an array in the form defined in the PDF Specification,<br />

section 7.3.1. The named destination itself is described in sections 7.3.2 <strong>and</strong> 6.9.<br />

In the Adobe PDF Library, only the DEST name tree may be defined, <strong>and</strong> within <strong>DLI</strong>, there is direct<br />

support only for the name tree. Names may be added to the name tree via dlpdfdocnameadd.<br />

Names vs. Destinations<br />

A link may be accomplished using a name, rather than a specific destination. When cross-document links<br />

are to be used, referring to a name permits a more flexible linkage: if the document referred to is modified,<br />

you need not recompose the referring documents.<br />

In practice, this means that you would need to create a name tree which names all of the possible<br />

interesting sites for a link, <strong>and</strong> publish the names of those sites to potential linking documents. These<br />

names should be derived directly from the text, to identify them by their relevance to the context, rather<br />

than their position within the document.<br />

For example, you might create a name of "Maintaining Backup Files," rather than "Chapter 2," using the<br />

text of the title rather than its sequential position, so you can preserve the link even if the document<br />

chapters are later reorganized.<br />

This method is intended to permit linkages by names within a document. Making a link between<br />

documents is fairly straightforward:<br />

• The first 4 parameters are the same as the previous two methods.<br />

• The fifth parameter is a string giving the name of the destination.<br />

From the full example of adding annotations:<br />

"C" Example: Creating A Link To A Named Destination<br />

DLPDFPAGE *Page2<br />

ASFixedRect BBLink2;<br />

ASFixed Border[3], Color[3];<br />

Border[0] = fixedFive; /* A box with elliptical corners */<br />

Border[1] = fixedTen; /* longer horizontal than vert. */<br />

Border[2] = fixedTwo; /* Two points in thickness */<br />

Color[0] = Color[2] = 0; /* Its color will be black */<br />

Color[1] = 0;<br />

dlpdfpageaddlinkannotationfromname (Page2, &BBLink2,<br />

Border, Color, "Link1");


Annotations <strong>and</strong> Links 13.7<br />

dlpdfpageaddwebannotation<br />

This procedure supports adding a link structure which is identical in appearance to a link annotation, but<br />

which references a URI (Uniform Resource Indicator, equivalent to a URL) passed as the last character<br />

string. This method is used to place hyperlinks to external documents, on the World Wide Web for<br />

example, within a PDF document.<br />

NOTE: You should have your internet browser running before calling this<br />

procedure or you may receive a “browser is busy” error. Your browser can be<br />

specified in Acrobat via File->Preferences->Weblink.<br />

dlpdfdocnameadd<br />

This method allows the user to add one destination to the name tree structure, the optional ordered list of<br />

names <strong>and</strong> destinations.<br />

The method accepts four parameters:<br />

• The first is a h<strong>and</strong>le for the document in which the name is to reside.<br />

• The second is a string representing the tree name (can be NULL).<br />

• The third is a string containing the destination name.<br />

• The fourth is a COS structure, which must be an array with contents as described in the PDF<br />

Specification, section 7.3.1.<br />

"C" Example: Creating A Named Destination<br />

/* Create a Destination structure to fit a given rectangle to<br />

* the viewer window */<br />

Dest = CosNewarray (Doc, TRUE, 6);<br />

CosArrayPut (Dest, 0, Page); /* The current page */<br />

CosArrayPut (Dest, 1, CosNewName (Doc, FALSE,<br />

ASAtomFromString (“FitR”)));<br />

CosArrayPut (Dest, 2, CosNewFixed (Doc, FALSE, Left));<br />

CosArrayPut (Dest, 3, CosNewFixed (Doc, FALSE, Bottom));<br />

CosArrayPut (Dest, 4, CosNewFixed (Doc, FALSE, Right));<br />

CosArrayPut (Dest, 5, CosNewFixed (Doc, FALSE, Top));<br />

dlpdfdocnameadd (Doc, "Name Tree", "Destination Name",<br />

Dest);


13.8 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfdocnamefind<br />

This method will return the Cos structure associated with a destination name. If that name does not exist,<br />

a CosNull structure will be returned.<br />

The method accepts two parameters:<br />

• a document h<strong>and</strong>le<br />

• a string containing the desired name<br />

Modifying the Link Cos Object<br />

Each of the three methods which create an annotation return a CosObj. This structure is the annotation<br />

dictionary, <strong>and</strong> may be modified freely. In practice, it is the link annotation that will most often be<br />

modified.<br />

As created by <strong>DLI</strong>, the link annotation dictionary will contain the following key/value pairs:<br />

• Type Annot<br />

• SubType Link<br />

• Rect [x, y, x+wide, y+depth]<br />

• Border [v1, v2, v3] (if Border is not NULL)<br />

• Color [r, g, b] (if Color is not NULL)<br />

• Dest [...], where the destination is described in the array<br />

This will create a link whose action is defaulted to “GoTo.”<br />

Although "GoTo" is the normal state for a link within a document, there are 13 possible actions for<br />

selecting a link permitted in PDF Specification 1.2, <strong>and</strong> a fourteenth added in PDF Specification 1.3. More<br />

may be added in the future.<br />

In order to modify this link to use one of the other actions, you must replace the Dest couplet with an A<br />

key <strong>and</strong> an action dictionary:<br />

1 The Dest couplet is removed, using<br />

CosDictRemove(Dict, ASAtomFromString (“Dest”));.<br />

2 The action dictionary is created, always as a new, indirect, dictionary structure. It has a Type of<br />

Action, a SubType of the action desired (See PDF Specification, section 6.8), <strong>and</strong> additional<br />

parameters depending on the action selected.<br />

The following is extracted from the full example of creating annotations:


"C" Example: Modifying a Goto Link into a GotoR Link<br />

/* Create a link to another document */<br />

local_inserttext (Doc, Content1, &gState,<br />

"Link to Line Drawing Sample", fixedFour * 72,<br />

fixedEight * 72, &BBLink3);<br />

CosLink3 = dlpdfpageaddlinkannotation (Page1, &BBLink3,<br />

Border, Color, 0, "XYZ", &BBLink3, PDViewDestNULL);<br />

CosDictRemove (CosLink3, ASAtomFromString ("Dest"));<br />

Action = CosNewDict (Doc->cosDoc, TRUE, 3);<br />

CosDictPut (CosLink3, ASAtomFromString ("A"), Action);<br />

CosDictPut (Action, ASAtomFromString ("Type"),<br />

CosNewName (Doc->cosDoc, FALSE,<br />

ASAtomFromString ("Action")));<br />

CosDictPut (Action, ASAtomFromString ("S"),<br />

CosNewName (Doc->cosDoc, FALSE,<br />

ASAtomFromString ("GoToR")));<br />

Dest = CosNewArray (Doc->cosDoc, FALSE, 2);<br />

CosArrayPut (Dest, 0, CosNewInteger (Doc->cosDoc,<br />

FALSE, 0));<br />

CosArrayPut (Dest, 1, CosNewName (Doc->cosDoc, FALSE,<br />

ASAtomFromString ("Fit")));<br />

CosDictPut (Action, ASAtomFromString ("D"),Dest);<br />

CosDictPut (Action, ASAtomFromString ("F"),<br />

CosNewString (Doc->cosDoc, FALSE,<br />

"ExampleDraw1.pdf", 16));<br />

Annotations <strong>and</strong> Links 13.9


13.10 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong>


14<br />

Bookmark<br />

Creation<br />

Bookmarks, or an outline tree, are used to help the reader<br />

navigate a document. In essence, they form a Table of<br />

Contents for a document. They are displayed on a<br />

collapsible navigation pane adjacent to the window in<br />

which the document body is displayed when using Adobe<br />

Acrobat or Adobe Reader.<br />

14.1


14.2 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Overview<br />

You are not limited to a single tree of contents which matches your document. You may build multiple<br />

trees within the outline tree, <strong>and</strong> you may order material differently than the way it is ordered in the<br />

document. You may use bookmarks to point out <strong>and</strong> highlight material in any way that you believe to be<br />

useful to a reader of your document.<br />

The outline tree itself must be a single tree, with a single root node. <strong>DLI</strong> will h<strong>and</strong>le the mechanics of<br />

constructing the actual tree, allowing you to be concerned only with its content.<br />

<strong>DLI</strong> represents the outline tree as a collection of DLPDFOUTLINE structures. These have a number of<br />

properties, in addition to a pointer to the COS structure which this structure represents. The collection of<br />

such structures is the property of a single given document, <strong>and</strong> will be destroyed when that document is<br />

destroyed.<br />

dlpdfdocoutlineadd<br />

This method adds a new outline entry to the document:<br />

• The first parameter specifies the document in which it is to reside.<br />

• The second, if not NULL, is the h<strong>and</strong>le of a parent structure.<br />

• The third, if not NULL, is the desired younger sibling (if NULL, it will be added as the last child of that<br />

parent).<br />

• The fourth parameter is required <strong>and</strong> is the text that will be displayed for this outline entry.<br />

• The fifth is a flag. If TRUE, the entry will be displayed initially as open (its children will be displayed). If<br />

FALSE, it will be displayed initially as closed.<br />

The following parameters describe a location which is to be displayed if this entry is selected.<br />

• First is a page number (the first page is zero)<br />

• Second is a FitType, a text string, as defined in the PDF Specification, section 6.8.1.<br />

• Third is an ASFixed Rectangle, describing a location of the page to be displayed<br />

• Last is a zoom factor, indicating how much the size of the display should increase or decrease.<br />

(PDViewDestNull indicates “Do not change.”)<br />

These last 4 parameters are identical to the destination specifications for links, in the previous section.<br />

From the full example on creating annotations, this segment shows the creation of an outline entry:


Bookmark Creation 14.3<br />

"C" Example: Adding Outline Entries<br />

RootBookMark = dlpdfdocoutlineadd (Doc, NULL, NULL,<br />

"All Pages", TRUE, 0, "Fit", &PageRect, PDViewDestNULL);<br />

/* An annotation for each page, linking to display<br />

* entire page */<br />

Page1BookMark = dlpdfdocoutlineadd (Doc, RootBookMark, NULL,<br />

"Page 1", FALSE, 0, "Fit", &PageRect, PDViewDestNULL);<br />

dlpdfdocoutlineaddfromname<br />

This method is the same as the previous in its action <strong>and</strong> in its first 4 parameters. It differs in that the<br />

destination is specified as a text string, a name in the destination dictionary of the document. (See the<br />

previous section for adding names <strong>and</strong> description of the use of name.)<br />

The following is an extract from the full example on annotations:<br />

"C" Example: Adding an Outline with a Named Destination<br />

dlpdfdocoutlineaddfromname (Doc, Page1BookMark, NULL,<br />

"Link to 2", FALSE, "Link1");<br />

Each time you create a DLPDFOUTLINE, a pointer to that structure is returned. You may keep these<br />

pointers in your own data structures as an aid in building the document tree, or you may navigate the<br />

existing structure using the following methods.<br />

dlpdfdocoutline<br />

This method accepts a document h<strong>and</strong>le, <strong>and</strong> returns the h<strong>and</strong>le of the root outline node. If there are no<br />

outlines, it will return a NULL pointer.<br />

dlpdfdocoutlinefirst<br />

This method accepts an outline h<strong>and</strong>le, <strong>and</strong> returns the h<strong>and</strong>le of the first child of this outline. If there are<br />

no outlines, it will return a NULL pointer.<br />

dlpdfdocoutlinelast<br />

This method accepts an outline h<strong>and</strong>le, <strong>and</strong> returns the last child of that outline. If there are no children in<br />

the outline, it returns a NULL pointer.


14.4 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfdocoutlineprev<br />

This method accepts an outline pointer, <strong>and</strong> returns the h<strong>and</strong>le of the previous child of this outline entry’s<br />

parent. If there is no previous child, it returns a NULL pointer.<br />

dlpdfdocoutlinenext<br />

This method accepts an outline pointer, <strong>and</strong> returns the pointer of the next child of this outline entry’s<br />

parent. If there is no next child, it returns a NULL pointer.<br />

dlpdfdocoutlineparent<br />

This method accepts a pointer to an outline entry, <strong>and</strong> returns a pointer to that entry’s parent. If the entry<br />

is the root entry, it returns a NULL pointer.<br />

The DLPDFOUTLINE structure contains three fields which may be accessed, but not changed, by an<br />

application:<br />

• DLPDFOUTLINE->Open is a flag which will be TRUE if the outline entry was created open, FALSE if it<br />

was not.<br />

• DLPDFOUTLINE->Count is a count of the children of this entry.<br />

• DLPDFOUTLINE->Obj is a Cos Obj which is the actual entry in the outline. This entry is a dictionary,<br />

as described in the PDF Specification, section 6.7. It will always have a Dest key, never an A key. You<br />

may replace this key to obtain actions other than “GoTo”.<br />

Opening the Document with Annotations Showing<br />

The default action on opening a document is to show only the document window <strong>and</strong> hide the navigation<br />

pane. To define a document that should be opened with the navigation pane showing, you need to add the<br />

key PageMode with the value UseOutlines to the document catalog structure. This is done at the Cos<br />

level as:<br />

"C" Example: Setting the Page Mode to Display Navigation Pane<br />

CosDoc cosDoc;<br />

CosObj Catalog;<br />

cosDoc = dlpdfdoccosdoc (Doc);<br />

Catalog = CosDocGetRoot (cosDoc);<br />

CosDictPut (Catalog, ASAtomFromString ("PageMode"),<br />

CosNewName (cosDoc, FALSE,<br />

ASAtomFromString ("UseOutlines")));


15<br />

Digital<br />

Signatures<br />

Digital Signatures are used to validate the document’s<br />

content <strong>and</strong> protect it against unauthorized tampering,<br />

viewing or modification.<br />

15.1


15.2 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Overview<br />

PDF files created with <strong>DLI</strong> may include digital signatures for use in validating a document's contents.<br />

With a digital signature, a certificate is added to a PDF file containing information about the signer. An<br />

encrypted message, <strong>and</strong> the key to decrypt this message, are included in the certificate or the signature<br />

PDF fields. The message is generated by a non-reversible mathematical transform of the PDF file's bytes<br />

known as a hash function. A recipient of the PDF file can then decrypt this message. If the message<br />

matches what the recipient calculates using the hash function for the PDF file, the PDF file has not been<br />

altered since it was signed. If it does not match, the document has been changed.<br />

Public <strong>and</strong> Private Keys<br />

Digital signatures are based on public-key cryptography. In public-key cryptography, there are two keys,<br />

public <strong>and</strong> private:<br />

• A private key is used to encrypt data that only the public key can decrypt.<br />

• A public key may encrypt data that only the private key can decrypt.<br />

This allows you, the document creator, to distribute a public key freely, <strong>and</strong> to encrypt a message with<br />

your private key (which must be kept secret). The reader can decrypt a message, but cannot re-encrypt the<br />

message in the same way that you encrypted it when you signed it. This prevents the reader from<br />

pretending to be the document author.<br />

Digital signatures also serve the purpose of non-repudiation. Since only the author can sign a document, a<br />

valid signature means that only the author of the document could have signed the PDF file. This makes<br />

digital signatures useful for contracts or other archival legal documents.<br />

A digital signature in a PDF file has two important parts:<br />

• the certificate<br />

• a series of DLPDFFORM objects which form a visible indicator that a document is signed<br />

The certificate is supplied to <strong>DLI</strong> <strong>and</strong> contains information such as the signer's name, their location, <strong>and</strong><br />

a signature to validate the certificate.<br />

Certificates are accepted in PKCS #7 format <strong>and</strong> in x.509 format. For PKCS #7 format, the calling<br />

application must be able to supply a fully-formed certificate, complete with the signed PDF document<br />

hash (supplied by <strong>DLI</strong>); for an x.509 certificate, the hash value is calculated by <strong>DLI</strong> <strong>and</strong> supplied to the


Digital Signatures 15.3<br />

application through a callback routine for signing. This is for security purposes; calling applications<br />

should use secure memory routines when signing the PDF document.<br />

The appearance of the signature is optional; if it is not set, an invisible digital signature will be added to<br />

the PDF file created by <strong>DLI</strong>. It consists of several layers:<br />

• a background layer<br />

• a layer displayed before the signature is validated<br />

• a layer for the graphical signature representation (such as a scan of a h<strong>and</strong>written signature or signature<br />

stamp)<br />

• a layer containing information about the signature<br />

Any of these layers may be omitted; if so, an empty layer is created by <strong>DLI</strong> for the signature.<br />

Digital Signature Calls<br />

dlpdfdoccreatesignature<br />

This call creates a digital signature object for the <strong>DLI</strong> document being created. The sigType value is one<br />

of:<br />

dlpdfsigacrox509 (Adobe self-sign plug-in compatible with an x.509 v3 certificate)<br />

dlpdfsigacropkcs7 (Adobe self-sign plug-in compatible with a PKCS #7 certificate)<br />

dlpdfsigverisign (VeriSign signature plug-in compatible with a PKCS #7 certificate)<br />

The nameStr, reasonStr <strong>and</strong> locationStr arguments are ASCII strings representing the signatory's<br />

name, the reason for signing (such as an initial release or a document revision), <strong>and</strong> the location of the<br />

signatory respectively. This information is stored outside of the certificate <strong>and</strong> is optional.


15.4 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfdocsetsignatureappearance<br />

This call sets the appearance layers for the digital signature to the supplied DLPDFFORM values:<br />

• The background layer is the bottommost layer of the digital signature appearance.<br />

• The unverified layer is displayed when the signature has not been verified.<br />

• The signature layer is a graphical representation of the signature itself (such as a scanned<br />

h<strong>and</strong>written signature).<br />

• The textSigInfo layer is used to display information about the signature <strong>and</strong> the signatory.<br />

This call is optional. For an invisible digital signature, do not call this function. All the signature layers are<br />

also optional. Blank layers will be used for any omitted signature appearance layers. These forms are<br />

placed at the origin of the <strong>DLI</strong> page.<br />

dlpdfsignaturesetx509cert<br />

This call associates an x.509 v3 certificate with a DLPDFSIGNATURE object created as a<br />

dlpdfsigacrox509-certificate digital signature. Do not call this with a DLPDFSIGNATURE object<br />

created as a different certificate type.<br />

The certificate is passed as a binary buffer in the certificate parameter; <strong>DLI</strong> will read certLen bytes from<br />

this buffer <strong>and</strong> make a copy for the PDF file's digital signature.<br />

The last parameter is a required callback function, to be called during the dlpdfdocwritepdf function<br />

call. It will be passed a character string containing the SHA-1 hash for the PDF file being written, as a<br />

NULL-terminated string of hexadecimal digits using PKCS #1 padding, containing a BER OID (object<br />

identifier) for the SHA-1 algorithm. The buffer is 256 bytes long (not including the NULL terminator), <strong>and</strong><br />

formatted as<br />

0001FFFF .. FF003021300906052B0E03021A05000414<br />

[ 40 hex digits for SHA-1 hash ]<br />

The callback function must encrypt this hash value with the private key corresponding to the public key in<br />

the signature's x.509 certificate, <strong>and</strong> fill the buffer passed in with 256 hexadecimal digits representing the<br />

encrypted value for the supplied BER formatted hash. A 1024-bit key is used for encryption operations.<br />

NOTE: The signed hash will not have padding, <strong>and</strong> must be exactly 256<br />

hexadecimal digits. If necessary, use zeros to pad it to the required length.<br />

dlpdfsignaturesetpkcs7cert<br />

This function sets the certificate generation callback for DLPDFSIGNATUREs of type<br />

dlpdfsigacropkcs7 <strong>and</strong> dlpdfsigverisign. For these signature types, the application using <strong>DLI</strong>


Digital Signatures 15.5<br />

is required to generated a fully-formed PKCS #7 certificate with an MD5 checksum of the PDF document,<br />

encrypted with the private key corresponding to the public key in the certificate. The RSA public-key<br />

algorithm with a 1024-bit key length is used.<br />

The genPKCS7Cert callback is called by <strong>DLI</strong> during the dlpdfdocwritepdf function call. The<br />

callback is supplied a binary data buffer of length maxLen. The first 16 bytes of this buffer contain the<br />

MD5 checksum (in binary) for the PDF document to sign. The callback must generate a PKCS #7<br />

certificate as described above, <strong>and</strong> fill the data buffer with the certificate, in binary. The callback function<br />

must return the length to read from the data buffer, in bytes.<br />

NOTE: maxLen bytes are set aside in the output PDF file for the PKCS #7<br />

certificate, <strong>and</strong> will be written to the PDF file regardless of the actual certificate<br />

length. Callers should pass length values which are close to the certificate length<br />

if possible.<br />

dlpdfsignaturesetdatacallback<br />

This call is optional for clients using PKCS #7 certificates. A callback function is supplied for the<br />

signature. The callback is called during the dlpdfdocwritepdf function with binary information from<br />

the PDF file. This information will be in sequential pieces, <strong>and</strong> may be used to generate the PDF document<br />

hash value. The information is supplied as binary values in the character buffer; the length to read is<br />

supplied as the second parameter. A length of 0 indicates that no further data is to be read, <strong>and</strong> the hash<br />

may be finalized.<br />

dlpdfpageplacesignature<br />

This call associates a digital signature to a page in the PDF file generated by <strong>DLI</strong>. The signature<br />

appearance must fit in the bounds supplied in imageBBox. This call is required for all digital signatures,<br />

even invisible signatures. For invisible digital signatures, the imageBBox is ignored <strong>and</strong> may be NULL.


15.6 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong>


16<br />

Error<br />

Testing <strong>and</strong> Recovery<br />

This chapter discusses possible errors you may encounter<br />

<strong>and</strong> how to resolve them.<br />

16.1


16.2 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Overview<br />

The Adobe PDF Library <strong>and</strong> <strong>DLI</strong> will communicate errors back to your application program by raising<br />

an exception. For this reason, it is important that you have exception h<strong>and</strong>lers placed to catch such errors<br />

as close as possible to their source, to detect the error as soon as possible <strong>and</strong> to limit the damage an error<br />

can cause. It is also important that an outer error catcher be in place, as having no exception h<strong>and</strong>ler<br />

when an exception is raised will cause a fatal error.<br />

NOTE: Follow the development guidelines for error h<strong>and</strong>ling that are included in<br />

the Adobe Acrobat Core API Overview. See chapter 12, “H<strong>and</strong>ling Errors” for more<br />

information.<br />

The Adobe PDF Library provides a mechanism in “C” to define exception h<strong>and</strong>lers. This mechanism<br />

consists of bracketing the code which may cause an exception to be raised with DURING <strong>and</strong> HANDLER,<br />

followed by a block of code to be executed only if an exception is raised, terminated by END_HANDLER.<br />

CAUTION: Your application must not exit from within the exception h<strong>and</strong>ler.<br />

Doing so will leave the exception h<strong>and</strong>ler frame on the stack, eventually leading to<br />

a stack overflow <strong>and</strong> crash. Your application should exit beyond the<br />

END_HANDLER statement, not within the HANDLER/END_HANDLER block. See<br />

“Risks of Function Returns within Exception H<strong>and</strong>lers” on page 16.3 following<br />

below.<br />

Always use the macros defined by Adobe for returning from functions under various conditions. For<br />

example:<br />

"C" Example: Error H<strong>and</strong>ler<br />

DURING<br />

Image = dlpdfimagecreatefromfile (Doc, FileName);<br />

HANDLER<br />

char Buffer[1024];<br />

ASGetErrorString(ASGetExceptionErrorCode(), Buffer, 1024);<br />

printf (“Unable to process image ‘%s’ for reason ‘%s’,<br />

FileName, Buffer);<br />

Image = NULL;<br />

END_HANDLER<br />

To support you in h<strong>and</strong>ling an error, both the Adobe PDF Library <strong>and</strong> <strong>DLI</strong> report errors via exception<br />

names. These names are available via the method ASGetExceptionErrorCode. It will be translated<br />

into a meaningful text string via the call ASGetErrorString.


Error Testing <strong>and</strong> Recovery 16.3<br />

Each method documents the exceptions that may be raised by that method. You may design error routines<br />

which examine the exception code <strong>and</strong> act differently based on its value.<br />

Be careful in placing DURING/HANDLER/END_HANDLER constructs. Try to get them as close to a definable<br />

piece of your data constructs as possible. Depending on the function of your application, this may allow a<br />

single construct to fail without removing all of a line, area, page, or the document as a whole.<br />

The more h<strong>and</strong>ler constructs you build, the smaller the effect of an error may be, <strong>and</strong> the greater your<br />

chances that your application may be able to recover from that error <strong>and</strong> continue (depending on the<br />

nature of the problem, of course).<br />

Risks of Function Returns within Exception H<strong>and</strong>lers<br />

Do not return from a function while inside an exception h<strong>and</strong>ler, since doing so can cause unexpected <strong>and</strong><br />

hard-to-trace program crashes. If an application must exit while inside a DURING/HANDLER/<br />

END_HANDLER construct, use the E_RETURN(X) macro to return the value X, or the E_RTRN_VOID<br />

macro to exit a function with no return value.<br />

OS/390 Platform Concerns<br />

The preceding error recovery mechanism applies on the OS/390 platform if the SAS/C compiler is used. In<br />

cases where the OS/390 application is not compiled via SAS/C, it must use a different mechanism to<br />

obtain the error status. This consists of three primary function calls:<br />

DLExceptionFlag<br />

Returns: ASInt32<br />

DLExceptionFlag returns 0 if no exception was raised by the exception h<strong>and</strong>ler in the most-recentlycalled<br />

Adobe PDF Library or <strong>DLI</strong> function. A non-zero return value indicates that an error was detected<br />

while processing the last function call.<br />

This error mechanism is destructive, in that the flag value is reset by accessing it with the<br />

DLExceptionFlag function call.<br />

NOTE: If DLExceptionFlag returns a non-zero return code, the return value<br />

of the function in which the error occurred is undefined.


16.4 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

DLExceptionCode<br />

Returns: ASInt32<br />

DLExceptionCode returns the last exception code set by an exception raised by an Adobe PDF Library<br />

or <strong>DLI</strong> function. The code value returned by the DLExceptionCode function may be used to retrieve an<br />

error message via a call to ASGetErrorString, as documented in the Adobe PDF Library Developer<br />

<strong>Guide</strong>.<br />

DLExceptionMessage<br />

Returns: char*<br />

DLExceptionMessage returns a non-NULL pointer if an additional message string was generated by<br />

Adobe PDF Library or <strong>DLI</strong> when an exception was raised. This pointer may be NULL when an error is<br />

raised if the Adobe PDF Library or <strong>DLI</strong> function does not supply the optional message string.<br />

The application should call DLExceptionFlag after each Adobe PDF Library <strong>and</strong> <strong>DLI</strong> function call to<br />

determine if an exception was raised. If the flag is non-zero, the application should use<br />

DLExceptionCode <strong>and</strong>/or DLExceptionMessage to obtain additional information, then h<strong>and</strong>le the<br />

exception as appropriate.<br />

These are the basic steps that should be followed:<br />

1 Call the desired Adobe PDF Library/<strong>DLI</strong> function<br />

2 Get the Exception Status by calling DLExceptionFlag<br />

3 If DLExceptionFlag returns a non-zero value:<br />

• Get additional error information (DLExceptionCode, ASGetErrorString, DLExceptionFlag)<br />

• H<strong>and</strong>le exception as appropriate to the application (e.g. switch to a default font, flush the current<br />

statement, etc.).


17<br />

Samples<br />

<strong>and</strong> Links<br />

The following pages explain the full <strong>DLI</strong> sample<br />

programs that have been compiled <strong>and</strong> tested, <strong>and</strong> which<br />

accompany this release. They illustrate various aspects of<br />

the usage of Adobe PDF Library <strong>and</strong> <strong>DLI</strong>.<br />

17.1


17.2 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Running <strong>DLI</strong> Sample Applications<br />

Notes on each specific <strong>DLI</strong> sample follow below. You are not required to test any or all of them, but if<br />

you do, we suggest running them in the order given below.<br />

Some samples require one or more comm<strong>and</strong>-line arguments, <strong>and</strong> will prompt for them if not given.<br />

You should find the following <strong>DLI</strong> samples in individual subfolders under<br />

C:\<strong>Datalogics</strong>\APDFL7.0.0\<strong>DLI</strong>\Samples (or similar). On Windows platforms, a Visual Studio<br />

Solution file for all <strong>DLI</strong> samples can be found in C:\<strong>Datalogics</strong>\APDFL7.0.0\<strong>DLI</strong>\Samples\All<br />

(see dli_samples.sln).<br />

NOTE: Sample applications included in each release are subject to change. Some<br />

samples may not appear in releases on certain platforms.<br />

Activating Files-in-Memory<br />

In the MultiDoc sample, adding the comm<strong>and</strong>-line keyword "MEMORY" will run the application using<br />

Files-in-Memory methods. This will make use of memory work files instead of I/O processing to disk, <strong>and</strong><br />

as a result should show improved processing times.<br />

Within the sample, "MEMORY" is recognized as an indicator which then determines the calling arguments<br />

for dlpdfinit, as shown in the following typical excerpt, where FileSystemType is defined as<br />

eMemFileSys if MEMORY was found in the calling arguments for the application:<br />

switch (FileSystemType)<br />

{<br />

case eStdFileSys:<br />

pdfInstance=dlpdfinit(&DataRec, NULL, NULL);<br />

break;<br />

case eMemFileSys:<br />

pdfInstance=dlpdfinit(&DataRec, dlpdfmemfilesys(), NULL);<br />

break;<br />

default:<br />

printf("Unknown File System requested.");<br />

return 8;


Samples <strong>and</strong> Links 17.3<br />

Hello<strong>DLI</strong><br />

This application is similar to the Adobe PDF Library sample HeloWrld, generating a single page reading<br />

"Hello <strong>DLI</strong>!" via <strong>DLI</strong> methods. Comparing Hello<strong>DLI</strong>.c to HeloWrld.c can show the simplified<br />

coding available via <strong>DLI</strong> for performing common Adobe PDF Library tasks.


17.4 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Paths<br />

This sample shows how to draw various simple shapes using <strong>DLI</strong>, <strong>and</strong> how to draw PDF paths with <strong>DLI</strong>.<br />

A path in PDF, like in PostScript, consists of a series of movements from a starting point. A path is filled<br />

with the fill color in the graphics state, <strong>and</strong> the lines connecting the movements of the path are<br />

drawn with the stroke color in the graphics state. This sample also demonstrates some common<br />

matrix operations, such as rotations <strong>and</strong> translations of paths.<br />

For common shapes, <strong>DLI</strong> has shortcut operations to create paths, such as for rectangles <strong>and</strong> arcs.<br />

This sample also demonstrates the use of CMYK color spaces. For an example of using RGB color spaces,<br />

please see “Annotations” on page 17.12.


Samples <strong>and</strong> Links 17.5<br />

Graphics<br />

This sample demonstrates how to imports graphics from <strong>DLI</strong>-supported graphic file formats ( RAW, EPS,<br />

PNG, JPEG/JPG, GIF, TIFF <strong>and</strong> PDF ) into a PDF document, how to scale these to the individual graphic's<br />

design width <strong>and</strong> height, <strong>and</strong> how to place these on the page. Details on some graphic formats follow<br />

below.<br />

NOTE: An Encapsulated PostScript (EPS) image written to an output PDF file will<br />

be present in the file, but will not display when viewed in PDF output. It will<br />

appear when produced as PostScript (e.g. to a PostScript printer). You may need to<br />

define EPSF_ENABLED in this example in order to process the EPS sample image.


17.6 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

EPS<br />

EPS graphics will not show when viewing the output PDF graphic; EPS graphics will only print, <strong>and</strong> only<br />

when printing to a PostScript device. These graphics are stored in PDF as comments.<br />

If you need to convert EPS files to PDF, please contact <strong>Datalogics</strong> for information on licensing Adobe<br />

Normalizer Server, or use Adobe Distiller.<br />

PDF<br />

PDF pages are imported as graphical elements, <strong>and</strong> some items such as annotations <strong>and</strong> bookmarks are<br />

not imported with the PDF file. Additionally, Acrobat Forms are not imported at this time. PDF images<br />

created with the dlpdfimagecreatefromfile call are created from the first page; to import other<br />

pages, use the dlpdfimagecreatefrompdf function.<br />

PNG<br />

Alpha channels are currently flattened into a 1-bit plane (visible/invisible) to facilitate placement using a<br />

threshhold algorithm. This threshhold cannot be changed at this time.<br />

TIFF<br />

Only the first page of a multipage TIFF image will be processed at this time.<br />

Alpha channels are currently flattened into a 1-bit plane (visible/invisible) to facilitate placement using a<br />

threshhold algorithm. This threshhold cannot be changed at this time.<br />

BMP<br />

NOTE: Some BMP images with LZW skip markers may not embed properly. If<br />

possible, avoid images with LZW skip markers.<br />

For all raster images, <strong>DLI</strong> attempts to do as little image alteration as possible, though usually some image<br />

processing is required to create stream information suitable for inclusion in PDF files.<br />

NOTE: All images are cached by <strong>DLI</strong> by filename. Applications should not attempt<br />

to change image file data during a job, as unpredictable or unexpected results<br />

could occur.


Samples <strong>and</strong> Links 17.7<br />

Encrypt<br />

This produces a simple PDF document (a blank page with a red square), applying encryption to the output<br />

PDF file, requiring one of two passwords for viewing:<br />

When prompted by Adobe Acrobat or Adobe Reader, entering the user password "ValidUser" (casesensitive,<br />

must be entered as shown) will open the document for viewing <strong>and</strong> printing.<br />

Entering the owner password "DocOwner" will open the document for viewing <strong>and</strong> printing as before,<br />

but will also allow current protection to be modified or removed.<br />

Compare the action under either password when following the "File->SaveAs..." menu <strong>and</strong><br />

attempting to change the Security settings on the new file to be created. The owner password must be


17.8 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

given before Security settings can be viewed or modified:


Samples <strong>and</strong> Links 17.9<br />

FontFaux<br />

This sample demonstrates how to create a font for use in a PDF file when the font is not present on the<br />

system on which an application is running, <strong>and</strong> illustrates the meanings of the various font attributes<br />

available to the user in the PDEFontAttrs structure. It demonstrates font fauxing techniques for<br />

simulating the appearance of various referenced fonts which are neither embedded in the document nor<br />

available on the viewing user machine.<br />

The sample creates a number of simulated ("faux") fonts, each with different attributes. When the created<br />

PDF document is opened, Adobe Acrobat or Adobe Reader will substitute a font for that used by the PDF<br />

file. The document contains enough information for each font that a viewer can create a lookalike font.


17.10 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

That lookalike will not be suitable for precise typography, but should be acceptable for web-delivery<br />

documents.<br />

NOTE: Only fonts using characters in the Adobe st<strong>and</strong>ard encodings (St<strong>and</strong>ard,<br />

WinAnsi <strong>and</strong> MacRoman) can be fauxed correctly. Attempting to do this with<br />

fonts containing characters outside the range of st<strong>and</strong>ard encodings will result in<br />

a bad display. Set the PD_STD_ENCODING font flag in the PDEFontAttrs<br />

structure to indicate that the font uses only "st<strong>and</strong>ard" characters.<br />

FontVerification<br />

This application is useful for creating a quick-reference table of fonts available to your application. It<br />

compiles a directory of all fonts found in the current resource listing, including a hyperlinked Table of<br />

Contents <strong>and</strong> a sample listing, font dump <strong>and</strong> encoding grid page for every font found. It demonstrates


Samples <strong>and</strong> Links 17.11<br />

basic font creation using <strong>DLI</strong>, <strong>and</strong> displays the fonts which the Adobe PDF Library was able to locate on<br />

the host system.<br />

NOTE: On machines with lengthy resource listings (i.e. numerous fonts available),<br />

this application may take a minute or two to complete. Some time may elapse<br />

before any completion messages appear onscreen.<br />

For each single-byte Type 1 or TrueType font found, a font will be created in <strong>DLI</strong> with the same name <strong>and</strong><br />

type. Each character of a target encoding will then be displayed in a grid formation, to verify proper font<br />

creation. Fonts of other types (e.g. MultiMaster fonts, Type 0 fonts) will be noted in the Table of<br />

Contents, but not used for font creation.<br />

See the source code comments in Fontverification.c for more information on how the resource lists<br />

are compiled, <strong>and</strong> what options are available for maintaining them <strong>and</strong> controlling how they are<br />

compiled.


17.12 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Annotations<br />

This sample demonstrates types of PDF annotations for which <strong>DLI</strong> provides output support. (Other<br />

annotation types can be done at the COS layer; see the sample “AcroForm” on page 17.15 for more<br />

details.) This sample also shows how to manipulate RGB color spaces to produce colored text <strong>and</strong> path<br />

elements.<br />

Annotations include features such as "sticky notes" (open or closed), bookmarks <strong>and</strong> hyperlinks (enabling<br />

the user to jump to other places in the current document, to other PDF documents or other files, or to<br />

Internet addresses elsewhere).<br />

The first two pages of output demonstrate links to other documents <strong>and</strong> to other pages within the same<br />

document. (e.g. a link on Page 1 will take you to Page 2, <strong>and</strong> a link on Page 2 will take you to Page 1.)<br />

Notice that the link can specify not only the destination being pointed to but also the type of screen<br />

display to use when you arrive. For example, Page 1’s "Link to page 2," if selected, will take you to a fullpage<br />

view of Page 2. However, Page 2’s "Link to page 1," if selected, will zoom in on its Page 1 target note<br />

to fill the entire screen.<br />

Finally, the third page demonstrates two methods of visually cueing the reader to embedded hyperlinks:<br />

boxing the hyperlink area with an outline rule, or generating text of a different color. In either case,<br />

clicking on the links should trigger a jump to the <strong>Datalogics</strong> website at http://<br />

www.datalogics.com.


Samples <strong>and</strong> Links 17.13<br />

memFiles<br />

This sample demonstrates use of the <strong>Datalogics</strong> Files-in-Memory file system. Using this filesystem, a <strong>DLI</strong><br />

user can create ASFile objects from a memory buffer , enabling creation of images from memory such as<br />

database BLOBs (Binary Large OBjects). The filesystem also allows the user to write PDF files to memory<br />

buffers, which can then be retrieved, written to other files or manipulated in various ways.<br />

Temporary files are also written to the Files-in-Memory filesystem, if it is active at the time the temporary<br />

file is opened. This usually occurs when a document is created.<br />

MultiDoc<br />

This sample controls the generation of multiple documents from a single run of the application. It has two<br />

required arguments:<br />

• Argument 1 must be the number of documents to produce.<br />

• Argument 2 must be the number of pages per document to produce.<br />

Several additional, optional arguments may also be used to vary the output as desired, such as MEMORY<br />

for Files-in-Memory processing, or PSTOUT or PDFOUT keywords to generate PostScript or PDF output<br />

respectively. (This sample is mainly intended to demonstrate program operation, not text output.) Other<br />

comm<strong>and</strong>-line arguments can also be given in order to test output variations or application performance.<br />

Run the sample with no comm<strong>and</strong>-line arguments for a short usage message; see the source code file<br />

MultiDoc.c for more details.


17.14 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

NestedPDF<br />

This sample generates a set of output documents, in which a pair of PDF graphic files are in turn included<br />

within a larger PDF file, repeating the process several times. It demonstrates the ability of the interface to<br />

embed PDF files as graphics, in the presence of conflicting names, to show PDF Form XObject name<br />

scoping rules.<br />

This sample also demonstrates how to create patterns in <strong>DLI</strong> for painting content areas with a<br />

background.


Samples <strong>and</strong> Links 17.15<br />

AcroForm<br />

This sample demonstrates how to create an Acrobat Form using the Adobe PDF Library <strong>and</strong> <strong>DLI</strong>,<br />

creating a number of different field types using COS-layer object manipulation.


17.16 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

SignDoc<br />

This sample demonstrates how to place a digital signature into a PDF file generated by <strong>DLI</strong>. This<br />

signature will be compatible with the Adobe self-sign plugin, <strong>and</strong> will contain an x.509 certificate.<br />

NOTE: Included in this project is a file "rsasign.cpp", containing a very slow<br />

implementation of the RSA encryption algorithm. <strong>Datalogics</strong> does not recommend<br />

using this implementation as a basis for Production code.<br />

<strong>DLI</strong> can also produce signatures with PCKS #7-format certificates, for the Adobe self-sign plugin <strong>and</strong> the<br />

VeriSign signature plugin. Customers wishing to do this will follow a slightly different path, <strong>and</strong> must be<br />

able to generate these certificates.<br />

This sample uses a dummy x.509 certificate; the key pair used to generate this certificate is stored in the<br />

sample.key.info file in the @Data directory.<br />

As of Adobe PDF Library v6.1.1 <strong>and</strong> <strong>DLI</strong> v3.0.23, this sample application produces digital signatures<br />

compatible with the Adobe Acrobat v5 validation plug-in. In later releases, <strong>DLI</strong> will be upgraded to<br />

generate digital signatures compatible with Adobe Acrobat v6 or higher. You should also be aware that<br />

this sample takes a long time to run.


Samples <strong>and</strong> Links 17.17<br />

psOutput<br />

This sample demonstrates generation of PostScript from the Adobe PDF Library <strong>and</strong> <strong>DLI</strong>. The sample<br />

will create a new <strong>DLI</strong> document, add the pages (in reverse order) of a sample PDF file to the document,<br />

<strong>and</strong> write a PostScript Level 2 output file. Additionally, an output PDF file will be written.<br />

The application does all processing of the material in PDF form; the PostScript is generated by exporting<br />

the PDF file created by the Adobe PDF Library <strong>and</strong> <strong>DLI</strong> to PostScript output. This sample shows how<br />

one might write an application to convert PDF files to PostScript for printing or other processing.


17.18 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

WideText<br />

This sample demonstrates the <strong>DLI</strong> interface to the ICU functionality, used to typeset lines of text in<br />

Unicode or other wide-text encodings. This functionality supercedes the Unicode functionality present in<br />

the <strong>DLI</strong> v2.2.x series. This functionality is available for TrueType, TrueType Collection <strong>and</strong> OpenType<br />

font files. This sample also demonstrates the use of DLPDFTEXT areas for placement of text.<br />

NOTE: This sample uses ArialUnicodeMS <strong>and</strong> BitstreamCyberbit fonts, which are<br />

not distributed with Adobe PDF Library or <strong>DLI</strong>. You must ensure that these fonts are<br />

accessible (or that the sample is modified to use others instead) when running this<br />

program, or problems may occur, as either a raised exception or an output<br />

document containing blank glyphs.


A<br />

<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong><br />

This appendix defines methods available with <strong>DLI</strong>.<br />

A.1


A.2 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfcontentarc (DLPDFCONTENT *Content,<br />

PDEGraphicState *gState, int PaintOp, ASFixed X1, ASFixed Y1,<br />

ASFixed Radius, ASFixed Angle1, ASFixed Angle2)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Included as an aid in transitioning from PostScript to PDF. It will<br />

draw an arc centered at (X1,Y1), at a radius of Radius, from<br />

Angle1 to Angle2, counter-clockwise, where the angles are<br />

considered to be in degrees.<br />

• DLPDFCONTENT *Content: Element structures, destroyed<br />

when associated with a page or form; pointers to them<br />

should not be used after that time.<br />

• PDEGraphicState *gState: Color definitions; pathdrawing<br />

line sizes <strong>and</strong> parameters.<br />

• int PaintOp: A composite of text-display flags, set by<br />

performing a bitwise OR with the desired combination of flag<br />

values kPDEFill, kPDEStroke, kPDEEoFill <strong>and</strong><br />

kPDEInvisible.<br />

• ASFixed X1<br />

• ASFixed Y1<br />

• ASFixed Radius<br />

• ASFixed Angle1<br />

• ASFixed Angle2<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfcontentarcn,<br />

dlpdfcontentarcto<br />

All <strong>DLI</strong> supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.3<br />

dlpdfcontentarcn (DLPDFCONTENT *Content,<br />

PDEGraphicState *gState, int PaintOp, ASFixed X1, ASFixed Y1,<br />

ASFixed Radius, ASFixed Angle1, ASFixed Angle2)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

This procedure is included as an aid in transitioning from Post-<br />

Script to PDF. It will draw an arc centered at (X1,Y1), at a radius<br />

of Radius, from Angle1 to Angle2, clockwise, where the<br />

angles are considered to be in degrees.<br />

• DLPDFCONTENT *Content: Represents the content<br />

element. These structures are destroyed when associated<br />

with a page or form, <strong>and</strong> pointers to them should not be<br />

used after that time.<br />

• PDEGraphicState *gState: Contains definitions of<br />

colors to be applied, <strong>and</strong> line sizes <strong>and</strong> parameters to be used<br />

when drawing a path.<br />

• int PaintOp: A composite of flags which define how the<br />

text will be displayed. It is set by performing a bitwise OR with<br />

the desired combination of the Adobe PDF Library flag values<br />

kPDEFill, kPDEStroke, kPDEEoFill <strong>and</strong><br />

kPDEInvisible.<br />

• ASFixed X1<br />

• ASFixed Y1<br />

• ASFixed Radius<br />

• ASFixed Angle1<br />

• ASFixed Angle2<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfcontentarc,<br />

dlpdfcontentarcto<br />

All <strong>DLI</strong>-supported platforms.


A.4 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfcontentarcto (DLPDFCONTENT *Content,<br />

PDEGraphicState *gState, int PaintOp, ASFixed X1, ASFixed Y1,<br />

ASFixed Radius, ASFixed X2, ASFixed Y2, ASFixed Xint, ASFixed Yint)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

This is a convenience method to mimic the PostScript ArcTo<br />

operator. It will locate the intersections of the line (X1,Y1)-<br />

>(Xint,Yint), <strong>and</strong> (X2,Y2)->(Xint,Yint), <strong>and</strong> draw an arc of<br />

the specified radius tangent to those two lines. The line segment<br />

from (X1,Y1) to the arc will be drawn. Unlike the Post-<br />

Script ArcTo operator, the segment from the tangent to<br />

(X2,Y2) will also be drawn.<br />

• DLPDFCONTENT *Content: Represents the content<br />

element. These structures are destroyed when associated<br />

with a page or form, <strong>and</strong> pointers to them should not be<br />

used after that time.<br />

• PDEGraphicState *gState: Contains definitions of<br />

colors to be applied, <strong>and</strong> line sizes <strong>and</strong> parameters to be used<br />

when drawing a path.<br />

• int PaintOp: A composite of flags which define how the<br />

text will be displayed. It is set by performing a bitwise OR with<br />

the desired combination of the Adobe PDF Library flag values<br />

kPDEFill, kPDEStroke, kPDEEoFill <strong>and</strong><br />

kPDEInvisible.<br />

• ASFixed X1<br />

• ASFixed Y1<br />

• ASFixed Radius<br />

• ASFixed X2<br />

• ASFixed Y2<br />

• ASFixed Xint<br />

• ASFixed Yint<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfcontentarc,<br />

dlpdfcontentarcn<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.5<br />

dlpdfcontentcircle (DLPDFCONTENT *Content,<br />

PDEGraphicState *gState, int PaintOp, ASFixed X, ASFixed Y,<br />

ASFixed Radius)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

This procedure is included as an aid in transitioning from Post-<br />

Script to PDF. It will draw a circle centered at (X,Y) at a radius of<br />

Radius.<br />

• DLPDFCONTENT *Content: Represents the content<br />

element. These structures are destroyed when associated<br />

with a page or form, <strong>and</strong> pointers to them should not be<br />

used after that time.<br />

• PDEGraphicState *gState: Contains definitions of<br />

colors to be applied, <strong>and</strong> line sizes <strong>and</strong> parameters to be used<br />

when drawing a path.<br />

• int PaintOp: A composite of flags which define how the<br />

text will be displayed. It is set by performing a bitwise OR with<br />

the desired combination of the Adobe PDF Library flag values<br />

kPDEFill, kPDEStroke, kPDEEoFill <strong>and</strong><br />

kPDEInvisible.<br />

• ASFixed X<br />

• ASFixed Y<br />

• ASFixed Radius<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfcontentellipse<br />

All <strong>DLI</strong>-supported platforms.


A.6 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfcontentclip (DLPDFCONTENT *Content, ASFixed *Path,<br />

int PathLen, int EOClip)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Establish a clipping path. Note that clipping paths are not established<br />

automatically for images, forms, or line drawings. Generally,<br />

PDF images page more efficiently if there is no clipping<br />

involved.<br />

• DLPDFCONTENT *Content: Represents the content<br />

element. These structures are destroyed when associated<br />

with a page or form, <strong>and</strong> pointers to them should not be<br />

used after that time.<br />

• ASFixed *Path: Specifies path; identical to<br />

dlpdfcontentpath oper<strong>and</strong>.<br />

• int PathLen: Specifies path length; identical to<br />

dlpdfcontentpath oper<strong>and</strong><br />

• int EOClip: Should be FALSE (0) for a normal clip <strong>and</strong><br />

TRUE (1) for an even/odd clip.<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfcontentclipend,<br />

dlpdfcontentpath<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 Clipping paths are not established automatically for images, forms, or line drawings. Generally, PDF<br />

images page more efficiently if there is no clipping involved.<br />

2 A clipping region is considered a part of the content structure, <strong>and</strong> will be ended at the end of a<br />

content structure. Clipping regions may be nested, but each nested region must fit within the previous<br />

region. A clipping region can <strong>and</strong> should be ended as soon as possible, using the<br />

dlpdfcontentclipend call.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.7<br />

dlpdfcontentclipend (DLPDFCONTENT *Content)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

This call is used to manually end a clipping region prior to the<br />

end of the content structure. It should be called as soon as possible<br />

after a clipping region is established.<br />

DLPDFCONTENT *Content: Represents the content element.<br />

These structures are destroyed when associated with a page or<br />

form, <strong>and</strong> pointers to them should not be used after that time.<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfcontentclip<br />

All <strong>DLI</strong>-supported platforms.


A.8 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfcontentcomment (DLPDFCONTENT *Content,<br />

char *Comment)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

This method will insert the specified text string as a comment, in<br />

the order provided, into the content elements.<br />

• DLPDFCONTENT *Content: Represents the content<br />

element. These structures are destroyed when associated<br />

with a page or form, <strong>and</strong> pointers to them should not be<br />

used after that time.<br />

• char *Comment: A text string<br />

void<br />

Exceptions<br />

Header<br />

dli.h<br />

Related Methods<br />

Availability<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 The comment string will always be placed on a separate line, beginning with a percent sign (“%”)<br />

provided by <strong>DLI</strong> to mark it as a comment.<br />

2 The comment text must not contain a new line character, unless you provide a percent sign<br />

immediately following it. (<strong>DLI</strong> provides only the initial percent sign for each comment. Follow-on<br />

new lines within the comment text must contain their own starting percent sign for each comment line<br />

of output.)<br />

3 The content element must be valid: the comment pointer must point at a valid non-NULL, non-zero<br />

length string.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.9<br />

dlpdfcontentcreate (DLPDFDOC *Doc)<br />

Return Value: DLPDFCONTENT*<br />

Description<br />

Parameters<br />

Return Value<br />

Creates a new content element with a rotation of zero degrees,<br />

a position of (0,0) <strong>and</strong> scaling of (1,1).<br />

DLPDFDOC *Doc: represents the document structure <strong>and</strong> the<br />

current status of the document at all times.<br />

DLPDFCONTENT*<br />

Exceptions<br />

Header<br />

dli.h<br />

Related Methods<br />

Availability<br />

All <strong>DLI</strong>-supported platforms.


A.10 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfcontentellipse (DLPDFCONTENT *Content,<br />

PDEGraphicState *gState, int PaintOp, ASFixed X, ASFixed Y,<br />

ASFixed RadiusH, ASFixed RadiusV)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

This procedure is included as an aid in transitioning from Post-<br />

Script to PDF. It will draw an ellipse centered at (X,Y), at a vertical<br />

radius of RadiusV, <strong>and</strong> a horizontal radius of RadiusH.<br />

• DLPDFCONTENT *Content: Represents the content<br />

element. These structures are destroyed when associated<br />

with a page or form, <strong>and</strong> pointers to them should not be<br />

used after that time.<br />

• PDEGraphicState *gState: Contains definitions of<br />

colors to be applied, <strong>and</strong> line sizes <strong>and</strong> parameters to be used<br />

when drawing a path.<br />

• int PaintOp: A composite of flags which define how the<br />

text will be displayed. It is set by performing a bitwise OR with<br />

the desired combination of the Adobe PDF Library flag values<br />

kPDEFill, kPDEStroke, kPDEEoFill <strong>and</strong><br />

kPDEInvisible.<br />

• ASFixed X<br />

• ASFixed Y<br />

• ASFixed RadiusH<br />

• ASFixed RadiusV<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfcontentcircle<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.11<br />

dlpdfcontentfontskew (DLPDFCONTENT *Content,<br />

ASFixedMatrix *Matrix)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Causes the font currently in effect for this content structure to<br />

appear "twisted" according to the matrix supplied.<br />

• DLPDFCONTENT *Content: Represents the content<br />

element. These structures are destroyed when associated<br />

with a page or form, <strong>and</strong> pointers to them should not be<br />

used after that time.<br />

• ASFixedMatrix *Matrix<br />

void<br />

Exceptions<br />

Header<br />

dli.h<br />

Related Methods<br />

Availability<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 This may be used to simulate an italic or reverse-italic font using a Roman font.


A.12 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfcontentgstate (DLPDFCONTENT *Content,<br />

const PDEGraphicState *newGState)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Sets the graphics state of the specified DLPDFCONTENT to that<br />

of the PDEGraphicState. This may be done at any point during<br />

content placement operations.<br />

• DLPDFCONTENT* Content: Represents the document<br />

structure <strong>and</strong> the current status of the document at all times.<br />

• const PDEGraphicState *newGState<br />

void<br />

Exceptions<br />

Header<br />

dli.h<br />

Related Methods<br />

Availability<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.13<br />

dlpdfcontentline (DLPDFCONTENT *Content, PDEGraphicState<br />

*gState, int PaintOp, ASFixed X1, ASFixed Y1, ASFixed X2, ASFixed Y2)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

This procedure will mark a line in the content, extending from<br />

(X1,Y1) to (X2,Y2).<br />

• DLPDFCONTENT *Content: Represents the content<br />

element. These structures are destroyed when associated<br />

with a page or form, <strong>and</strong> pointers to them should not be<br />

used after that time.<br />

• PDEGraphicState *gState: Contains definitions of<br />

colors to be applied, <strong>and</strong> line sizes <strong>and</strong> parameters to be used<br />

when drawing a path.<br />

• int PaintOp: A composite of flags which define how the<br />

text will be displayed. It is set by performing a bitwise OR with<br />

the desired combination of the Adobe PDF Library flag values<br />

kPDEFill, kPDEStroke, kPDEEoFill <strong>and</strong><br />

kPDEInvisible.<br />

• ASFixed X1: Start X-axis coordinate<br />

• ASFixed Y1: Start Y-axis coordinate<br />

• ASFixed X2: End X-axis coordinate<br />

• ASFixed Y2: End Y-axis coordinate<br />

void<br />

Exceptions<br />

Header<br />

dli.h<br />

Related Methods<br />

Availability<br />

All <strong>DLI</strong>-supported platforms.


A.14 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfcontentpath (DLPDFCONTENT *Content,<br />

PDEGraphicState *gState, int PaintOp, ASFixed *Path, int PathLen)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

This procedure will mark a path within the content.<br />

• DLPDFCONTENT *Content: Represents the content<br />

element. These structures are destroyed when associated<br />

with a page or form, <strong>and</strong> pointers to them should not be<br />

used after that time.<br />

• PDEGraphicState *gState<br />

• int PaintOp: A composite of flags which define how the<br />

text will be displayed. It is set by performing a bitwise OR with<br />

the desired combination of the Adobe PDF Library flag values<br />

kPDEFill, kPDEStroke, kPDEEoFill <strong>and</strong><br />

kPDEInvisible.<br />

• ASFixed *Path: Specifies path<br />

• int PathLen: Specifies path length<br />

void<br />

Exceptions<br />

Header<br />

dli.h<br />

Related Methods<br />

Availability<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 This is in all ways the same path as would be used by the Adobe PDF Library path operators. Such a<br />

path may be created manually or by use of the Edit Layer of the Adobe PDF Library.<br />

2 If created with the Adobe PDF Library, the pointer returned by PDEPathGetData is sufficient for<br />

this call. The length returned by that call must be the number of entries in the list, not the size in bytes<br />

of the list.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.15<br />

dlpdfcontentpieslice (DLPDFCONTENT *Content,<br />

PDEGraphicState *gState, int PaintOp, ASFixed X1, ASFixed Y1,<br />

ASFixed Radius, ASFixed Angle1, ASFixed Angle2)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

This procedure is included as an aid in graph construction. It will<br />

draw a pie slice, centered at (X1,Y1), at a radius of Radius,<br />

from Angle1 to Angle2, counter-clockwise, where the angles<br />

are specified in degrees.<br />

• DLPDFCONTENT *Content: Represents the content<br />

element. These structures are destroyed when associated<br />

with a page or form, <strong>and</strong> pointers to them should not be<br />

used after that time.<br />

• PDEGraphicState *gState: Contains definitions of<br />

colors to be applied, <strong>and</strong> line sizes <strong>and</strong> parameters to be used<br />

when drawing a path.<br />

• int PaintOp: A composite of flags which define how the<br />

text will be displayed. It is set by performing a bitwise OR with<br />

the desired combination of the Adobe PDF Library flag values<br />

kPDEFill, kPDEStroke, kPDEEoFill <strong>and</strong><br />

kPDEInvisible.<br />

• ASFixed X1<br />

• ASFixed Y1<br />

• ASFixed Radius<br />

• ASFixed Angle1<br />

• ASFixed Angle2<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfcontentpieslicen<br />

All <strong>DLI</strong>-supported platforms.


A.16 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfcontentpieslicen (DLPDFCONTENT *Content,<br />

PDEGraphicState *gState, int PaintOp, ASFixed X1, ASFixed Y1,<br />

ASFixed Radius, ASFixed Angle1, ASFixed Angle2)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

This procedure is included as an aid in graph construction. It will<br />

draw a pie slice, centered at (X1,Y1), at a radius of Radius,<br />

from Angle1 to Angle2, clockwise, where the angle is specified<br />

in degrees.<br />

• DLPDFCONTENT *Content: Represents the content<br />

element. These structures are destroyed when associated<br />

with a page or form, <strong>and</strong> pointers to them should not be<br />

used after that time.<br />

• PDEGraphicState *gState: Contains definitions of<br />

colors to be applied, <strong>and</strong> line sizes <strong>and</strong> parameters to be used<br />

when drawing a path.<br />

• int PaintOp: A composite of flags which define how the<br />

text will be displayed. It is set by performing a bitwise OR with<br />

the desired combination of the Adobe PDF Library flag values<br />

kPDEFill, kPDEStroke, kPDEEoFill <strong>and</strong><br />

kPDEInvisible.<br />

• ASFixed X1<br />

• ASFixed Y1<br />

• ASFixed Radius<br />

• ASFixed Angle1<br />

• ASFixed Angle2<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfcontentpieslice<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.17<br />

dlpdfcontentrect (DLPDFCONTENT *Content,<br />

PDEGraphicState *gState, int PaintOp, ASFixed X, ASFixed Y,<br />

ASFixed Width, ASFixed Height)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

This procedure marks a rectangle in the content. It will be<br />

located such that its lower left h<strong>and</strong> corner is at (X,Y).<br />

• DLPDFCONTENT *Content: Represents the content<br />

element. These structures are destroyed when associated<br />

with a page or form, <strong>and</strong> pointers to them should not be<br />

used after that time.<br />

• PDEGraphicState *gState: Contains definitions of<br />

colors to be applied, <strong>and</strong> line sizes <strong>and</strong> parameters to be used<br />

when drawing a path.<br />

• int PaintOp: A composite of flags which define how the<br />

text will be displayed. It is set by performing a bitwise OR with<br />

the desired combination of the Adobe PDF Library flag values<br />

kPDEFill, kPDEStroke, kPDEEoFill <strong>and</strong><br />

kPDEInvisible.<br />

• ASFixed X: The X location of the rectangle.<br />

• ASFixed Y: The Y location of the rectangle.<br />

• ASFixed Width: The width of the rectangle. This may not<br />

be specified as zero, but may be specified as a negative value,<br />

which results in flopping the rectangle (i.e. right instead of<br />

left).<br />

• ASFixed Height: The height of the rectangle. This may<br />

not be specified as zero, but may be specified as a negative<br />

value, which results in flopping the rectangle (i.e. down<br />

instead of up).<br />

void<br />

Exceptions<br />

Header<br />

Availability<br />

dli.h<br />

All <strong>DLI</strong>-supported platforms.


A.18 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfcontentreferenceform (DLPDFCONTENT *Content,<br />

DLPDFFORM *Form, ASFixed X, ASFixed Y, ASFixed Rotate,<br />

ASFixed ScaleX, ASFixed ScaleY)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Places a reference to the specified DLPDFFORM into the specified<br />

content structure, with the lower left corner of the form<br />

positioned at (X,Y), <strong>and</strong> with the specified rotation <strong>and</strong> scaling<br />

factors.<br />

• DLPDFCONTENT *Content: Represents the content<br />

element. These structures are destroyed when associated<br />

with a page or form, <strong>and</strong> pointers to them should not be<br />

used after that time.<br />

• DLPDFFORM *Form<br />

• ASFixed X: X coordinate for Form placement<br />

• ASFixed Y: Y coordinate for Form placement.<br />

• ASFixed Rotate: Degrees to rotate the form<br />

counterclockwise<br />

• ASFixed ScaleX: X-axis Scale Factor. “No scaling” is<br />

represented by the value 1.<br />

• ASFixed ScaleY: Y-axis Scale Factor. “No scaling” is<br />

represented by the value 1.<br />

void<br />

Exceptions<br />

Header<br />

dli.h<br />

Related Methods<br />

Availability<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.19<br />

dlpdfcontentreferenceimage (DLPDFCONTENT *Content,<br />

DLPDFIMAGE *Image, ASFixed X, ASFixed Y, ASFixed Rotate,<br />

ASFixed ScaleX, ASFixed ScaleY)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

This procedure places a copy of the referenced image into the<br />

current content.<br />

• DLPDFCONTENT *Content: Represents the content<br />

element. These structures are destroyed when associated<br />

with a page or form, <strong>and</strong> pointers to them should not be<br />

used after that time.<br />

• DLPDFIMAGE *Image<br />

• ASFixed X: The X-axis location of the rotation point<br />

• ASFixed Y: The Y-axis location of the rotation point<br />

• ASFixed Rotate: Amount of counterclockwise rotation in<br />

degrees<br />

• ASFixed ScaleX: X-axis Scale Factor<br />

• ASFixed ScaleY: Y-axis Scale Factor<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfimagegetsize (New in <strong>DLI</strong> v2.2.5)<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 The image will be placed so as to align its lower left h<strong>and</strong> corner with the given (X,Y) location, scaled<br />

as per ScaleX <strong>and</strong> ScaleY, <strong>and</strong> rotated as per Rotate.<br />

2 Image rotation, if any, always occurs about its origin, typically the lower-left corner of the image, <strong>and</strong><br />

the point of rotation is located by the given (X,Y) location.<br />

3 The Scale Factors will determine the resulting size of the image. You need to know the original image<br />

resolution <strong>and</strong> its intended size in order to determine whether a Scale Factor on either axis is required.<br />

In <strong>DLI</strong> v2.2.5 or higher, the dlpdfimagegetsize method can retrieve image sizing data for you,<br />

<strong>and</strong> dividing the intended print size by the file size for each dimension (delivered by<br />

dlpdfimagegetsize) will yield a Scale Factor ratio which dlpdfcontentreferenceimage uses<br />

to calculate the final output image size.<br />

4 The typical scaling calculation using values returned by dlpdfimagegetsize would be to divide the<br />

intended print size by the image size on each axis (e.g.<br />

"dlpdfcontentreferenceimage(Content, Image, Int32ToFixed(72),


A.20 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Int32ToFixed(92), 0, ASFixedDiv(xPoints,Int32ToFixed(xRasters)),<br />

ASFixedDiv(yPoints,Int32ToFixed(yRasters)));").<br />

5 An image in which each pixel of each raster line represents one PDF unit of output will return the same<br />

values for both image dimension (xRasters <strong>and</strong> yRasters) <strong>and</strong> print size (xPoints <strong>and</strong><br />

yPoints), <strong>and</strong> thus a Scale Factor of 1 on both axes.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.21<br />

dlpdfcontentrotate (DLPDFCONTENT *Content, ASFixed Rotate)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Rotates all of the contents of a given content structure by the<br />

specified amount.<br />

• DLPDFCONTENT *Content: Represents the content<br />

element. These structures are destroyed when associated<br />

with a page or form, <strong>and</strong> pointers to them should not be<br />

used after that time.<br />

• ASFixed Rotate: May be any amount, but will be reduced<br />

to between 0 <strong>and</strong> 360 degrees. Considered to be in degrees<br />

of counterclockwise rotation about the content structure’s<br />

lower left corner.<br />

void<br />

Exceptions<br />

Header<br />

dli.h<br />

Related Methods<br />

Availability


A.22 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfcontentscale (DLPDFCONTENT *Content, ASFixed XScale,<br />

ASFixed YScale)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Scales all of the content of a given content structure by the<br />

specified amount.<br />

• DLPDFCONTENT *Content: Represents the content<br />

element. These structures are destroyed when associated<br />

with a page or form, <strong>and</strong> pointers to them should not be<br />

used after that time.<br />

• ASFixed XScale: X-axis scale factor, a positive number<br />

greater than 0.0001.<br />

• ASFixed YScale: Y-axis scale factor, a positive number<br />

greater than 0.0001.<br />

void<br />

Exceptions<br />

Header<br />

dli.h<br />

Related Methods<br />

Availability<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.23<br />

dlpdfcontenttext (DLPDFCONTENT *Content, DLPDFFONT *Font,<br />

char *str, PDEGraphicState *gState, PDETextState *tState,<br />

ASFixed pointSize, ASFixed setWidth, ASFixed XPos, ASFixed YPos,<br />

ASFixed Rotate)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Parameters (Continued)<br />

Return Value<br />

Adds a NULL-terminated string of text to the content. It will be<br />

placed such that the baseline of the left edge of the first character<br />

aligns to the position (XPos,YPos) in points.<br />

• DLPDFCONTENT *Content: Represents the content<br />

element. These structures are destroyed when associated<br />

with a page or form, <strong>and</strong> pointers to them should not be<br />

used after that time.<br />

• DLPDFFONT *Font: Reflects the font. It is created by<br />

dlpdffontcreate on a per-document basis, <strong>and</strong> may<br />

only be used within the document it was created in. Fonts are<br />

tracked within the document <strong>and</strong> destroyed when the<br />

document is destroyed. Pointers to fonts are invalid after the<br />

destruction of their document.<br />

• char *str: Text string<br />

• PDEGraphicState *gState: Contains definitions of<br />

colors to be applied, <strong>and</strong> line sizes <strong>and</strong> parameters to be used<br />

when drawing a path.<br />

• PDETextState *tState: The current text state. This<br />

should not be NULL. A zero-filled PDETextState<br />

parameter is permitted.<br />

• ASFixed pointSize: Point size<br />

• ASFixed setWidth: Set width<br />

• ASFixed XPos: Position along the X axis where the<br />

baseline of the left edge of the first character will be aligned.<br />

• ASFixed YPos: Position along the Y axis where the<br />

baseline of the left edge of the first character will be aligned.<br />

• ASFixed Rotate: Angle at which the baseline should<br />

proceed, where zero is to the right <strong>and</strong> positive numbers<br />

express counterclockwise rotation in degrees.<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfcontenttextwidth,<br />

dlpdfcontentwidetext,<br />

dlpdfcontentwidetextwidth<br />

All <strong>DLI</strong>-supported platforms.


A.24 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfcontenttextwidth (DLPDFFONT *Font, char *Text,<br />

ASFixed SetWidth, PDETextState *TState)<br />

Return Value: ASFixed<br />

Description<br />

Parameters<br />

Return Value<br />

Returns the width (in points) of the specified Text set in the<br />

specified Font with the specified SetWidth. The fourth parameter<br />

is an optional Current Text State, which may be NULL.<br />

• DLPDFFONT *Font: The specified font<br />

• char *Text: The specified text<br />

• ASFixed SetWidth: The specified width<br />

• PDETextState *TState: The current text state. This may<br />

be NULL. A zero-filled PDETextState parameter is also<br />

permitted.<br />

ASFixed<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfcontenttext,<br />

dlpdfcontentwidetext,<br />

dlpdfcontentwidetextwidth<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.25<br />

dlpdfcontenttopage (DLPDFCONTENT *Content,<br />

DLPDFPAGE *Page)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

This procedure will make the markings placed into content a<br />

part of the specified page. Following this call, the content structure<br />

no longer exists; pointers to it are invalid <strong>and</strong> should not be<br />

used.<br />

• DLPDFCONTENT *Content: Represents the content<br />

element. This structure is destroyed when associated with a<br />

page or form, <strong>and</strong> pointers to them should not be used after<br />

that time.<br />

• DLPDFPAGE *Page: Represents a page. This structure is<br />

tracked within the package <strong>and</strong> destroyed when the<br />

document is destroyed. Pointers to this structure remain valid<br />

until the document is destroyed.<br />

void<br />

Exceptions<br />

Header<br />

dli.h<br />

Related Methods<br />

Availability<br />

All <strong>DLI</strong>-supported platforms.


A.26 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfcontenttranslate (DLPDFCONTENT *Content, ASFixed X,<br />

ASFixed Y)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Moves all the contents of a content structure by the specified<br />

amounts.<br />

• DLPDFCONTENT *Content: Represents the content<br />

element. These structures are destroyed when associated<br />

with a page or form, <strong>and</strong> pointers to them should not be<br />

used after that time.<br />

• ASFixed X: The X-axis amount by which content structure<br />

will be moved, in points. Positive X values move right;<br />

negative X values move left.<br />

• ASFixed Y: The Y-axis amount by which content structure<br />

will be moved, in points. Positive Y values move up; negative<br />

Y values move down.<br />

void<br />

Exceptions<br />

Header<br />

dli.h<br />

Related Methods<br />

Availability<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.27<br />

dlpdfcontentusefillpattern (DLPDFCONTENT *Content,<br />

DLPDFPATTERN *Pattern)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Applies the fill pattern.<br />

• DLPDFCONTENT *Content: Represents the content<br />

element. These structures are destroyed when associated<br />

with a page or form, <strong>and</strong> pointers to them should not be<br />

used after that time.<br />

• DLPDFPATTERN *Pattern: If this is NULL, the patterned<br />

color space will be turned Off.<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfpatterncreate,<br />

dlpdfcontentusestrokepattern<br />

All <strong>DLI</strong>-supported platforms.


A.28 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfcontentusestrokepattern (DLPDFCONTENT *Content,<br />

DLPDFPATTERN *Pattern)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Similar to dlpdfcontentusefillpattern, but strokes<br />

instead of filling.<br />

• DLPDFCONTENT *Content: Represents the content<br />

element. These structures are destroyed when associated<br />

with a page or form, <strong>and</strong> pointers to them should not be<br />

used after that time.<br />

• DLPDFPATTERN *Pattern<br />

Return Value<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfcontentusefillpattern<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.29<br />

dlpdfcontentwidetext (DLPDFCONTENT *Content, DLPDFFONT<br />

*Font, char *str, int Length, PDEGraphicState *gState, PDETextState<br />

*tState, ASFixed PS, ASFixed SW, ASFixed X, ASFixed Y, ASFixed Rotate)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Same as dlpdfcontenttext, but permits Unicode <strong>and</strong><br />

MultiByte text.<br />

• DLPDFCONTENT *Content: Represents the content<br />

element. These structures are destroyed when associated<br />

with a page or form, <strong>and</strong> pointers to them should not be<br />

used after that time.<br />

• DLPDFFONT *Font<br />

• char *str: A text string<br />

• int Length<br />

• PDEGraphicState *gState: Contains definitions of<br />

colors to be applied, <strong>and</strong> line sizes <strong>and</strong> parameters to be used<br />

when drawing a path.<br />

• PDETextState *tState: The current text state. This may<br />

be NULL. A zero-filled PDETextState parameter is also<br />

permitted.<br />

• ASFixed PS: Point Size scale factor along the Y axis<br />

(vertical). 1 = no scaling (2 = double the original size, 0.5 =<br />

½ the original size, etc...)<br />

• ASFixed SW: Set Width scale factor along the X axis<br />

(horizontal). 1 = no scaling.<br />

• ASFixed X: X coordinate of the lower left corner of the<br />

bounding box for the text<br />

• ASFixed Y: Y coordinate of the lower left corner of the<br />

bounding box for the text<br />

• ASFixed Rotate: Angle of rotation. 0 = no rotation.<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfcontenttext,<br />

dlpdfcontenttextwidth,<br />

dlpdfcontentwidetextwidth<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 Double-byte NULL values acting as Unicode string terminators are not required, <strong>and</strong>, if present, are not<br />

included in any Unicode string length calculations.


A.30 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfcontentwidetextwidth (DLPDFFONT *Font, char<br />

*string, int Length, ASFixed SetWidth, PDETextState *TState,<br />

PDEGraphicState *GState)<br />

Return Value: ASFixed<br />

Description<br />

Parameters<br />

Return Value<br />

Same as dlpdfcontenttextwidth, but permits multi-byte<br />

(Unicode) text.<br />

• DLPDFFONT *Font<br />

• char *string<br />

• int Length<br />

• ASFixed SetWidth<br />

• PDETextState *TState: The current text state. This<br />

should not be NULL. A zero-filled PDETextState<br />

parameter is permitted.<br />

• PDEGraphicState *GState: Contains definitions of<br />

colors to be applied, <strong>and</strong> line sizes <strong>and</strong> parameters to be used<br />

when drawing a path.<br />

ASFixed<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfcontenttext,<br />

dlpdfcontenttextwidth,<br />

dlpdfcontentwidetext<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 Double-byte NULL values acting as Unicode string terminators are not required, <strong>and</strong>, if present, are not<br />

included in any Unicode string length calculations.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.31<br />

dlpdfdocasciips (DLPDFDOC *Doc)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

This method supports creation of PostScript output suitable for<br />

transmission through channels <strong>and</strong> to devices which do not<br />

accept binary data. Most PostScript printers cannot properly<br />

process binary PostScript input, although Distiller <strong>and</strong> most print<br />

spoolers will accept binary PostScript data.<br />

DLPDFDOC *Doc: Represents the document structure <strong>and</strong> the<br />

current status of the document at all times.<br />

void<br />

Exceptions<br />

Header<br />

dli.h<br />

Related Methods<br />

Availability<br />

All <strong>DLI</strong>-supported platforms.


A.32 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfdoccomplete (DLPDFDOC *Doc)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Completes the page tree for a document <strong>and</strong> creates specified<br />

thumbnails. It is called internally by dlpdfdocwritepdf <strong>and</strong><br />

dlpdfdocwritePS, <strong>and</strong> may be manually called to write the<br />

document using other interface elements (e.g. writing to a custom<br />

file system), or as a method of imaging pages prior to writing<br />

the document.<br />

DLPDFDOC *Doc: Represents the document structure <strong>and</strong> the<br />

current status of the document at all times.<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfdocwritepdf,<br />

dlpdfdocwritePS<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.33<br />

dlpdfdoccompress (DLPDFDOC *Doc)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Turns compression On (by default, it is Off) for text streams used<br />

within the PDF document. When on, Flate compression will be<br />

used on all textual content, images <strong>and</strong> forms. This method<br />

should be called before any content is placed onto a page. Content<br />

placed prior to this call will not be compressed.<br />

DLPDFDOC *Doc: Represents the document structure <strong>and</strong> the<br />

current status of the document at all times.<br />

void<br />

Exceptions<br />

Header<br />

dli.h<br />

Related Methods<br />

Availability<br />

All <strong>DLI</strong>-supported platforms.


A.34 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfdoccosdoc (DLPDFDOC *Doc)<br />

Return Value: CosDoc<br />

Description<br />

Parameters<br />

Return Value<br />

Used with the COS layer of the Adobe PDF Library to accomplish<br />

functions outside <strong>DLI</strong>.<br />

DLPDFDOC *Doc: Represents the document structure <strong>and</strong> the<br />

current status of the document at all times.<br />

CosDoc: Reflects the constructed document<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfdocpddoc,<br />

dlpdfdoccomplete<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 The COS form of the document must not be used in any way that accesses pages prior to writing the<br />

document or calling dlpdfdoccomplete. Prior to those calls, the page tree is not complete.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.35<br />

dlpdfdoccreate (DLPDFINSTANCE *instance)<br />

Return Value: DLPDFDOC *<br />

Description<br />

Parameters<br />

Creates a new, empty document.<br />

DLPDFINSTANCE *instance: The DLPDFINSTANCE to use<br />

for the document<br />

Return Value DLPDFDOC *<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

genErrBadParam<br />

dli.h<br />

dlpdfdocdestroy,<br />

dlpdfdocsetpsname,<br />

dlpdfdocwritePS (See Technical Notes below)<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 Processing is much faster if the Adobe PDF Library is not invoked; however, the Library must be<br />

invoked if PDF <strong>and</strong> PostScript are to be created.<br />

2 See the Adobe API <strong>Reference</strong> <strong>Guide</strong> for information on Adobe PostScript support.<br />

3 As of <strong>DLI</strong> v3.0, this call no longer accepts a PostScript filename. (Use dlpdfdocsetpsname, or<br />

supply one to dlpdfdocwritePS.) The PDFNeeded flag has been removed; PDF processing is<br />

always performed.


A.36 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfdoccreatesignature (DLPDFDOC *Doc,<br />

dlpdfsigh<strong>and</strong>ler sigType, char *nameStr, char *reasonStr,<br />

char *locationStr)<br />

Return Value: DLPDFSIGNATURE *<br />

Description<br />

Parameters<br />

This call creates a digital signature object for the <strong>DLI</strong> document<br />

being created.<br />

• DLPDFDOC *Doc: The document for which the signature<br />

object will be created<br />

• dlpdfsigh<strong>and</strong>ler sigType: The signature type, one of<br />

dlpdfsigacrox509, dlpdfsigacropkcs7 or<br />

dlpdfsigverisign; see Technical Notes below.<br />

• char *nameStr: (Optional) Signatory Name<br />

• char *reasonStr: (Optional) Reason for signing (e.g.<br />

Initial Release; Document Revision)<br />

• char *locationStr: (Optional) Location of the signatory<br />

Return Value DLPDFSIGNATURE *<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfdocsetsignatureappearance<br />

dlpdfpageplacesignature<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 The sigType is one of:<br />

• dlpdfsigacrox509 (Adobe self-sign plug-in compatible with an x.509 v3 certificate)<br />

• dlpdfsigacropkcs7 (Adobe self-sign plug-in compatible with a PKCS #7 certificate)<br />

• dlpdfsigverisign (VeriSign signature plug-in compatible with a PKCS #7 certificate)


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.37<br />

dlpdfdocdestroy (DLPDFDOC *Doc)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Destroys the specified document, releasing all resources used in<br />

the document.<br />

DLPDFDOC *Doc: represents the document structure <strong>and</strong> the<br />

current status of the document at all times.<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfdoccreate,<br />

dlpdfinstancesetgrcachelimits<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 All documents should be destroyed before terminating <strong>DLI</strong>.<br />

2 A pointer to a DLPDFDOC structure is invalid <strong>and</strong> should not be used after calling dlpdfdocdestroy<br />

for that structure.<br />

3 The collection of information regarding where elements lie within a document is the responsibility of<br />

the composition engine. <strong>DLI</strong> cannot provide assistance with this.<br />

4 If dlpdfinstancesetgrcachelimits had been set previously, the graphics cache size is evaluated<br />

at this time, <strong>and</strong> graphics are purged if the cache size exceeds its preset high-water mark limit.<br />

5 If applicable, dlpdfdocdestroy removes the Files In Memory file representing the <strong>DLI</strong> document if<br />

no h<strong>and</strong>le has been acquired to the file in memory.


A.38 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfdocembedfonts (DLPDFDOC *Doc)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

This call will set the input document to embed <strong>and</strong> subset all<br />

fonts which are present on the system when created, regardless<br />

of the font call used to create them. Fonts created with dlpdffontcreateembedded<br />

or dlpdffontcreatewithmetricsembedded<br />

with the Subset parameter set to<br />

FALSE will be fully embedded after calling this function (license<br />

permitting; see Technical Notes below).<br />

DLPDFDOC *Doc: The document for which to embed all fonts<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdffontcreateembedded,<br />

dlpdffontcreatewithmetricsembedded<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 If a font is available but not licensed for embedding, it will be created as a referenced font rather than<br />

an embedded font. An exception is not returned for this condition, but the NotEmbedded flag of the<br />

DLPDFFONT structure can be inspected after the dlpdfdocembedfonts call, if desired.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.39<br />

dlpdfdocencrypt (DLPDFDOC *Doc, char *UserPW,<br />

char *OwnerPW, PDPerms Permissions)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Applies the Adobe PDF Library st<strong>and</strong>ard security mechanism to<br />

the document, using the permissions specified in the Permissions<br />

parameter as outlined in the Acrobat Core API <strong>Reference</strong><br />

Manual in the PDPerms definition on page 2101.<br />

• DLPDFDOC *Doc: Represents the document structure <strong>and</strong><br />

the current status of the document at all times.<br />

• char *UserPW: (Case sensitive) string for User Password<br />

• char *OwnerPW: (Case sensitive) string for Owner Password<br />

• PDPerm Permissions<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfdocsetencryptkeylen<br />

Adobe PDF Library v4.05 <strong>and</strong> higher; all <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 Both Owner Password <strong>and</strong> User Password are case-sensitive. Either password will allow viewing of the<br />

document, but only the Owner can modify its Security settings.<br />

2 This call may be made at any time prior to dlpdfdocwritepdf.


A.40 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfdoclinearize (DLPDFDOC *Doc)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Instructs <strong>DLI</strong> to linearize any PDF output created from this document,<br />

regardless of the setting of the linearization flag used at<br />

document output time.<br />

DLPDFDOC *Doc: Represents the document structure <strong>and</strong> the<br />

current status of the document at all times.<br />

void<br />

Exceptions<br />

Header<br />

dli.h<br />

Related Methods<br />

Availability<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 This is included in support of document processing systems which know the desired result of<br />

document creation at the start of document processing, but which may not retain that knowledge until<br />

the end of processing.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.41<br />

dlpdfdocmakethumbnails (DLPDFDOC *Doc)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Instructs the application to create thumbnail page images. These<br />

will be added to all pages when the file is written to PDF.<br />

DLPDFDOC *Doc: Represents the document structure <strong>and</strong> the<br />

current status of the document at all times.<br />

void<br />

Exceptions<br />

Header<br />

dli.h<br />

Related Methods<br />

Availability<br />

Adobe PDF Library v4.05 <strong>and</strong> later; all <strong>DLI</strong>-supported platforms.


A.42 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfdocnameadd (DLPDFDOC *Doc, char *TreeName, char<br />

*Name, CosObj Dest)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Adds a new name <strong>and</strong> an associated destination (as a COS<br />

structure) to the name tree, which will be named as defined in<br />

TreeName. “Dests” is the default TreeName value, which is<br />

assumed if NULL is used.<br />

• DLPDFDOC *Doc: Represents the document structure <strong>and</strong><br />

the current status of the document at all times.<br />

• char *TreeName: TreeName string, or NULL for default<br />

TreeName.<br />

• char *Name: Name string<br />

• CosObj Dest<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfdocnamefind<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.43<br />

dlpdfdocnamefind (DLPDFDOC *Doc, char *TreeName, char<br />

*Name,)<br />

Return Value: CosObj<br />

Description<br />

Parameters<br />

Return Value<br />

Locates a name in the tree, <strong>and</strong> returns its associated COS structure.<br />

• DLPDFDOC *Doc: Represents the document structure <strong>and</strong><br />

the current status of the document at all times.<br />

• char *TreeName: TreeName string, or NULL for default<br />

TreeName<br />

• char *Name: Name string<br />

CosObj<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfdocnameadd<br />

All <strong>DLI</strong>-supported platforms.


A.44 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfdocoutline (DLPDFDOC *Doc)<br />

Return Value: DLPDFOUTLINE*<br />

Description<br />

Parameters<br />

Return Value<br />

Returns a pointer to the root outline node. This node contains<br />

no text; it is used simply as a container for nodes at the root<br />

layer. If there are no outlines, this pointer will be NULL.<br />

DLPDFDOC *Doc: Represents the document structure <strong>and</strong> the<br />

current status of the document at all times.<br />

DLPDFOUTLINE*<br />

Exceptions<br />

Header<br />

dli.h<br />

Related Methods<br />

Availability<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.45<br />

dlpdfdocoutlineadd (DLPDFDOC *Doc, DLPDFOUTLINE *Parent,<br />

DLPDFOUTLINE *Before, char *Text, int Open, long PageNumber, char<br />

*Fit, ASFixedRect *Where, ASFixed Zoom)<br />

Return Value: DLPDFOUTLINE*<br />

Description<br />

Parameters<br />

Return Value<br />

Creates an outline structure within the document specified.<br />

• DLPDFDOC *Doc: Specifies the document in which the new<br />

outline will reside<br />

• DLPDFOUTLINE *Parent: If specified, the new outline<br />

structure will be contained within the parent. If not specified,<br />

the new outline structure will be placed within the root node.<br />

• DLPDFOUTLINE *Before: If specified, the new outline<br />

entry will be positioned directly after the previous outline<br />

entry given. If not specified, the new entry will be created as<br />

the last within the parent or root.<br />

• char *Text: Text that will appear in the displayed outline<br />

<strong>and</strong> which must be specified<br />

• int Open: A Boolean operator: if TRUE, the entry will be<br />

open <strong>and</strong> its children will be displayed; if FALSE, it will be<br />

closed.<br />

• long PageNumber: The zero-relative number of the page<br />

to which this link connects<br />

• char *Fit: valid PDF fit type expressed as a string.<br />

• ASFixedRect *Where: location of the rectangle to be<br />

displayed. Only portions are used, based on the Fit Type<br />

specified in Fit.<br />

• ASFixed Zoom: factor by which the size of the display<br />

should be increased or decreased.<br />

DLPDFOUTLINE*: Internal structure that reflects the outline<br />

entry<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfdocoutlineaddfromname,<br />

dlpdfdocoutlinecosobj,<br />

dlpdfdocoutlinefirst,<br />

dlpdfdocoutlinelast,<br />

dlpdfdocoutlinenext,<br />

dlpdfdocoutlineparent,<br />

dlpdfdocoutlineprev<br />

All <strong>DLI</strong>-supported platforms.


A.46 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Technical Notes<br />

1 Only internal destinations (within the same document) are supported by this method.<br />

2 Valid Fit Type values are “Fit”, “FitH”, “FitV”, “FitBH”, “FitBV”, “FitR”, “FitB”, <strong>and</strong><br />

“XYZ”. See the Adobe PDF Library <strong>Reference</strong> <strong>Guide</strong> for explanations of the meaning of each fit type<br />

<strong>and</strong> which values of rectangle <strong>and</strong> zoom are used for each.<br />

3 If nested outlines are desired, these structures should be saved by the application. They will be<br />

destroyed automatically when the document is destroyed <strong>and</strong> may not be accessed after that time.<br />

Their contents must not be modified, as they are maintained within the package.<br />

4 Zero values in the rectangle will behave as PDViewNull values, as will a zero value for Zoom.<br />

5 The most common values used are XYZ as the fit type, Zero for Zoom, <strong>and</strong> the (X,Y) coordinates of<br />

the upper left h<strong>and</strong> edge of the desired target text in Where.top <strong>and</strong> Where.left. This will change<br />

to the target page <strong>and</strong> position the specified text so it is within the display window, leaving the<br />

Magnification factor where the user last set it.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.47<br />

dlpdfdocoutlineaddfromname (DLPDFDOC *Doc,<br />

DLPDFOUTLINE *Parent, DLPDFOUTLINE *Before, char *Text, int Open,<br />

char *DestName)<br />

Return Value: DLPDFOUTLINE*<br />

Description<br />

Parameters<br />

Return Value<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

Adds a new outline entry using the named destination, rather<br />

than a specified document.<br />

• DLPDFDOC *Doc: Represents the document structure <strong>and</strong><br />

the current status of the document at all times.<br />

• DLPDFOUTLINE *Parent<br />

• DLPDFOUTLINE *Before<br />

• char *Text: Text string<br />

• int Open<br />

• char *DestName: String for destination name<br />

DLPDFOUTLINE*<br />

dlpdfdocoutlineadd,<br />

dlpdfdocoutlinecosobj,<br />

dlpdfdocoutlinefirst,<br />

dlpdfdocoutlinelast,<br />

dlpdfdocoutlinenext,<br />

dlpdfdocoutlineparent,<br />

dlpdfdocoutlineprev<br />

dli.h<br />

dlpdfdocoutlineadd<br />

All <strong>DLI</strong>-supported platforms.


A.48 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfdocoutlinecosobj (DLPDFOUTLINE *Outline)<br />

Return Value: CosObj<br />

Description<br />

Parameters<br />

Return Value<br />

Returns the COS structure that is the outline entry. It may be<br />

modified by the user to accomplish actions other than those<br />

specified by this package.<br />

DLPDFOUTLINE *Outline<br />

CosObj<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfdocoutline<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 Only the Title, Dest, A (Action), or AA (Additional Action) keys should be modified. Modification<br />

of other keys may result in invalid documents.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.49<br />

dlpdfdocoutlinefirst (DLPDFOUTLINE *Outline)<br />

Return Value: DLPDFOUTLINE*<br />

Description<br />

Parameters<br />

Return Value<br />

Returns a pointer to the first child outline of the specified outline<br />

DLPDFOUTLINE *Outline<br />

DLPDFOUTLINE*<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfdocoutlinelast,<br />

dlpdfdocoutlinenext,<br />

dlpdfdocoutlineparent,<br />

dlpdfdocoutlineprev<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 If the specified outline contains no children, this method will return a NULL.


A.50 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfdocoutlinelast (DLPDFOUTLINE *Outline)<br />

Return Value: DLPDFOUTLINE*<br />

Description<br />

Parameters<br />

Return Value<br />

Returns a pointer to the last child outline of a specified outline<br />

node. If the node contains no children, this method will return a<br />

NULL.<br />

DLPDFOUTLINE *Outline<br />

DLPDFOUTLINE*<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfdocoutlinefirst,<br />

dlpdfdocoutlinenext,<br />

dlpdfdocoutlineparent,<br />

dlpdfdocoutlineprev<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.51<br />

dlpdfdocoutlinenext (DLPDFOUTLINE *Outline)<br />

Return Value: DLPDFOUTLINE*<br />

Description<br />

Parameters<br />

Return Value<br />

Returns a pointer to the outline node that follows the specified<br />

node<br />

DLPDFOUTLINE *Outline<br />

DLPDFOUTLINE*<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfdocoutlinefirst,<br />

dlpdfdocoutlinelast,<br />

dlpdfdocoutlineparent,<br />

dlpdfdocoutlineprev<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 If the specified node is the last within its parent, this method will return a NULL.


A.52 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfdocoutlineparent (DLPDFOUTLINE *Outline)<br />

Return Value: DLPDFOUTLINE*<br />

Description<br />

Parameters<br />

Return Value<br />

Returns a pointer to the parent of the specified node<br />

DLPDFOUTLINE *Outline<br />

DLPDFOUTLINE*<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfdocoutlinefirst,<br />

dlpdfdocoutlinelast,<br />

dlpdfdocoutlinenext,<br />

dlpdfdocoutlineprev<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 If this node is the root node, this method will return a NULL.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.53<br />

dlpdfdocoutlineprev (DLPDFOUTLINE *Outline)<br />

Return Value: DLPDFOUTLINE*<br />

Description<br />

Parameters<br />

Return Value<br />

Returns a pointer to the outline node that precedes this node<br />

within its container.<br />

DLPDFOUTLINE *Outline<br />

DLPDFOUTLINE*<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfdocoutlinefirst,<br />

dlpdfdocoutlinelast,<br />

dlpdfdocoutlinenext,<br />

dlpdfdocoutlineparent<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 If this is the first node in the container, this node will return a NULL.


A.54 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfdocpddoc (DLPDFDOC *Doc)<br />

Return Value: PDDoc<br />

Description<br />

Parameters<br />

Return Value<br />

Used with the PD Layer of the Adobe PDF Library to accomplish<br />

functions outside of <strong>DLI</strong>.<br />

DLPDFDOC *Doc represents the document structure <strong>and</strong> the<br />

current status of the document at all times.<br />

PDDoc reflects the constructed document.<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfdoccosdoc<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 The PDDoc must not be used in any way prior to calling dlpdfdocwritepdf, dlpdfdocwritePS<br />

or dlpdfdoccomplete. Prior to those calls, the page tree is not complete.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.55<br />

dlpdfdocsetdocinfo (DLPDFDOC *Doc, ASAtom Field,<br />

char *Value)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Creates or replaces an entry in the document’s DocInfo directory<br />

• DLPDFDOC *Doc: Represents the document structure <strong>and</strong><br />

the current status of the document at all times.<br />

• ASAtom Field: Any name is valid, although only certain<br />

names have meaning to PDF readers<br />

• char *Value: A string, encoded as PDFDocEncoding<br />

values<br />

void<br />

Exceptions<br />

Header<br />

dli.h<br />

Related Methods<br />

Availability<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 This method may be called at any time.


A.56 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfdocsetencoding (DLPDFDOC *Doc, ASAtom Encoding)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Exceptions<br />

Header<br />

Sets the default encoding for fonts used within the document.<br />

• DLPDFDOC *Doc: Represents the document structure <strong>and</strong><br />

the current status of the document at all times.<br />

• ASAtom Encoding: Valid values are ASAtoms containing<br />

“MacRomanEncoding”, “MacExpertEncoding” or<br />

“WinAnsiEncoding”. A NULL ASAtom, as returned by the<br />

ASAtomNull function, is also allowed, meaning<br />

“St<strong>and</strong>ard” encoding<br />

void<br />

genErrBadParam: Raised if any encoding value other than the<br />

values specified above (or a NULL document pointer) is passed<br />

to this function.<br />

dli.h<br />

Related Methods<br />

Availability<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.57<br />

dlpdfdocsetencryptkeylen (DLPDFDOC *Doc, unsigned int<br />

KeyLenBytes)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

Enables variable-length encryption keys as supported by the<br />

Adobe PDF Library.<br />

• DLPDFDOC *Doc: Represents the document structure <strong>and</strong><br />

the current status of the document at all times.<br />

• unsigned int KeyLenBytes: The desired encryption key<br />

length in bytes, from 5 to 15 inclusive<br />

void<br />

This function itself throws no specific exceptions, but the underlying<br />

functions within the Adobe PDF Library may throw exceptions.<br />

dli.h<br />

dlpdfdocencrypt<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 For more information on Encryption, please refer to the beginning of section 3.5 in the Adobe PDF<br />

Specification <strong>Guide</strong>. For information on PDDocSetNewSecurityData <strong>and</strong><br />

StdSecurityDataRec, see the Adobe Core API <strong>Reference</strong> <strong>Guide</strong>.<br />

2 This function can be called to set the length of the encryption key before a call to dlpdfdocencrypt,<br />

if the application requires an encryption key length other than the original 40-bit length of previous<br />

versions.<br />

3 This function is optional if the original 40-bit key length will be used. Subsequent calls to<br />

dlpdfdocencrypt will use the number of bytes specified in the call to<br />

dlpdfdocsetencryptkeylen. If the key length has not been set previously, the st<strong>and</strong>ard 5-byte<br />

value is used as the default.<br />

4 For applications generating multiple documents, dlpdfdocsetencryptkeylen must be called for<br />

each document for which an encryption key length other than the st<strong>and</strong>ard 5-byte value is desired.


A.58 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfdocsetpdfname (DLPDFDOC *Doc, char *Name)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Saves the desired location of a PDF file which results from this<br />

document.<br />

• DLPDFDOC *Doc: Represents the document structure <strong>and</strong><br />

the current status of the document at all times.<br />

• char *Name: This name will be used in place of any name<br />

specified in a dlpdfdocwritepdf procedure call.<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfdocsetpsname<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 This is included in support of document processing systems which know the desired result of<br />

document creation at the start of document processing, but which may not retain that knowledge until<br />

the end of processing.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.59<br />

dlpdfdocsetpsname (DLPDFDOC *Doc, char *Name)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Saves the desired location of a PostScript file which results from<br />

this document.<br />

• DLPDFDOC *Doc: Represents the document structure <strong>and</strong><br />

the current status of the document at all times.<br />

• char *Name: This name will be used in place of any name<br />

specified in a dlpdfdocwritePS procedure call.<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfdocsetpdfname<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 This is included in support of document processing systems which know the desired result of<br />

document creation at the start of document processing, but which may not retain that knowledge until<br />

the end of processing.


A.60 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfdocsetsignatureappearance (DLPDFDOC *Doc,<br />

DLPDFSIGNATURE *Sig, DLPDFFORM *background, DLPDFFORM<br />

*unverified, DLPDFFORM *signature, DLPDFFORM *textSigInfo)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

This call sets the appearance layers for the digital signature to<br />

the supplied DLPDFFORM values. This call is optional. For an<br />

invisible digital signature, do not call this function. All the signature<br />

layers are also optional. Blank layers will be used for any<br />

omitted signature appearance layers.<br />

• DLPDFDOC *Doc: document for which the signature object<br />

will be created<br />

• DLPDFSIGNATURE *Sig: signature to which appearance<br />

settings will be assigned<br />

• DLPDFFORM *background: bottom-most layer of the<br />

digital signature appearance<br />

• DLPDFFORM *unverified: layer displayed when the<br />

signature has not been verified<br />

• DLPDFFORM *signature: graphical representation of the<br />

signature itself (such as a scanned h<strong>and</strong>written signature)<br />

• DLPDFFORM *textSigInfo: layer displaying information<br />

about the signature <strong>and</strong> the signatory<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfdoccreatesignature,<br />

dlpdfpageplacesignature<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.61<br />

dlpdfdocwritepdf (DLPDFDOC *Doc, char *FileName,<br />

int Linearize)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

Writes the document to PDF.<br />

• DLPDFDOC *Doc: Represents the document structure <strong>and</strong><br />

the current status of the document at all times.<br />

• char *FileName: May be NULL if it was set by a previous<br />

call to dlpdfdocsetpdfname, otherwise, if the filename<br />

is not specified, a genErrBadParam exception will be<br />

raised. If the filename was set, dlpdfdocsetpdfname<br />

has been called.<br />

• int Linearize: If true, linear optimized output will be<br />

created. If the procedure dlpdfdoclinearize has been<br />

called prior to a call to write the document, the document<br />

will be linearized regardless of the setting of the linearization<br />

flag.<br />

void<br />

genErrBadParam: Raised if the filename is not specified.<br />

dli.h<br />

dlpdfdocwritePS<br />

All <strong>DLI</strong>-supported platforms.


A.62 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfdocwritePS (DLPDFDOC *Doc, char *FileName)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

Writes the document to PostScript.<br />

• DLPDFDOC *Doc: Represents the document structure <strong>and</strong><br />

the current status of the document at all times.<br />

• char *FileName: May be NULL if it was set by a previous<br />

call to dlpdfdocsetpsname, otherwise, if the filename is<br />

not specified, a genErrBadParam exception will be raised.<br />

If the filename was set, dlpdfdocsetpsname has been<br />

called.<br />

void<br />

genErrBadParam: Raised if the filename is not specified.<br />

dli.h<br />

dlpdfdocwritepdf<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.63<br />

dlpdffontcreate (DLPDFDOC *Doc, char *fontName,<br />

char *fontType)<br />

Return Value: DLPDFFONT*<br />

Description<br />

Parameters<br />

Return Value<br />

This function call will cause the Adobe PDF Library to search the<br />

system default font locations <strong>and</strong> the locations supplied at initialization<br />

time for a font of the specified name (<strong>and</strong> of the<br />

specified type, if supplied). If a font cannot be located, this call<br />

will raise an exception. The font returned will be created in the<br />

document's default encoding if that encoding is compatible<br />

with the font; otherwise, a platform-dependent default will be<br />

used.<br />

• DLPDFDOC *Doc: The document for which to embed all<br />

fonts<br />

• char *fontName: The font name to search for<br />

• char *fontType: The type of font (e.g. "Type1,"<br />

"TrueType," "Type3") to search for. This may be NULL.<br />

The DLPDFFONT * which has been created<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfdocembedfonts,<br />

dlpdffontcreateembedded,<br />

dlpdffontcreatewithmetrics,<br />

dlpdffontcreatewithmetricsembedded<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 When a font type is specified, a font of that type <strong>and</strong> name is sought. If no such font is found, any<br />

type of font with the same name is sought. Please see “Font Searching Sequence” on page 1.5 for the<br />

specific order of search tests followed when the font creation process attempts to locate a font in<br />

resources.


A.64 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdffontcreateembedded (DLPDFDOC *Doc,<br />

char *fontName, char *fontType, ASBool Subset)<br />

Return Value: DLPDFFONT*<br />

Description<br />

Parameters<br />

Return Value<br />

This function call will cause the Adobe PDF Library to search the<br />

system default font locations <strong>and</strong> the locations supplied at initialization<br />

time for a font of the specified name (<strong>and</strong> of the<br />

specified type, if supplied). If a font cannot be located, this call<br />

will raise an exception. The font returned will be embedded <strong>and</strong><br />

created in the document's default encoding if that encoding is<br />

compatible with the font; otherwise, a platform-dependent<br />

default will be used. If the Subset parameter is set to TRUE,<br />

the font will be embedded <strong>and</strong> subset.<br />

• DLPDFDOC *Doc: The document for which to embed all<br />

fonts<br />

• char *fontName: Font name to search for<br />

• char *fontType: The type of font to search for (e.g.<br />

"Type0," "Type1," "TrueType," "Type3"). This may be<br />

NULL.<br />

• ASBool Subset: If TRUE, then the font is both embedded<br />

<strong>and</strong> subset. If FALSE, the entire font file is embedded in the<br />

PDF document. For Type0 fonts, this must be TRUE.<br />

The DLPDFFONT which has been created<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfdocembedfonts,<br />

dlpdffontcreate,<br />

dlpdffontcreatewithmetrics,<br />

dlpdffontcreatewithmetricsembedded<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.65<br />

dlpdffontcreatewithmetrics (DLPDFDOC *Doc,<br />

char *fontName, PDEFontAttrs *fontAttrs, unsigned short *Widths,<br />

char *Encoding [])<br />

Return Value: DLPDFFONT*<br />

Description<br />

Parameters<br />

Return Value<br />

This function call will cause the Adobe PDF Library to search the<br />

system default font locations <strong>and</strong> the locations supplied at initialization<br />

time for a font of the specified name <strong>and</strong> attributes. If<br />

the font cannot be found, one will be created if a width table<br />

<strong>and</strong> valid font attributes have been supplied. If no encoding is<br />

specified in the font attributes, the font will be created with the<br />

document's default font encoding.<br />

• DLPDFDOC *Doc: The document for which to embed all<br />

fonts<br />

• char *fontName: Font name to search for<br />

• PDEFontAttrs *fontAttrs: A PDEFontAttrs<br />

structure which has been zero-filled <strong>and</strong> set with parameters<br />

which the caller wants to see reflected in the returned font.<br />

See the Adobe Acrobat Core API <strong>Reference</strong> for details on this<br />

structure.<br />

• unsigned short Widths: If non-NULL, an array of 256<br />

values; see Technical Note 1 below.<br />

• char *Encoding: If non-NULL, an array of 256 values; see<br />

Technical Note 2 below.<br />

The DLPDFFONT which has been created<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfdocembedfonts,<br />

dlpdffontcreate,<br />

dlpdffontcreateembedded,<br />

dlpdffontcreatewithmetricsembedded<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 The widths array refers to the width of the character in that position, in EMs. If this argument is<br />

NULL, the default character widths in the requested encoding of the FontAttrs structure are used.<br />

This must be NULL for Type0 fonts.<br />

2 Each element of the encoding array is the PostScript name of the character to use for the specified<br />

code point. If this is NULL, the encoding specified in the PDEFontAttrs structure is used (<strong>and</strong> must<br />

be NULL for Type0 fonts). When specifying an encoding vector, a width table is highly recommended.


A.66 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdffontcreatewithmetricsembedded<br />

(DLPDFDOC *Doc, char *fontName, PDEFontAttrs *fontAttrs,<br />

unsigned short *Widths, char *Encoding [], ASBool Subset)<br />

Return Value: DLPDFFONT*<br />

Description<br />

Parameters<br />

Return Value<br />

This function call will cause the Adobe PDF Library to search the<br />

system default font locations <strong>and</strong> the locations supplied at initialization<br />

time for a font of the specified name <strong>and</strong> attributes. If<br />

the font cannot be found, an exception will be raised. If no<br />

encoding is specified in the font attributes, the font will be created<br />

with the document's default font encoding. The created<br />

font will be embedded; if Subset is set to TRUE, then the font<br />

will be subset as well.<br />

• DLPDFDOC *Doc: The document for which to embed all<br />

fonts<br />

• char *fontName: The font name to search for<br />

• PDEFontAttrs *fontAttrs: A PDEFontAttrs<br />

structure which has been zero-filled <strong>and</strong> set with parameters<br />

which the caller wants to see reflected in the returned font.<br />

See the Adobe Acrobat Core API <strong>Reference</strong> for details on this<br />

structure.<br />

• unsigned short *Widths: If non-NULL, an array of 256<br />

values; see Technical Note 1 below.<br />

• char *Encoding: If non-NULL, an array of 256 values; see<br />

Technical Note 2 below.<br />

• ASBool Subset: If TRUE, then the font is both embedded<br />

<strong>and</strong> subset. If FALSE, the entire font file is embedded in the<br />

PDF document. For Type0 fonts, this must be TRUE.<br />

The DLPDFFONT which has been created<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfdocembedfonts,<br />

dlpdffontcreate,<br />

dlpdffontcreateembedded,<br />

dlpdffontcreatewithmetrics<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.67<br />

Technical Notes<br />

1 Each element of the widths array represents the width of the character in that position, in EMs. If<br />

this argument is NULL, the default character widths in the requested encoding of the PDEFontAttrs<br />

structure are used. This must be NULL for Type0 fonts.<br />

2 Each element of the encoding array is the PostScript name of the character to use for the specified<br />

code point. If this argument is NULL, the encoding specified in the PDEFontAttrs structure is used.<br />

This must be NULL for Type0 fonts. When specifying an encoding vector, a width table is highly<br />

recommended.


A.68 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfformcreate (DLPDFDOC *Doc, DLPDFCONTENT *Content,<br />

ASFixedRect *BBox)<br />

Return Value: DLPDFFORM*<br />

Description<br />

Parameters<br />

Return Value<br />

Creates a new form in the document specified as Doc., with the<br />

content previously placed into the container Content. The<br />

form will be considered to be of the size specified in BBox. The<br />

Bounding Box need not be located at (0,0); however, it must<br />

have a positive Width <strong>and</strong> Depth.<br />

• DLPDFDOC *Doc: Name of new form created with this call<br />

• DLPDFCONTENT *Content: Represents the content<br />

element. The content block used to create a form is destroyed<br />

in the form’s creation, <strong>and</strong> any h<strong>and</strong>les to it become invalid.<br />

• ASFixedRect *BBox: Represents the bounding box of the<br />

form, in points.<br />

DLPDFFORM*<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfformdestroy<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.69<br />

dlpdfformdestroy (DLPDFFORM *Form)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Destroys the named form, releasing its resources <strong>and</strong> invalidating<br />

the form h<strong>and</strong>le.<br />

DLPDFFORM *Form<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfformcreate<br />

All <strong>DLI</strong>-supported platforms.


A.70 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfimagecreatefrombmp (DLPDFDOC *Doc,<br />

char *ImageName, char *Image, long ImageSize, long Width, Long Depth,<br />

int bpc, CosObj ColorSpace, int InLine)<br />

Return Value: DLPDFIMAGE*<br />

Description<br />

Parameters<br />

Return Value<br />

Creates an image from a bitmap. The map is considered to be<br />

scanned left to right <strong>and</strong> top to bottom.<br />

• DLPDFDOC *Doc represents the document structure <strong>and</strong> the<br />

current status of the document at all times.<br />

• char *ImageName: Image name string<br />

• char *Image: Pointer to the image raster data<br />

• long ImageSize in bytes. Should be equal to<br />

((Width*Depth*BitsPerComponent)/8)*<br />

CompPerPixel. Components per pixel is derived from<br />

ColorSpace.<br />

• long Width in pixels<br />

• Long Depth in pixels<br />

• int bpc<br />

• CosObj ColorSpace: this should be the color space name<br />

as a COS structure (/DeviceGray, /DeviceRGB or<br />

/DeviceCMYK, which have 1, 3, <strong>and</strong> 4 components per pixel<br />

respectively), a CosNull structure (if this is a 1BPP, onechannel<br />

bitmap to be placed as an imagemask), or an<br />

indexed color space structure which has one component per<br />

pixel.<br />

• int InLine: A flag which when TRUE will embed this<br />

structure in the document each time it is used. When FALSE,<br />

it will be embedded only once.<br />

DLPDFIMAGE*<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfimagecreatefromfile,<br />

dlpdfimagecreatefrompdf,<br />

dlpdfimagecreatefromps<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 For efficiency purposes, <strong>DLI</strong> inlines images when the ImageLength parameter is less than 500 bytes.<br />

2 The bitmap processed by this function is a “raw” bitmap with no header information or wrapper.<br />

Unprocessed BMP files are not supported by this function.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.71<br />

dlpdfimagecreatefromfile (DLPDFDOC *Doc, char *Name)<br />

Return Value: DLPDFIMAGE*<br />

Description<br />

Parameters<br />

Return Value<br />

Invokes the graphics library conversion facility, which will convert<br />

an arbitrary file containing an image (JPG/JPEG, PNG, TIFF,<br />

GIF or PDF) into a returned DLPDFIMAGE* structure for further<br />

processing.<br />

• DLPDFDOC *Doc represents the document structure <strong>and</strong><br />

the current status of the document at all times.<br />

• char *Name: Name string<br />

DLPDFIMAGE*<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfimagecreatefrombmp,<br />

dlpdfimagecreatefrompdf,<br />

dlpdfimagecreatefromps<br />

Not available on OS/390


A.72 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfimagecreatefrompdf (DLPDFDOC *Doc,<br />

char *ImageName, ASFixed Width, ASFixed Depth, ASFixed XDisp,<br />

ASFixed YDisp, long Page)<br />

Return Value: DLPDFIMAGE*<br />

Description<br />

Parameters<br />

Return Value<br />

This convenience operator will create an image from a file containing<br />

a PDF document. If importing an image containing a<br />

Rotate key, that value will be honored. Images will be placed<br />

in the same orientation displayed by Adobe Reader <strong>and</strong> Acrobat.<br />

The specified page of the PDF document will be used as a<br />

graphic image.<br />

• DLPDFDOC *Doc represents the document structure <strong>and</strong> the<br />

current status of the document at all times.<br />

• char *ImageName: Image name string<br />

• ASFixed Width<br />

• ASFixed Depth<br />

• ASFixed XDisp<br />

• ASFixed YDisp<br />

• long Page<br />

DLPDFIMAGE*<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfimagecreatefrombmp,<br />

dlpdfimagecreatefromfile,<br />

dlpdfimagecreatefromps<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 As of <strong>DLI</strong> v3.0.11, a value of 0 is now accepted for the Width <strong>and</strong> Depth parameters. If either is 0,<br />

the PDF page's crop box is used to form the DLPDFIMAGE's visible region. This will be shifted using<br />

the XDisp <strong>and</strong> YDisp values to generate the imported image.<br />

2 <strong>Datalogics</strong> recommends supplying a value of 0 for the width, depth, <strong>and</strong> x- <strong>and</strong> y-displacements,<br />

unless it is otherwise known that the imported graphic should be placed with a visible region other<br />

than that visible in Adobe Acrobat or Reader.<br />

3 The BoundingBox in the returned DLPDFIMAGE is not rotated by the value of the Rotate key for<br />

the imported page, <strong>and</strong> thus can be used to determine the "real" width <strong>and</strong> depth of the imported PDF<br />

image.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.73<br />

dlpdfimagecreatefromps (DLPDFDOC *Doc,<br />

char *ImageName, char *Image, long ImageSize, int InLine)<br />

Return Value: DLPDFIMAGE*<br />

Description<br />

Parameters<br />

Return Value<br />

Creates an image from an EPS graphic. It must contain a<br />

“%%BoundingBox” statement.<br />

• DLPDFDOC *Doc represents the document structure <strong>and</strong> the<br />

current status of the document at all times.<br />

• char *ImageName: Name of Image<br />

• char *Image: The graphic is contained in this array.<br />

• long ImageSize: Size of image<br />

• int Inline: A flag, which when TRUE embeds this<br />

structure in the graphic each time it is used. When FALSE, it<br />

will be embedded only once.<br />

DLPDFIMAGE*<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfimagecreatefrombmp,<br />

dlpdfimagecreatefromfile,<br />

dlpdfimagecreatefrompdf<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 <strong>DLI</strong> does not convert PostScript fragments to PDF. Any PostScript images will not be viewable in most<br />

PDF viewers. This method is included for PDF files which will go to printers or print processors which<br />

can appropriately h<strong>and</strong>le these fragments.


A.74 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfimagegetsize (DLPDFIMAGE *Image, ASUns32 *xRasters,<br />

ASUns32 *yRasters, ASFixed *xPoints, ASFixed *yPoints)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

This procedure retrieves image size information from a graphic<br />

file.<br />

• DLPDFIMAGE *Image: Represents a pointer to the image<br />

file. This method will examine the image file <strong>and</strong> return<br />

values in the four arguments following.<br />

• ASUns32 *xRasters: Width of image in rasters or image<br />

units (depending on format)<br />

• ASUns32 *yRasters: Height of image in rasters or image<br />

units (depending on format)<br />

• ASFixed *xPoints: Intended print width in PDF units<br />

• ASFixed *yPoints: Intended print height in PDF units<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfcontentreferenceimage<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 The Scale Factors specified in dlpdfcontentreferenceimage will determine the resulting size of<br />

the image. This method gives you the image information necessary to calculate those values, dividing<br />

the intended print size by the file size for each dimension. This yields a Scale Factor ratio which<br />

dlpdfcontentreferenceimage uses to calculate the final output image size.<br />

2 The typical scaling calculation using values returned by this method would occur during the call to<br />

dlpdfcontentreferenceimage; e.g. "dlpdfcontentreferenceimage(Content, Image,<br />

Int32ToFixed(72), Int32ToFixed(92), 0,<br />

ASFixedDiv(xPoints,Int32ToFixed(xRasters)),<br />

ASFixedDiv(yPoints,Int32ToFixed(yRasters)));".<br />

3 An image in which each pixel of each raster line represents one PDF unit of output will return the same<br />

values for both image dimension (xRasters <strong>and</strong> yRasters) <strong>and</strong> print size (xPoints <strong>and</strong><br />

yPoints), <strong>and</strong> thus a Scale Factor of 1 on both axes.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.75<br />

dlpdfinit (PDFLData pdflLibData, ASFileSys defaultFS, void *unused)<br />

Return Value: DLPDFINSTANCE *<br />

Description<br />

Parameters<br />

Initializes the Adobe PDF Library <strong>and</strong> <strong>DLI</strong>, <strong>and</strong> should be called<br />

prior to creating the first document.<br />

• PDFLData pdflLibData: contains the initialization<br />

information for the Adobe PDF Library.<br />

• ASFileSys defaultFS: the default file system for file<br />

input/output <strong>and</strong> creation of temporary files. If this parameter<br />

is NULL, the default file system for the current platform will<br />

be used.<br />

• void *unused: NULL; reserved for future use<br />

Return Value DLPDFINSTANCE *<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfmemfilesys,<br />

dlpdfterm<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 Initialization of <strong>DLI</strong> is now required; support for using <strong>DLI</strong> without initialization has been removed.<br />

If you intend to use <strong>DLI</strong> methods in your application, you must intialize <strong>DLI</strong> via dlpdfinit. <strong>DLI</strong><br />

users should initialize the Adobe PDF Library through the <strong>DLI</strong> initialization call; PDFLInit <strong>and</strong><br />

PDFLTerm should never be directly called from a <strong>DLI</strong> application.<br />

2 In a multi-threaded application, each thread must do its own initialization <strong>and</strong> termination of the<br />

Library.<br />

3 This procedure, along with dlpdfterm, replaces the need for calls to PDFLInit <strong>and</strong> PDFLTerm.<br />

<strong>DLI</strong> should be initialized, or the Adobe PDF Library, but not both.<br />

4 You can accidentally call dlpdfinit (the <strong>DLI</strong> comm<strong>and</strong>) multiple times without problems, as it<br />

contains internal code that prevents actual initialization from occurring more than once, but you<br />

cannot call PDFLInit (the Adobe PDF Library comm<strong>and</strong>) more than once as a fatal error will occur.<br />

5 dlpdfinit <strong>and</strong> dlpdfterm are the only methods which must not be enclosed in exception h<strong>and</strong>lers<br />

(i.e. DURING/HANDLER/END_HANDLER statements), because they are not set up before initialization,<br />

<strong>and</strong> are freed during termination.<br />

6 As of <strong>DLI</strong> v3.0.11, the <strong>DLI</strong> graphics cache has been enhanced to use the default ASFileSys<br />

implementation provided to dlpdfinit for caching graphics. By default, the graphics cache file size<br />

is limited to 1.5GB. Customers who wish to use larger graphics cache files are advised to supply a


A.76 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

filesystem to dlpdfinit which is capable of reliably h<strong>and</strong>ling files of the larger size.<br />

NOTE: The cache size limit is checked every time a document is destroyed; the<br />

cache may therefore temporarily exceed the cache size limit. When setting the<br />

cache size limit, please note that to resize the graphics cache, free space equal to<br />

the sum of the cache limit <strong>and</strong> the "low water" mark is required. Files In Memory<br />

users with large graphics workloads are advised to lower the cache size limit to a<br />

number appropriate for their target environment.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.77<br />

dlpdfinstancesetcancelproc (DLPDFINSTANCE *dliInst,<br />

CancelProc cProc, void *cData)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

This call sets the cancel procedure used when writing a document<br />

using the dlpdfdocwritepdf call, along with other<br />

calls which may take a large quantity of time. This progress<br />

monitor will be used for all documents created with the specified<br />

instance.<br />

• DLPDFInstance *dliInst: The DLPDFINSTANCE for<br />

which to set the cancel procedure<br />

• CancelProc cProc: The cancel procedure to use. See the<br />

Adobe Acrobat Core API <strong>Reference</strong> for details on creating a<br />

cancel procedure.<br />

• void *cData: A pointer to client data which is passed to<br />

the cancel procedure callback. See the Adobe Acrobat Core<br />

API <strong>Reference</strong> for details.<br />

void<br />

Exceptions<br />

Header<br />

dli.h<br />

Related Methods<br />

Availability<br />

All <strong>DLI</strong>-supported platforms.


A.78 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfinstancesetgrcachelimits (DLPDFINSTANCE *dliInst,<br />

ASUns32 highLimit, ASUns32 deleteLimit)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

This call supports a control on the amount of filesystem storage<br />

used for the <strong>DLI</strong> graphics cache. It accepts a low-water <strong>and</strong> a<br />

high-water mark, in bytes. At document-destroy time (i.e. when<br />

a call to dlpdfdocdestroy is made), the graphics cache size<br />

is evaluated, <strong>and</strong> if it exceeds the high-water mark in size,<br />

graphics will be removed from the cache in least recently used<br />

(LRU) order until the cache falls to or below the low-water mark.<br />

• DLPDFINSTANCE *dliInst: The DLPDFINSTANCE for<br />

which the cache will be reviewed<br />

• ASUns32 highLimit: The high-water mark level, in bytes.<br />

Exceeding this level will trigger a purge of graphics in LRU<br />

order at document-destroy time.<br />

• ASUns32 deleteLimit: The low-water mark level, in<br />

bytes, above which graphics will be purged at documentdestroy-time.<br />

Graphics will be removed in LRU order until the<br />

total storage is at or below this figure.<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfdocdestroy<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 The highLimit value is a trigger-point setting only, not a storage limit; the cache is allowed to grow<br />

beyond that point. The highLimit value is inspected only at document-destroy time when<br />

dlpdfdocdestroy is called, not before. The graphics cache may grow larger than the highLimit<br />

value during document creation, but will be reduced to the deleteLimit point before the next<br />

document is begun.<br />

2 As of <strong>DLI</strong> v3.0.11, the <strong>DLI</strong> graphics cache has been enhanced to use the default ASFileSys<br />

implementation provided to dlpdfinit for caching graphics. By default, the graphics cache file size<br />

is limited to 1.5GB. Customers who wish to use larger graphics cache files are advised to supply a


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.79<br />

filesystem to dlpdfinit which is capable of reliably h<strong>and</strong>ling files of the larger size.<br />

NOTE: The cache size limit is checked every time a document is destroyed; the<br />

cache may therefore temporarily exceed the cache size limit. When setting the<br />

cache size limit, please note that to resize the graphics cache, free space equal to<br />

the sum of the cache limit <strong>and</strong> the "low water" mark is required. Files In Memory<br />

users with large graphics workloads are advised to lower the cache size limit to a<br />

number appropriate for their target environment.


A.80 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfinstancesetprogressmonitor<br />

(DLPDFINSTANCE *dliInst, ProgressMonitor pRec, void *progData)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

This call sets the progress monitor used when writing a document<br />

using the dlpdfdocwritepdf call, along with other<br />

calls which may take a large quantity of time. This progress<br />

monitor will be used for all documents created with the specified<br />

instance.<br />

• DLPDFINSTANCE *dliInst: The DLPDFINSTANCE for<br />

which to set the progress monitor<br />

• ProgressMonitor pRec: The progress monitor to use.<br />

See the Adobe Acrobat Core API <strong>Reference</strong> for details on<br />

creating <strong>and</strong> obtaining progress monitors.<br />

• void *progData: A pointer to client data which is passed<br />

to the progress monitor callbacks. See the Adobe Acrobat<br />

Core API <strong>Reference</strong> for details.<br />

void<br />

Exceptions<br />

Header<br />

dli.h<br />

Related Methods<br />

Availability<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.81<br />

dlpdfmatrixrotate (ASFixedMatrix *Matrix, ASFixed Angle)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Rotates a matrix counterclockwise by the specified angle after<br />

accepting a pointer to the matrix.<br />

• ASFixedMatrix *Matrix: Matrix to be rotated<br />

• ASFixed Angle: In degrees, as an ASFixed<br />

counterclockwise value<br />

void<br />

Exceptions<br />

Header<br />

dli.h<br />

Related Methods<br />

Availability<br />

All <strong>DLI</strong>-supported platforms.


A.82 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfmemfileacquire (ASPathName Name)<br />

Return Value: MDFile<br />

Description<br />

Parameters<br />

Return Value<br />

Acquires a Files In Memory representation for the file named<br />

FileName, previously created with an ASFileOpen call. It<br />

returns this file as an MDFile, which may then be used to<br />

obtain a representation of the file's contents.<br />

ASPathName Name<br />

MDFile<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfmemfilerelease<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.83<br />

dlpdfmemfiledata (MDFile File)<br />

Return Value: unsigned const char *<br />

Description<br />

Parameters<br />

Returns a pointer (of the size returned by the dlpdfmemfilesize<br />

function call) containing a memory representation<br />

of the file passed into the function. This should be neither<br />

altered nor freed, <strong>and</strong> should be copied by the application into<br />

the application’s memory area.<br />

MDFile File<br />

Return Value unsigned const char *<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfmemfileacquire,<br />

dlpdfmemfilerelease,<br />

dlpdfmemfilesize<br />

All <strong>DLI</strong>-supported platforms.


A.84 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfmemfiledeleteonclose (MDFile File)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

This method marks a Files In Memory file to be removed from<br />

the filesystem once the last open fileh<strong>and</strong>le for this file has been<br />

closed. No file is automatically removed from memory, unless<br />

this call has been made on a specific MDFile.<br />

MDFile File<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfmemfileacquire,<br />

dlpdfmemfilerelease<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.85<br />

dlpdfmemfilerelease (MDFile File)<br />

Return Value: int<br />

Description<br />

Parameters<br />

Return Value<br />

Relinquishes one acquisition as made by the dlpdfmemfileacquire<br />

call, <strong>and</strong> returns the number of acquisitions left on<br />

the file.<br />

MDFile<br />

Int<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfmemfileacquire<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 An application should make one release call for each acquire call: the release call signals that<br />

the acquiring program no longer needs the file, <strong>and</strong> its resources may be safely freed.


A.86 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfmemfilesetbuffer (MDFile File, unsigned char * Data,<br />

ASSize_t Size)<br />

Return Value: ASBool<br />

Description<br />

Parameters<br />

Return Value<br />

This method configures Files In Memory to directly use the<br />

buffer passed in as the file contents. Unlike dlpdfmemfilesetdata,<br />

this method does not copy the buffer; the file<br />

instance <strong>and</strong> buffer instance are one <strong>and</strong> the same.<br />

• MDFile File: File to be overwritten<br />

• unsigned char * Data: Memory to replace the File’s<br />

previous content.<br />

• ASSize_t Size<br />

ASBool: TRUE is returned if the file’s data buffer could be set<br />

to this memory, FALSE if it could not.<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfmemfileacquire,<br />

dlpdfmemfilerelease,<br />

dlpdfmemfilesetdata<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 As of <strong>DLI</strong> v3.0.11, the dlpdfmemfilesetbuffer <strong>and</strong> dlpdfmemfilesetdata calls no longer<br />

rewind the memory files to position 0.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.87<br />

dlpdfmemfilesetdata (MDFile File, unsigned const char * Data,<br />

ASSize_t Size)<br />

Return Value: ASBool<br />

Description<br />

Parameters<br />

Return Value<br />

Sets the file passed in to contain the data passed to the function.<br />

This completely overwrites the file’s previous contents.<br />

• MDFile File: File to be overwritten<br />

• unsigned const char * Data: Data that replaces<br />

File content.<br />

• ASSize_t Size<br />

ASBool: TRUE is returned if the file could be set to this data,<br />

FALSE if it could not.<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfmemfileacquire,<br />

dlpdfmemfilerelease,<br />

dlpdfmemfilesetbuffer<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 As of <strong>DLI</strong> v3.0.11, the dlpdfmemfilesetbuffer <strong>and</strong> dlpdfmemfilesetdata calls no longer<br />

rewind the memory files to position 0.


A.88 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfmemfilesize (MDFile File)<br />

Return Value: ASSize_t<br />

Description<br />

Parameters<br />

Return Value<br />

Returns the size of the memory buffer which the dlpdfmemfiledata<br />

call will return if called. This is the smallest size of<br />

buffer that can accommodate the memory representation of<br />

Files In Memory passed in as a file.<br />

MDFile File<br />

ASSize_t<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfmemfileacquire,<br />

dlpdfmemfilerelease<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.89<br />

dlpdfmemfilesys (void)<br />

Return Value: ASFileSys<br />

Description<br />

Parameters<br />

Return Value<br />

Returns the ASFileSys structure which represents the <strong>Datalogics</strong><br />

Files In Memory file system.This file system will only be<br />

used if PDF output is requested.<br />

None<br />

ASFileSys<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfinit,<br />

dlpdfmemfileacquire,<br />

dlpdfmemfilerelease<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 This method is suitable as the second parameter for the dlpdfinit function, or for any other Adobe<br />

PDF Library function call requiring an ASFileSys record.


A.90 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfmemfilesysgetmemusage (void)<br />

Return Value: ASSize_t<br />

Description<br />

Parameters<br />

Return Value<br />

This returns an ASSize_t with the current usage, in bytes, of<br />

memory for Files In Memory file contents by <strong>DLI</strong>.<br />

None<br />

ASSize_t<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfmemfileacquire,<br />

dlpdfmemfilerelease<br />

dlpdfmemfilesyssetmemlimit<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.91<br />

dlpdfmemfilesyssetmemlimit (ASSize_t memLimit)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

This establishes an upper bound, in bytes, of the memory usage<br />

allowed for Files In Memory file contents by <strong>DLI</strong>.<br />

ASSize_t memLimit<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfmemfileacquire,<br />

dlpdfmemfilerelease<br />

dlpdfmemfilesysgetmemusage<br />

All <strong>DLI</strong>-supported platforms.


A.92 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfmemfiletransientprefix (void)<br />

Return Value: const char *<br />

Description<br />

Parameters<br />

Returns a NULL-terminated string representing the prefix for the<br />

transient files<br />

None<br />

Return Value const char *<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfmemfileacquire,<br />

dlpdfmemfilerelease<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 Transient files are files which are to reside entirely within the bounds of Files In Memory, <strong>and</strong> are not<br />

to be written to disk upon file closure. All temporary files created by the Adobe PDF Library <strong>and</strong> <strong>DLI</strong><br />

are automatically transient files when Files In Memory is activated.<br />

2 Applications which wish to write PDF files to memory areas should append this prefix to the<br />

beginning of all their file names. Files which do not start with this prefix will be written to disk upon<br />

file closure or upon program termination.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.93<br />

dlpdfpageaddlinkannotation (DLPDFPAGE *Page,<br />

ASFixedRect *Location, ASFixed *Border, ASFixed *Color,<br />

long PageNumber, Char *Fit, ASFixedRect *Where, ASFixed *Zoom)<br />

Return Value: CosObj<br />

Description<br />

Parameters<br />

Return Value<br />

Creates a link annotation in the specified page.<br />

• DLPDFPAGE *Page: Represents a page. This structure is<br />

tracked within the package <strong>and</strong> destroyed when the<br />

document is destroyed. Pointers to this structure remain valid<br />

until the document is destroyed.<br />

• ASFixedRect *Location: The hot spot for the link will<br />

be located at the rectangle specified here.<br />

• ASFixed *Border: (Optional) An array of three ASFixed<br />

values in the order Horizontal Corner Radius,<br />

Vertical Corner Radius <strong>and</strong> Line Width, drawing a<br />

visible border around the hot spot.<br />

• ASFixed *Color: Optional pointer by which border color<br />

may be set. When used, this is assumed to point to an array<br />

of three ASFixed values, giving the color as Red, Green <strong>and</strong><br />

Blue values.<br />

• long PageNumber: The zero-relative number of the page<br />

to which this link connects. The page referenced does not<br />

need to have been created yet.<br />

• Char *Fit: Must be a valid PDF fit type expressed as a<br />

string. The list of valid types are “Fit”, “FitH”, “FitV”,<br />

“FitBH”, “FitBV”, “FitR”, “FitB” <strong>and</strong> “XYZ”. See the<br />

Adobe PDF Library <strong>Reference</strong> <strong>Guide</strong> for explanations of the<br />

meaning of each fit type, <strong>and</strong> which values of the rectangle<br />

<strong>and</strong> zoom are used for each.<br />

• ASFixedRect *Where: The rectangle to be displayed. This<br />

is used to distinguish an annotation. Only portions of this<br />

rectangle are used, based on the Fit Type selected in Fit.<br />

• ASFixed *Zoom: Adjustment to size of link target display.<br />

CosObj: The actual link structure which may be modified by<br />

the user to access capabilities beyond this interface.<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfpageaddlinkannotationfromname,<br />

dlpdfpageaddtextannotation,<br />

dlpdfpageaddwebannotation<br />

All <strong>DLI</strong>-supported platforms.


A.94 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Technical Notes<br />

1 Only internal destinations (within the same document) are supported in this method.<br />

2 Zero values in the rectangle will behave as PDViewNull values, as will a zero value for Zoom.<br />

3 The most common values used are XYZ as the fit type, Zero for Zoom, <strong>and</strong> the (X,Y) coordinates of the<br />

upper left h<strong>and</strong> edge of the desired target text in Where.top <strong>and</strong> Where.left. This will change to<br />

the target page <strong>and</strong> position the specified text so it is within the display window, leaving the<br />

Magnification factor where the user last set it.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.95<br />

dlpdfpageaddlinkannotationfromname<br />

(DLPDFPAGE *Page, ASFixedRect *Location, ASFixed *Border,<br />

ASFixed *Color, char *Target)<br />

Return Value: CosObj<br />

Description<br />

Parameters<br />

Return Value<br />

Adds a new link to a page using the named destination rather<br />

than a specified destination.<br />

• DLPDFPAGE *Page<br />

• ASFixedRect *Location: Location of rectangle<br />

• ASFixed *Border<br />

• ASFixed *Color: Link color<br />

• char *Target<br />

CosObj<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfpageaddlinkannotation,<br />

dlpdfpageaddtextannotation,<br />

dlpdfpageaddwebannotation<br />

All <strong>DLI</strong>-supported platforms.


A.96 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfpageaddtextannotation (DLPDFPAGE *Page,<br />

ASFixedRect *Location, ASFixed *Border, ASFixed *Color, char *Title,<br />

char *Contents, int Open)<br />

Return Value: CosObj<br />

Description<br />

Parameters<br />

Return Value<br />

Creates a text annotation within the specified page.<br />

• DLPDFPAGE *Page: Represents a page. This structure is<br />

tracked within the package <strong>and</strong> destroyed when the<br />

document is destroyed. Pointers to this structure remain valid<br />

until the document is destroyed.<br />

• ASFixedRect *Location: The lower-left corner of where<br />

the text annotation is to be displayed.<br />

• ASFixed *Border: (Optional) an array of three ASFixed<br />

values: Horizontal Corner Radius, Vertical<br />

Corner Radius <strong>and</strong> Line Width.<br />

• ASFixed *Color: (Optional) an array of three ASFixed<br />

values giving the color as Red, Green <strong>and</strong> Blue values.<br />

• char *Title: (Optional) displayed in the title bar of an<br />

open text annotation.<br />

• char *Contents: (Required) the displayed contents of the<br />

annotation.<br />

• int Open: A Boolean where TRUE will cause the annotation<br />

to be opened by default, while FALSE will cause it to be<br />

closed by default.<br />

CosObj<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfpageaddlinkannotation,<br />

dlpdfpageaddlinkannotationfromname,<br />

dlpdfpageaddwebannotation<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 A page may contain any number of annotations. There are capabilities of annotations beyond those<br />

described here. To access those capabilities, modify the COS structure returned by this call.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.97<br />

dlpdfpageaddwebannotation (DLPDFPAGE *Page,<br />

ASFixedRect *Location, ASFixed *Border, ASFixed *Color,<br />

char *URIDestination)<br />

Return value: CosObj<br />

Description<br />

Parameters<br />

Return Value<br />

Adds a new link to a page, using a URI (equivalent to URL) destination<br />

given by the URIDestination parameter. This URI is<br />

assumed to be in UTF-8 text format; support for URIs in other<br />

character sets is unavailable at this time.<br />

• DLPDFPAGE *Page<br />

• ASFixedRect *Location<br />

• ASFixed *Border<br />

• ASFixed *Color<br />

• char *URIDestination: URI destination in UTF-8 text<br />

format.<br />

CosObj<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfpageaddlinkannotation,<br />

dlpdfpageaddlinkannotationfromname,<br />

dlpdfpageaddtextannotation<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 You should have your internet browser running before calling this procedure or you may receive a<br />

“browser is busy” error. Your browser can be specified in Adobe Acrobat or Adobe Reader via File-<br />

>Preferences->Weblink.


A.98 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfpagecosobj (DLPDFPAGE *Page)<br />

Return Value: CosObj<br />

Description<br />

Parameters<br />

Return Value<br />

This function will return a COS structure that represents the<br />

page in the Adobe PDF Library. It may be used to apply COS<br />

Layer operations to the page beyond those functions defined in<br />

the package.<br />

DLPDFPAGE *Page<br />

CosObj<br />

Exceptions<br />

Header<br />

dli.h<br />

Related Methods<br />

Availability<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.99<br />

dlpdfpagecreate (DLPDFDOC *Doc, ASFixed Width,<br />

ASFixed Height)<br />

Return Value: DLPDFPAGE*<br />

Description<br />

Parameters<br />

Return Value<br />

Exceptions<br />

Header<br />

Creates a new page in the current document, positioned to follow<br />

all other pages in the current document.<br />

• DLPDFDOC *Doc: Represents the document structure <strong>and</strong><br />

the current status of the document at all times.<br />

• ASFixed Width: Must be specified as greater than zero;<br />

assumed to be in points.<br />

• ASFixed Height: Must be specified as greater than zero;<br />

assumed to be in points.<br />

DLPDFPAGE*<br />

genErrBadParam: Raised if the specified document does not<br />

exist.<br />

dli.h<br />

Related Methods<br />

Availability<br />

All <strong>DLI</strong>-supported platforms.


A.100 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfpagefindfromnumber (DLPDFDOC *Doc,<br />

long PageNumber)<br />

Return Value: DLPDFPAGE*<br />

Description<br />

Parameters<br />

Return Value<br />

Allows pages to be modified after creation without requiring<br />

pointers to all pages in the application. If the page number specified<br />

has not yet been created, a NULL pointer will be returned.<br />

The first page is considered to be page one.<br />

• DLPDFDOC *Doc represents the document structure <strong>and</strong> the<br />

current status of the document at all times.<br />

• long PageNumber<br />

DLPDFPAGE*<br />

Exceptions<br />

Header<br />

dli.h<br />

Related Methods<br />

Availability<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.101<br />

dlpdfpagenumber (DLPDFPAGE *Page)<br />

Return Value: long<br />

Description<br />

Parameters<br />

Return Value<br />

Returns the sequence number of the specified page. This number<br />

may be used in conjunction with the PDDoc returned by<br />

dlpdfdocpddoc to acquire a PDPage for the specified page.<br />

This PDPage will permit Edit Layer functions to be applied to<br />

the page beyond those defined in this package.<br />

DLPDFPAGE *Page<br />

long<br />

Exceptions<br />

Header<br />

dli.h<br />

Related Methods<br />

Availability<br />

All <strong>DLI</strong>-supported platforms.


A.102 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfpagerotate (DLPDFPAGE *Page, PDRotate Angle)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Rotates page clockwise in 90-degree increments. Angles specified<br />

will be reduced if necessary by 360 degrees, then rounded<br />

to the nearest 90-degree increment.<br />

• DLPDFPAGE *Page<br />

• PDRotate Angle<br />

void<br />

Exceptions<br />

Header<br />

dli.h<br />

Related Methods<br />

Availability<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 This call may be issued at any time after a page is created, <strong>and</strong> will be effective in PDF <strong>and</strong> Adobe<br />

PostScript.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.103<br />

dlpdfpagesetart (DLPDFPAGE *Page, ASFixedRect *Rect)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Sets the Art box for the DLPDFPAGE provided as input to the<br />

function. Please see the "Page Boundaries" section of Prepress<br />

Support in the Adobe PDF <strong>Reference</strong> Manual for more details.<br />

• DLPDFPAGE *Page<br />

• ASFixedRect *Rect<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfpagesetbleed,<br />

dlpdfpagesetcrop,<br />

dlpdfpagesetmediabox,<br />

dlpdfpagesettrim<br />

All <strong>DLI</strong>-supported platforms.


A.104 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfpagesetbleed (DLPDFPAGE *Page, ASFixedRect *Rect)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Sets the Bleed box for the DLPDFPAGE provided as input to the<br />

function. Please see the "Page Boundaries" section of Prepress<br />

Support in the Adobe PDF <strong>Reference</strong> Manual for more details.<br />

• DLPDFPAGE *Page<br />

• ASFixedRect *Rect<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfpagesetart,<br />

dlpdfpagesetcrop,<br />

dlpdfpagesetmediabox,<br />

dlpdfpagesettrim<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.105<br />

dlpdfpagesetcrop (DLPDFPAGE *Page, ASFixedRect *Rect)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Sets the Crop box for the DLPDFPAGE provided as input to the<br />

function. Please see the "Page Boundaries" section of Prepress<br />

Support in the Adobe PDF <strong>Reference</strong> Manual for more details.<br />

• DLPDFPAGE *Page<br />

• ASFixedRect *Rect<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfpagesetart,<br />

dlpdfpagesetbleed,<br />

dlpdfpagesetmediabox,<br />

dlpdfpagesettrim<br />

All <strong>DLI</strong>-supported platforms.


A.106 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfpagesetid (DLPDFPAGE *Page, char *Id)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Adds an ID Entry to the page dictionary. This is generally a<br />

page’s FOLIO.<br />

• DLPDFPAGE *Page<br />

• char *Id: ID entry.<br />

void<br />

Exceptions<br />

Header<br />

dli.h<br />

Related Methods<br />

Availability<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.107<br />

dlpdfpagesetmediabox (DLPDFPAGE *Page,<br />

ASFixedRect *Rect)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Sets the Media box for the DLPDFPAGE provided as input to the<br />

function. Please see the "Page Boundaries" section of Prepress<br />

Support in the Adobe PDF <strong>Reference</strong> Manual for more details.<br />

• DLPDFPAGE *Page<br />

• ASFixedRect *Rect<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfpagesetart,<br />

dlpdfpagesetbleed,<br />

dlpdfpagesetcrop,<br />

dlpdfpagesettrim<br />

All <strong>DLI</strong>-supported platforms.


A.108 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfpagesettrim (DLPDFPAGE *Page, ASFixedRect *Rect)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Sets the Trim box for the DLPDFPAGE provided as input to the<br />

function. Please see the "Page Boundaries" section of Prepress<br />

Support in the Adobe PDF <strong>Reference</strong> Manual for more details.<br />

• DLPDFPAGE *Page<br />

• ASFixedRect *Rect<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfpagesetart,<br />

dlpdfpagesetbleed,<br />

dlpdfpagesetcrop,<br />

dlpdfpagesetmediabox<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.109<br />

dlpdfpathaddarc (DLPDFPATH *Path, ASFixed X, ASFixed Y,<br />

ASFixed Rad, ASFixed T1, ASFixed T2)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Appends an arc segment to the current path. The current position<br />

will be set to the ending point.<br />

• DLPDFPATH *Path: Pointer to the path.<br />

• ASFixed X: Starting X position of the arc<br />

• ASFixed Y: Starting Y position of the arc<br />

• ASFixed Rad: Radius of the arc<br />

• ASFixed T1: Start angle for the arc<br />

• ASFixed T2: End angle for the arc<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfpathaddarcn,<br />

dlpdfpatthaddarcto,<br />

dlpdfpathaddelliparc,<br />

dlpdfpathadddelliparcn,<br />

dlpdfpathaddelliparcto<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 If the current position is not the starting position defined by (X,Y,Radius,StartAngle), then a<br />

straight line segment will be added from the current position to get there. A smooth curve of the<br />

specified radius will be drawn from that specified point counter-clockwise to the angle specified by<br />

EndAngle.<br />

2 If the starting <strong>and</strong> ending degree values specify the same angle, a full circle will be drawn, <strong>and</strong> the<br />

position following this comm<strong>and</strong> will be the specified position.


A.110 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfpathaddarcn (DLPDFPATH *Path, ASFixed X, ASFixed Y,<br />

ASFixed Rad, ASFixed T1, ASFixed T2)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Identical to dlpdfpathaddarc, except the arc will be drawn<br />

clockwise.<br />

• DLPDFPATH *Path is the pointer to the path.<br />

• ASFixed X<br />

• ASFixed Y<br />

• ASFixed Rad<br />

• ASFixed T1<br />

• ASFixed T2<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfpathaddarc,<br />

dlpdfpatthaddarcto,<br />

dlpdfpathaddelliparc,<br />

dlpdfpathadddelliparcn,<br />

dlpdfpathaddelliparcto<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.111<br />

dlpdfpathaddarcto (DLPDFPATH *Path, ASFixed X1, ASFixed Y1,<br />

ASFixed X2, ASFixed Y2, ASFixed Rad)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Appends a straight line segment from the current position<br />

towards the first pair of X <strong>and</strong> Y coordinates specified, terminating<br />

when it intersects an arc connecting this line to a second line<br />

drawn between the first <strong>and</strong> second pairs of (X,Y) coordinates.<br />

The arc is circular, drawn at the specified radius.<br />

• DLPDFPATH *Path is the pointer to the path.<br />

• ASFixed X1 is the X-axis position of the intersection of<br />

tangents.<br />

• ASFixed Y1 is the Y-axis position of the intersection of<br />

tangents.<br />

• ASFixed X2 is the X-axis position of a point defining the<br />

second tangent.<br />

• ASFixed Y2 is the Y-axis position of a point defining the<br />

second tangent.<br />

• ASFixed Rad is the radius of the arc.<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfpathaddarcn,<br />

dlpdfpatthaddarc,<br />

dlpdfpathaddelliparc,<br />

dlpdfpathadddelliparcn,<br />

dlpdfpathaddelliparcto<br />

All <strong>DLI</strong>-supported platforms.


A.112 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Xint1/<br />

Yint1<br />

X1/Y1<br />

Xint2/<br />

Yint2<br />

Current Position<br />

X2/Y2<br />

Technical Notes<br />

1 The two lines (CurrX,CurrY)->(X1,Y1) <strong>and</strong> (X2,Y2)->(X1,Y1) are joined by an arc of radius (Rad).<br />

The line segment from the current position to the start of the arc is drawn, followed by the arc itself,<br />

finishing at (Xint2,Yint2). The line segment from the end of the arc to the point (X2,Y2) is not<br />

drawn.<br />

2 The position following this comm<strong>and</strong> will be the intersection of the arc with the line (X2,Y2)-<br />

>(X1,Y1), shown above as (Xint2,Yint2). If the two lines are colinear, a straight line segment is<br />

drawn from the current position to (X1,Y1), which then becomes the current point.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.113<br />

dlpdfpathaddclose (DLPDFPATH *Path)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Appends a “close path” operator to the path. The current<br />

position after the path is closed is (1,-1).<br />

DLPDFPATH *Path is the pointer to the path<br />

void<br />

Exceptions<br />

Header<br />

dli.h<br />

Related Methods<br />

Availability<br />

All <strong>DLI</strong>-supported platforms.


A.114 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfpathaddcurve (DLPDFPATH *Path, ASFixed Ctrl1X,<br />

ASFixed Ctrl1Y, ASFixed Ctrl2X, ASFixed Ctrl2Y, ASFixed EndX,<br />

ASFixed EndY)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

Adds a spline or cubic Bézier curve to the path.<br />

• DLPDFPATH *Path is the pointer to the path.<br />

• ASFixed Ctrl1X is the X position of a point which will be<br />

Control Point 1.<br />

• ASFixed Ctrl1Y is the Y position of a point which will be<br />

Control Point 1.<br />

• ASFixed Ctrl2X is the X position of a point which will be<br />

Control Point 2.<br />

• ASFixed Ctrl2Y is the Y position of a point which will be<br />

Control Point 2.<br />

• ASFixed EndX is the X position which will be the end point<br />

of the curve.<br />

• ASFixed EndY is the Y position which will be the end point<br />

of the curve.<br />

void<br />

genErrBadParam is returned if no starting point is specified.<br />

dli.h<br />

dlpdfpathaddcurver,<br />

dlpdfpathaddcurvev,<br />

dlpdfpathaddcurvey<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.115<br />

Ctrl1X/<br />

Ctrl1Y<br />

EndX/<br />

EndY<br />

StartX/<br />

StartY<br />

Ctrl2X/<br />

Ctrl2Y<br />

Technical Notes<br />

1 A smooth curve (a cubic Bézier) will be drawn from the current position to the end position, under<br />

direction of the two control points. At completion of this operation, the current position will be the<br />

end position of the line. If the end position specified is identical to the current position, no segment will<br />

be appended <strong>and</strong> no notice will be given (optimization).<br />

2 All Bézier curves consist of four points. This method (as well as dlpdfpathaddcurver,<br />

dlpdfpathaddcurvev <strong>and</strong> dlpdfpathaddcurvey) uses current position as the starting point of<br />

the curve. The first two parameters of this method are the position of Control Point1, the second two<br />

parameters are the position of Control Point 2, <strong>and</strong> the last two parameters are the position of the end<br />

point of the curve.<br />

3 If no starting point is specified, the method will raise an exception (genErrBadParm).


A.116 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfpathaddcurver (DLPDFPATH *Path, ASFixed Ctrl1X,<br />

ASFixed Ctrl1Y, ASFixed Ctrl2X, ASFixed Ctrl2Y, ASFixed EndX,<br />

ASFixed EndY)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Identical to dlpdfpathaddcurve, except that the positions<br />

are expressed as relative distances from the current point, not<br />

absolute distances from the origin.<br />

• DLPDFPATH *Path is the pointer to the path<br />

• ASFixed Ctrl1X is the X position of a point which will be<br />

Control Point 1.<br />

• ASFixed Ctrl1Y is the Y position of a point which will be<br />

Control Point 1.<br />

• ASFixed Ctrl2X is the X position of a point which will be<br />

Control Point 2.<br />

• ASFixed Ctrl2Y is the Y position of a point which will be<br />

Control Point 2.<br />

• ASFixed EndX is the X position which will be the end point<br />

of the curve.<br />

• ASFixed EndY is the Y position which will be the end point<br />

of the curve.<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfpathaddcurve,<br />

dlpdfpathaddcurvev,<br />

dlpdfpathaddcurvey<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.117<br />

dlpdfpathaddcurvev (DLPDFPATH *Path, ASFixed Ctrl2X,<br />

ASFixed Ctrl2Y, ASFixed EndX, ASFixed EndY)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Identical to dlpdfpathaddcurve, except that both the start<br />

<strong>and</strong> first control point are assumed to be the current position.<br />

• DLPDFPATH *Path: The pointer to the path.<br />

• ASFixed Ctrl2X: The X position of a point which will be<br />

Control Point 2.<br />

• ASFixed Ctrl2Y: The Y position of a point which will be<br />

Control Point 2.<br />

• ASFixed EndX: The X position which will be the end point<br />

of the curve.<br />

• ASFixed EndY: The Y position which will be the end point<br />

of the curve.<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfpathaddcurve,<br />

dlpdfpathaddcurver,<br />

dlpdfpathaddcurvey<br />

All <strong>DLI</strong>-supported platforms.<br />

EndX/<br />

EndY<br />

StartX/<br />

StartY<br />

Ctrl1X/<br />

Ctrl1Y<br />

Ctrl2X/<br />

Ctrl2Y<br />

Technical Notes<br />

1 This method is identical to dlpdfpathaddcurve, except that both the start <strong>and</strong> first control point<br />

are assumed to be the current position.


A.118 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfpathaddcurvey (DLPDFPATH *Path, ASFixed Ctrl1X,<br />

ASFixed Ctrl1Y, ASFixed EndX, ASFixed EndY)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Identical to dlpdfpathaddcurve, except that the second<br />

control point is assumed to be the ending position.<br />

• DLPDFPATH *Path is the pointer to the path<br />

• ASFixed Ctrl1X<br />

• ASFixed Ctrl1Y<br />

• ASFixed EndX<br />

• ASFixed EndY<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfpathaddcurve,<br />

dlpdfpathaddcurver,<br />

dlpdfpathaddcurvev<br />

All <strong>DLI</strong>-supported platforms.<br />

Ctrl1X/<br />

Ctrl1Y<br />

StartX/<br />

StartY<br />

EndX/<br />

EndY<br />

Ctrl2X/<br />

Ctrl2Y<br />

Technical Notes<br />

1 This method is identical to dlpdfpathaddcurve, except that the second control point is assumed to<br />

be the ending position.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.119<br />

dlpdfpathaddelliparc (DLPDFPATH *Path, ASFixed CentX,<br />

ASFixed CentY, ASFixed HRad, ASFixed VRad, ASFixed T1, ASFixed T2)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Appends an arc segment to the current path. This method<br />

accepts seven parameters.<br />

• DLPDFPATH *Path is the pointer to the path.<br />

• ASFixed CentX is the X-axis position of the arc center<br />

point.<br />

• ASFixed CentY is the Y-axis position of the arc center<br />

point.<br />

• ASFixed HRad is the horizontal radius of the ellipse<br />

defining an arc segment.<br />

• ASFixed VRad is the vertical radius of the same ellipse. The<br />

HRad <strong>and</strong> VRad functions support creating arc segments<br />

from an elliptical shape, as opposed to the circular shape<br />

described in dlpdfpathaddarc, although if the same<br />

value is used for both horizontal <strong>and</strong> vertical radii, it behaves<br />

identically to dlpdfpathaddarc.<br />

• ASFixed T1 is the beginning arc angle (where zero is<br />

directly to the right of center).<br />

• ASFixed T2 is the ending arc angle.<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

dli.h<br />

dlpdfpathaddarc,<br />

dlpdfpathaddarcn,<br />

dlpdfpatthaddarcto,<br />

dlpdfpathadddelliparcn,<br />

dlpdfpathaddelliparcto<br />

Availability<br />

Technical Notes<br />

1 If the current position does not coincide with the position defined by<br />

(CentX,CentY,HRad,VRad,StartAngle), then a straight line segment will be added from the<br />

current position to get there. A smooth curve of the specified radius will be drawn from that specified<br />

point counter-clockwise to the point specified by (CentX,CentY,HRad,VRad,EndAngle). The current<br />

position will be set to that ending point. If the starting <strong>and</strong> ending points specify the same angle, a full<br />

circle will be drawn.<br />

2 The position following this comm<strong>and</strong> will be the specified position.


A.120 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfpathaddelliparcn (DLPDFPATH *Path, ASFixed CentX,<br />

ASFixed CentY, ASFixed HRad, ASFixed VRad, ASFixed T1, ASFixed T2)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

This method is identical to dlpdfpathaddelliparc,<br />

except that the arc will be drawn clockwise.<br />

• DLPDFPATH *Path is the pointer to the path.<br />

• ASFixed CentX is the X-axis position of the arc center<br />

point.<br />

• ASFixed CentY is the Y-axis position of the arc center<br />

point.<br />

• ASFixed HRad is the horizontal radius of the ellipse<br />

defining an arc segment.<br />

• ASFixed VRad is the vertical radius of the same ellipse. The<br />

HRad <strong>and</strong> VRad functions support creating arc segments<br />

from an elliptical shape, as opposed to the circular shape<br />

described in dlpdfpathaddarc, although if the same<br />

value is used for both horizontal <strong>and</strong> vertical radii, it behaves<br />

identically to dlpdfpathaddarc.<br />

• ASFixed T1 is the beginning arc angle (where zero is<br />

directly to the right of center).<br />

• ASFixed T2 is the ending arc angle.<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfpathaddarc,<br />

dlpdfpathaddarcn,<br />

dlpdfpatthaddarcto,<br />

dlpdfpathaddelliparc,<br />

dlpdfpathaddelliparcto<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.121<br />

dlpdfpathaddelliparcto (DLPDFPATH *Path, ASFixed X1,<br />

ASFixed Y1, ASFixed X2, ASFixed Y2, ASFixed HRad, ASFixed VRad)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Appends a straight line segment from the current position<br />

towards the first pair of X <strong>and</strong> Y coordinates specified, terminating<br />

when it intersects an arc connecting this line to a second line<br />

drawn between the first <strong>and</strong> second pairs of (X,Y) coordinates.<br />

The arc is elliptical, drawn at the specified horizontal <strong>and</strong> vertical<br />

radius.<br />

• DLPDFPATH *Path: The pointer to the path<br />

• ASFixed X1: The Xposition of the intersection of tangents<br />

• ASFixed Y1: The Yposition of the intersection of tangents<br />

• ASFixed X2: The Xposition of the endpoint of the second<br />

tangent<br />

• ASFixed Y2: The Yposition of the endpoint of the second<br />

tangent<br />

• ASFixed HRad: The horizontal radius of the arc<br />

• ASFixed VRad: The vertical radius of the arc<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfpathaddarc,<br />

dlpdfpathaddarcn,<br />

dlpdfpathaddarcto,<br />

dlpdfpathaddelliparc<br />

All <strong>DLI</strong>-supported platforms.


A.122 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfpathaddline (DLPDFPATH *Path, ASFixed X, ASFixed Y)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Draws a line from the current position to the specified new position.<br />

If the current position is the same as the new position, no<br />

line segment will be added to the path <strong>and</strong> no notice will be<br />

given. The current position following this comm<strong>and</strong> will be the<br />

specified position.<br />

• DLPDFPATH *Path is the pointer to the path.<br />

• ASFixed X is the absolute X-axis position.<br />

• ASFixed Y is the absolute Y-axis position.<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfpathaddliner<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.123<br />

dlpdfpathaddliner (DLPDFPATH *Path, ASFixed X, ASFixed Y)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Draws a line from the current position for the given X <strong>and</strong> Y offset<br />

distances (i.e. this is a movement relative to the current position).<br />

If the distances specified are both zero, no line segment<br />

will be added to the path <strong>and</strong> no notice will be given. The position<br />

following this comm<strong>and</strong> will be the position derived by<br />

applying the X <strong>and</strong> Y offsets to the prior position.<br />

• DLPDFPATH *Path is the pointer to the path.<br />

• ASFixed X is the X-axis distance to draw from the current X<br />

position to the new X position.<br />

• ASFixed Y is the Y-axis distance to draw from the current Y<br />

position to the specified Y position.<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfpathaddline<br />

All <strong>DLI</strong>-supported platforms.


A.124 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfpathaddmove (DLPDFPATH *Path, ASFixed X, ASFixed Y)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Moves the current position to the specified new position without<br />

adding a stroked line. If the current position is the same as<br />

the specified new position, no adjustment of the current position<br />

will be added to the path <strong>and</strong> no notice will be given. The<br />

position following this comm<strong>and</strong> will be the specified position.<br />

• DLPDFPATH *Path is the pointer to the path.<br />

• ASFixed X is the specified X-axis position.<br />

• ASFixed Y is the specified Y-axis position.<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfpathaddmover<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.125<br />

dlpdfpathaddmover (DLPDFPATH *Path, ASFixed X, ASFixed Y)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Moves the current position for the given X <strong>and</strong> Y offset distances<br />

(i.e. this is a movement relative to the current position). If<br />

the distances specified are both zero, no movement will be<br />

added to the path <strong>and</strong> no notice will be given. The position following<br />

this comm<strong>and</strong> will be derived by applying the X <strong>and</strong> Y<br />

offsets to the prior position.<br />

• DLPDFPATH *Path is the pointer to the path.<br />

• ASFixed X is the X-axis distance to move from the current X<br />

position to the new X position.<br />

• ASFixed Y is the Y-axis distance to move from the current Y<br />

position to the new Y position.<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfpathaddmove<br />

All <strong>DLI</strong>-supported platforms.


A.126 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfpathaddrect (DLPDFPATH *Path, ASFixed X, ASFixed Y,<br />

ASFixed Width, ASFixed Depth)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Draws a rectangle.<br />

• DLPDFPATH *Path is the pointer to the path<br />

• ASFixed X is the X position of a point which will be one<br />

corner of the box<br />

• ASFixed Y is the Y position of a point which will be one<br />

corner of the box<br />

• ASFixed Width will be the width of the box<br />

• ASFixed Depth will be the depth of the box<br />

void<br />

Exceptions<br />

Header<br />

dli.h<br />

Related Methods<br />

Availability<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 If the specified position is not the current position, a MoveTo to the specified position will be made. A<br />

rectangle will be added to the path, starting at the specified position <strong>and</strong> proceeding upward (unless<br />

Depth is negative) <strong>and</strong> to the right (unless Width is negative). The end position after this operation<br />

will be the specified position. If Width <strong>and</strong> Depth are both zero, no segment will be appended, but<br />

the current position will still be updated.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.127<br />

dlpdfpatharray (DLPDFPATH *Path)<br />

Return Value: ASFixed*<br />

Description<br />

Parameters<br />

Return Value<br />

This method will return a pointer to the first member of the<br />

array of ASFixed integers, which is the path.<br />

DLPDFPATH *Path is the pointer to the path.<br />

ASFixed*<br />

Exceptions<br />

Header<br />

dli.h<br />

Related Methods<br />

Availability<br />

All <strong>DLI</strong>-supported platforms.


A.128 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfpathclear (DLPDFPATH *Path)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Exceptions<br />

Header<br />

Used to reset a path, this method will set the current position to<br />

UNSET, set the matrix to UNITY, <strong>and</strong> remove any path segment<br />

present. It will not deallocate the array used to hold the path,<br />

however, since its primary purpose is to lower the overhead<br />

associated with allocation <strong>and</strong> deallocation.<br />

DLPDFPATH *Path is the pointer to the path.<br />

void<br />

genErrBadParam is raised if the method is called with a NULL<br />

pointer.<br />

dli.h<br />

Related Methods<br />

Availability<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.129<br />

dlpdfpathcreate (void)<br />

Return Value: DLPDFPATH*<br />

Description<br />

Parameters<br />

Return Value<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

Creates a new, empty DLPDFPATH structure.<br />

None<br />

DLPDFPATH*<br />

genErrNoMemory<br />

dli.h<br />

dlpdfpathdestroy<br />

All <strong>DLI</strong>-supported platforms.


A.130 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfpathcurrentx (DLPDFPATH *Path)<br />

Return Value: ASFixed<br />

Description<br />

Parameters<br />

Return Value<br />

This method will return the current X position as an ASFixed<br />

value.<br />

DLPDFPATH *Path is the pointer to the path<br />

ASFixed<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfpathcurrenty<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.131<br />

dlpdfpathcurrenty (DLPDFPATH *Path)<br />

Return Value: ASFixed<br />

Description<br />

Parameters<br />

Return Value<br />

This method will return the current Y position as an ASFixed<br />

value.<br />

DLPDFPATH *Path is the pointer to the path.<br />

ASFixed<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfpathcurrentx<br />

All <strong>DLI</strong>-supported platforms.


A.132 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfpathdestroy (DLPDFPATH *Path)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

Destroys a DLPDFPATH structure <strong>and</strong> frees its resources.<br />

DLPDFPATH *Path: The pointer to the path<br />

void<br />

genErrBadParam: Raised if the pointer is not valid<br />

dli.h<br />

dlpdfpathcreate<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.133<br />

dlpdfpathsetmatrix (DLPDFPATH *Path, ASFixedMatrix *Matrix)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Exceptions<br />

Header<br />

This method will accept a pointer to a path <strong>and</strong> a pointer to a<br />

matrix. The specified matrix will be concatenated to the matrix<br />

of the container in each container in which this path is drawn.<br />

This allows the user complete <strong>and</strong> flexible control of the shape<br />

drawn by the path.<br />

• DLPDFPATH *Path is the pointer to the path<br />

• ASFixedMatrix *Matrix<br />

void<br />

genErrBadParam exception is raised if the pointer to the path<br />

or the matrix is NULL<br />

dli.h<br />

Related Methods<br />

Availability<br />

All <strong>DLI</strong>-supported platforms.


A.134 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfpathsize (DLPDFPATH *Path)<br />

Return Value: ASInt32<br />

Description<br />

Parameters<br />

Return Value<br />

This method will return the current size of the path array as an<br />

integer.<br />

DLPDFPATH *Path is the pointer to the path.<br />

ASInt32<br />

Exceptions<br />

Header<br />

dli.h<br />

Related Methods<br />

Availability<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.135<br />

dlpdfpatterncreate (DLPDFDOC *Doc, DLPDFCONTENT<br />

*Content, ASFixedRect *BBox, ASFixedMatrix *Matrix, int Colored,<br />

int TileType, ASFixed XStep, ASFixed YStep)<br />

Return Value: DLPDFPATTERN*<br />

Description<br />

Parameters<br />

Return Value<br />

This creates a patterned color space <strong>and</strong> returns a pointer to<br />

that space. The pointer may be used in dlpdfcontentusefillpattern<br />

or dlpdfcontentusestrokepattern to<br />

apply this colored pattern to all following material. All patterns<br />

will be destroyed <strong>and</strong> their h<strong>and</strong>les invalidated at the destruction<br />

of the document that contains them.<br />

• DLPDFDOC *Doc: represents the document structure <strong>and</strong><br />

the current status of the document at all times.<br />

• DLPDFCONTENT *Content: Represents the content<br />

element. These structures are destroyed when associated<br />

with a page or form, <strong>and</strong> pointers to them should not be<br />

used after that time.<br />

• ASFixedRect *BBox<br />

• ASFixedMatrix *Matrix<br />

• int Colored<br />

• int TileType<br />

• ASFixed XStep<br />

• ASFixed YStep<br />

DLPDFPATTERN*<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfcontentusefillpattern,<br />

dlpdfcontentusestrokepattern<br />

All <strong>DLI</strong>-supported platforms.


A.136 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfpatternrotate (ASFixedMatrix *Matrix, ASFixed Angle)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

This function will modify the specified matrix so as to effect counterclockwise<br />

rotation of any marks drawn via this matrix. Angle is an angle<br />

in degrees <strong>and</strong> fractions of degrees.<br />

• ASFixedMatrix *Matrix<br />

• ASFixed Angle<br />

void<br />

Exceptions<br />

Header<br />

dli.h<br />

Related Methods<br />

Availability<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.137<br />

dlpdfpageplacesignature (DLPDFPAGE *Page,<br />

DLPDFSIGNATURE *Sig, ASFixedRect *imageBBox)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

This call associates a digital signature to a page in the PDF file<br />

generated by <strong>DLI</strong>. This call is required for all digital signatures<br />

including invisible ones, although for invisible digital signatures,<br />

the imageBBox is ignored <strong>and</strong> may be NULL.<br />

• DLPDFPAGE *Page: page to receive the signature<br />

• DLPDFSIGNATURE *Sig: signature to be associated with<br />

the page<br />

• ASFixedRect *imageBBox: bounding box in which<br />

signature must fit.<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfdoccreatesignature,<br />

dlpdfdocsetsignatureappearance<br />

dlpdfdocwritepdf<br />

All <strong>DLI</strong>-supported platforms.


A.138 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfseterrorfile (FILE *errorFilePtr)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Sets file to which error messages will be logged.<br />

File *errorFilePtr: By default error messages are logged<br />

to stderr<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfsetwarningfile<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.139<br />

dlpdfsetwarningfile (FILE * warningFilePtr)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Sets file to which warning messages will be logged.<br />

File *warningFilePtr: By default warning messages are<br />

not logged.<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfseterrorfile<br />

All <strong>DLI</strong>-supported platforms.


A.140 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfsignaturesetdatacallback<br />

(DLPDFSIGNATURE *signature, void (*dataCallback)(char *, int))<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

This is an optional call for clients using PKCS #7 certificates. A<br />

callback function is supplied for the signature.<br />

• DLPDFSIGNATURE *signature: signature with which<br />

PKCS #7 certificate will be associated<br />

• void (*dataCallback)(char *, int): callback<br />

function, called during the dlpdfdocwritepdf function<br />

call; see Technical Notes below.<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfsignaturesetpkcs7cert<br />

dlpdfdocwritepdf<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 The callback is called during the dlpdfdocwritepdf function with binary information from the<br />

PDF file. This information will be in sequential pieces, <strong>and</strong> may be used to generate the PDF document<br />

hash value. The information is supplied as binary values in the character buffer; the length to read is<br />

supplied as the second parameter.<br />

2 A length of 0 (zero) passed in the callback function indicates that no further data is to be read, <strong>and</strong> the<br />

hash may be finalized.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.141<br />

dlpdfsignaturesetpkcs7cert (DLPDFSIGNATURE *signature,<br />

int maxLen, int (*genPKCS7Cert)(char *))<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

This function sets the certificate generation callback for DLPDF-<br />

SIGNATUREs of type dlpdfsigacropkcs7 <strong>and</strong> dlpdfsigverisign.<br />

• DLPDFSIGNATURE *signature: signature with which<br />

certificate will be associated<br />

• int maxlen: number of bytes provided to the<br />

genPKCS7Cert callback<br />

• int (*genPKCS7Cert)(char *): callback function, called during<br />

the dlpdfdocwritepdf function call; see Technical Notes<br />

below.<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfdocwritepdf<br />

dlpdfsignaturesetdatacallback<br />

dlpdfsignaturesetx509cert<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 For these signature types, dlpdfsigacropkcs7 <strong>and</strong> dlpdfsigverisign, the application using<br />

<strong>DLI</strong> is required to generated a fully-formed PKCS #7 certificate with an MD5 checksum of the PDF<br />

document, encrypted with the private key corresponding to the public key in the certificate. The RSA<br />

public-key algorithm with a 1024-bit key length is used.<br />

2 The genPKCS7Cert callback is called by <strong>DLI</strong> during the dlpdfdocwritepdf function call. The<br />

callback is supplied a binary data buffer of length maxLen. The first 16 bytes of this buffer contain the<br />

MD5 checksum (in binary) for the PDF document to sign. The callback must generate a PKCS #7<br />

certificate as described above, <strong>and</strong> fill the data buffer with the certificate, in binary. The callback<br />

function must return the length to read from the data buffer, in bytes.<br />

NOTE: maxLen bytes are set aside in the output PDF file for the PKCS #7<br />

certificate, <strong>and</strong> will be written to the PDF file regardless of the actual certificate<br />

length. Callers should pass length values which are close to the certificate length,<br />

if possible.


A.142 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfsignaturesetx509cert (DLPDFSIGNATURE *signature,<br />

char *certificate, int certLen, void (*encryptSHA1Hash)(char *))<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

This call associates an x.509 v3 certificate with a DLPDFSIGNA-<br />

TURE object created as a dlpdfsigacrox509 certificate digital<br />

signature.<br />

• DLPDFSIGNATURE *signature: signature with which<br />

x.509 v3 certificate will be associated<br />

• char *certificate: a binary buffer in the certificate<br />

parameter; <strong>DLI</strong> will read certLen bytes from this buffer <strong>and</strong><br />

make a copy for the PDF file's digital signature<br />

• int certLen: number of bytes to be read from certificate<br />

buffer<br />

• void (*encryptSHA1Hash)(char *): callback<br />

function, called during the dlpdfdocwritepdf function<br />

call; see Technical Notes below.<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfdocwritepdf<br />

dlpdfsignaturesetpkcs7cert<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 It is an error to call this with a DLPDFSIGNATURE object created as a different certificate type.<br />

2 The last parameter is a required callback function. This function will be called during the<br />

dlpdfdocwritepdf function call. It will be passed a character string containing the SHA-1 hash for<br />

the PDF file being written, as a NULL-terminated string of hexadecimal digits using PKCS #1 padding,<br />

containing a BER OID (object identifier) for the SHA-1 algorithm. The buffer is 256 bytes long (not<br />

including the NULL terminator), <strong>and</strong> formatted as<br />

0001FFFF .. FF003021300906052B0E03021A05000414<br />

[ 40 hex digits for SHA-1 hash ]<br />

3 The callback function must encrypt this hash value with the private key corresponding to the public<br />

key in the signature's x.509 certificate, <strong>and</strong> fill the buffer passed in with 256 hexadecimal digits<br />

representing the encrypted value for the supplied BER formatted hash. A 1024-bit key is used for<br />

encryption operations. Note that the signed hash will not have padding, <strong>and</strong> must be exactly 256<br />

hexadecimal digits. Zeros must be used for padding, if required.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.143<br />

dlpdfterm (DLPDFINSTANCE * instance)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Terminates the Adobe PDF Library <strong>and</strong> <strong>DLI</strong>. All active documents<br />

should be closed prior to this call.<br />

DLPDFINSTANCE *instance<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdfinit,<br />

dlpdfttload<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 This will typically be one of the last calls of a program using <strong>DLI</strong>.<br />

2 In a multi-threaded application, each thread must do its own initialization <strong>and</strong> termination of the<br />

Library.<br />

3 dlpdfinit <strong>and</strong> dlpdfterm are the only methods which must not be enclosed in exception h<strong>and</strong>lers<br />

(i.e. DURING/HANDLER/END_HANDLER statements), because they are not set up before initialization,<br />

<strong>and</strong> are freed during termination.<br />

4 As of <strong>DLI</strong> v3.0.11, the dlpdfterm call now removes memory files used for the dlpdfttload call if<br />

the Files In Memory filesystem is used, <strong>and</strong> if these files are no longer in use.


A.144 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdftext (void *Text, ASUns32 Length, ASAtom Encoding)<br />

Return Value: DLPDFTEXT*<br />

Description<br />

Parameters<br />

Return Value<br />

Returns a DLPDFTEXT structure for the given Text <strong>and</strong><br />

Length, in the given Encoding.<br />

• void *Text: the text to be passed to the DLPDFTEXT<br />

structure<br />

• ASUns32 Length: Length of the Text string in bytes.<br />

• ASAtom Encoding: Encoding of the input Text; a valid<br />

ICU Encoding value; see Technical Notes below<br />

DLPDFTEXT*<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdftextfromutf8,<br />

dlpdftextfromutf16be,<br />

dlpdftextfromutf16he,<br />

dlpdftextfromutf16le,<br />

dlpdftextfromutf32be,<br />

dlpdftextfromutf32he,<br />

dlpdftextfromutf32le<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 Text passed to this method does not require a NULL terminator, since its Length is given as a calling<br />

argument. Conversely, the related methods listed above do not accept a Length argument, <strong>and</strong><br />

assume that a NULL terminator is present.<br />

2 Valid ICU Encoding values for the Encoding argument of this method can be obtained via the<br />

dlpdftextshowencodingnames call.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.145<br />

dlpdftextadvance (DLPDFTEXT *Text, DLPDFFONT *Font,<br />

PDEGraphicState *GState, PDETextState *TState,<br />

ASFixed PointSize, ASFixed SetWidth, dlpdftext_X XMeaning,<br />

ASFixed Angle, ASFixedPoint *Advance)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

This method supplies the x <strong>and</strong> y advance for a string in a DLP-<br />

DFTEXT area.<br />

• DLPDFTEXT *Text: the text structure to be acted upon<br />

• DLPDFFONT *Font: The specified font<br />

• PDEGraphicState *GState: Contains definitions of<br />

colors to be applied, <strong>and</strong> line sizes <strong>and</strong> parameters to be used<br />

when drawing a path<br />

• PDETextState *TState: Current text state; should not<br />

be NULL. A zero-filled PDETextState parameter is<br />

permitted.<br />

• ASFixed PointSize: Point size<br />

• ASFixed SetWidth: Set width<br />

• dlpdftext_X XMeaning: DLPDFTEXT_X_LEFT or<br />

DLPDFTEXT_X_RIGHT, used to indicate whether the<br />

starting location is the left or right end (respectively) of the<br />

text, distinguishing a left-to-right line order (e.g. English)<br />

from a right-to-left line order (e.g. Arabic)<br />

• ASFixed Angle: Angle of flow, in degrees, as an<br />

ASFixed counterclockwise angle<br />

• ASFixedPoint *Advance: The returned x <strong>and</strong> y position<br />

change after evaluation of the text<br />

void<br />

Exceptions<br />

Header<br />

dli.h<br />

Related Methods<br />

Availability<br />

All <strong>DLI</strong>-supported platforms.


A.146 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdftextdestroy (DLPDFTEXT *Text)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

This method destroys the indicated DLPDFTEXT instance.<br />

DLPDFTEXT *Text: the text structure to be acted upon<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdftext<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.147<br />

dlpdftextfromutf16be (void *Text)<br />

Return Value: DLPDFTEXT*<br />

Description<br />

Parameters<br />

Return Value<br />

Returns a DLPDFTEXT structure for the given UTF16 big-endian<br />

Unicode Text string.<br />

void *Text: the text to be passed to the DLPDFTEXT structure<br />

DLPDFTEXT*<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdftext,<br />

dlpdftextfromutf16he,<br />

dlpdftextfromutf16le,<br />

dlpdftextfromutf32be,<br />

dlpdftextfromutf32he,<br />

dlpdftextfromutf32le,<br />

dlpdftextfromutf8<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 Text passed to this method requires a NULL terminator. Only the related method dlpdftext will<br />

accept unterminated text strings, since that method includes Length as an additional calling<br />

argument.


A.148 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdftextfromutf16he (void *Text)<br />

Return Value: DLPDFTEXT*<br />

Description<br />

Parameters<br />

Return Value<br />

Returns a DLPDFTEXT structure for the given UTF16 hostendian<br />

Unicode Text string.<br />

void *Text: the text to be passed to the DLPDFTEXT structure<br />

DLPDFTEXT*<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdftext,<br />

dlpdftextfromutf16be,<br />

dlpdftextfromutf16le,<br />

dlpdftextfromutf32be,<br />

dlpdftextfromutf32he,<br />

dlpdftextfromutf32le,<br />

dlpdftextfromutf8<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 Text passed to this method requires a NULL terminator. Only the related method dlpdftext will<br />

accept unterminated text strings, since that method includes Length as an additional calling<br />

argument.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.149<br />

dlpdftextfromutf16le (void *Text)<br />

Return Value: DLPDFTEXT*<br />

Description<br />

Parameters<br />

Return Value<br />

Returns a DLPDFTEXT structure for the given UTF16 littleendian<br />

Unicode Text string.<br />

void *Text: the text to be passed to the DLPDFTEXT structure<br />

DLPDFTEXT*<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdftext,<br />

dlpdftextfromutf16be,<br />

dlpdftextfromutf16he,<br />

dlpdftextfromutf32be,<br />

dlpdftextfromutf32he,<br />

dlpdftextfromutf32le,<br />

dlpdftextfromutf8<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 Text passed to this method requires a NULL terminator. Only the related method dlpdftext will<br />

accept unterminated text strings, since that method includes Length as an additional calling<br />

argument.


A.150 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdftextfromutf32be (void *Text)<br />

Return Value: DLPDFTEXT*<br />

Description<br />

Parameters<br />

Return Value<br />

Returns a DLPDFTEXT structure for the given UTF32 big-endian<br />

Unicode Text string.<br />

void *Text: the text to be passed to the DLPDFTEXT structure<br />

DLPDFTEXT*<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdftext,<br />

dlpdftextfromutf16be,<br />

dlpdftextfromutf16he,<br />

dlpdftextfromutf16le,<br />

dlpdftextfromutf32he,<br />

dlpdftextfromutf32le,<br />

dlpdftextfromutf8<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 Text passed to this method requires a NULL terminator. Only the related method dlpdftext will<br />

accept unterminated text strings, since that method includes Length as an additional calling<br />

argument.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.151<br />

dlpdftextfromutf32he (void *Text)<br />

Return Value: DLPDFTEXT*<br />

Description<br />

Parameters<br />

Return Value<br />

Returns a DLPDFTEXT structure for the given UTF32 hostendian<br />

Unicode Text string.<br />

void *Text: the text to be passed to the DLPDFTEXT structure<br />

DLPDFTEXT*<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdftext,<br />

dlpdftextfromutf16be,<br />

dlpdftextfromutf16he,<br />

dlpdftextfromutf16le,<br />

dlpdftextfromutf32be,<br />

dlpdftextfromutf32le,<br />

dlpdftextfromutf8<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 Text passed to this method requires a NULL terminator. Only the related method dlpdftext will<br />

accept unterminated text strings, since that method includes Length as an additional calling<br />

argument.


A.152 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdftextfromutf32le (void *Text)<br />

Return Value: DLPDFTEXT*<br />

Description<br />

Parameters<br />

Return Value<br />

Returns a DLPDFTEXT structure for the given UTF32 littleendian<br />

Unicode Text string.<br />

void *Text: the text to be passed to the DLPDFTEXT structure<br />

DLPDFTEXT*<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdftext,<br />

dlpdftextfromutf16be,<br />

dlpdftextfromutf16he,<br />

dlpdftextfromutf16le,<br />

dlpdftextfromutf32be,<br />

dlpdftextfromutf32he,<br />

dlpdftextfromutf8<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 Text passed to this method requires a NULL terminator. Only the related method dlpdftext will<br />

accept unterminated text strings, since that method includes Length as an additional calling<br />

argument.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.153<br />

dlpdftextfromutf8 (void *Text)<br />

Return Value: DLPDFTEXT*<br />

Description<br />

Parameters<br />

Return Value<br />

Returns a DLPDFTEXT structure for the given UTF8 Unicode<br />

Text string.<br />

void *Text: the text to be passed to the DLPDFTEXT structure<br />

DLPDFTEXT*<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdftext,<br />

dlpdftextfromutf16be,<br />

dlpdftextfromutf16he,<br />

dlpdftextfromutf16le,<br />

dlpdftextfromutf32be,<br />

dlpdftextfromutf32he,<br />

dlpdftextfromutf32le<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 Text passed to this method requires a NULL terminator. Only the related method dlpdftext will<br />

accept unterminated text strings, since that method includes Length as an additional calling<br />

argument.


A.154 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdftextlength (DLPDFTEXT *Text)<br />

Return Value: ASUns32<br />

Description<br />

Parameters<br />

Return Value<br />

This method returns the length, in bytes, of the buffer for the<br />

stored string. NULL string terminators are not stored, <strong>and</strong> thus<br />

are not counted as part of the length.<br />

DLPDFTEXT *Text: the text structure to be acted upon<br />

ASUns32<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdftext,<br />

dlpdftextstring<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.155<br />

dlpdftextshowencodingnames (char *FileName)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Returns an output file of the given FileName, listing all valid<br />

Encoding names provided via the International Components for<br />

Unicode (ICU) module for use when calling dlpdftext to<br />

construct the DLPDFTEXT object.<br />

char *FileName: Name for the output file to be created<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdftext<br />

All <strong>DLI</strong>-supported platforms.


A.156 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdftextstring (DLPDFTEXT *Text)<br />

Return Value: char *<br />

Description<br />

Parameters<br />

This method returns the byte buffer for the stored string.<br />

DLPDFTEXT *Text: the text structure to be acted upon<br />

Return Value char *<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

dlpdftext,<br />

dlpdftextlength<br />

All <strong>DLI</strong>-supported platforms.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.157<br />

dlpdftexttocontent (DLPDFTEXT *Text,<br />

DLPDFCONTENT *Content, DLPDFFONT *Font,<br />

PDEGraphicState *GState, PDETextState *TState,<br />

ASFixed PointSize, ASFixed SetWidth, ASFixed XPos,<br />

ASFixed YPos, dlpdftext_X XMeaning, ASFixed Angle)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Parameters (continued)<br />

Return Value<br />

This method pastes the DLPDFTEXT string into a DLPDFCON-<br />

TENT area.<br />

• DLPDFTEXT *Text: the text structure to be acted upon<br />

• DLPDFCONTENT *Content: the target structure in which<br />

the text will be pasted<br />

• DLPDFFONT *Font: The specified font<br />

• PDEGraphicState *GState: Contains definitions of<br />

colors to be applied, <strong>and</strong> line sizes <strong>and</strong> parameters to be used<br />

when drawing a path<br />

• PDETextState *TState: The current text state. This<br />

should not be NULL. A zero-filled PDETextState<br />

parameter is permitted.<br />

• ASFixed PointSize: Point size<br />

• ASFixed SetWidth: Set width<br />

• ASFixed Xpos: X position of starting point within<br />

DLPDFCONTENT<br />

• ASFixed Ypos: Y position of starting point within<br />

DLPDFCONTENT<br />

• dlpdftext_X XMeaning: DLPDFTEXT_X_LEFT or<br />

DLPDFTEXT_X_RIGHT, used to indicate whether the<br />

starting location is the left or right end (respectively) of the<br />

text, distinguishing a left-to-right line order (e.g. English)<br />

from a right-to-left line order (e.g. Arabic)<br />

• ASFixed Angle: Angle of flow, in degrees, as an<br />

ASFixed counterclockwise angle<br />

void<br />

Exceptions<br />

Header<br />

dli.h<br />

Related Methods<br />

Availability<br />

All <strong>DLI</strong>-supported platforms.


A.158 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfttload (DLPDFINSTANCE *Instance, ASFile TTFont,<br />

ASAtom *Names, int NameLen)<br />

Return Value: int<br />

Description<br />

Parameters<br />

Return Value<br />

This method loads the given font from an ASFile TrueType or<br />

OpenType font file, or the fonts from a TrueType/OpenType Collection<br />

font file. These fonts are loaded into the supplied DLPD-<br />

FINSTANCE. Fonts loaded in this manner are used before<br />

searching the system directories for fonts.<br />

• DLPDFINSTANCE *Instance: the DLPDFINSTANCE for<br />

which the font(s) will be loaded<br />

• ASFile TTFont: fonts from file or collection to be loaded<br />

• ASAtom *Names: pointer to font ASAtom(s) to be loaded<br />

(one or more)<br />

• int NameLen: number of ASAtom *Names to be<br />

completed<br />

int: Number of fonts loaded<br />

Exceptions<br />

Header<br />

dli.h<br />

Related Methods<br />

Availability<br />

All <strong>DLI</strong>-supported platforms.<br />

Technical Notes<br />

1 This method does not fully support Adobe CFF-format OpenType font files. CMaps as defined in the<br />

PDF <strong>Reference</strong> Manual should be used for these fonts. <strong>Datalogics</strong> recommends creating them as<br />

CIDType0 fonts, using dlpdfcontentwidetext for setting text.<br />

2 <strong>DLI</strong> does not search directory paths or environmental variable entries for fonts loaded via<br />

dlpdfttload.<br />

3 If a given font file has already been loaded, dlpdfttload returns a -1, <strong>and</strong> does not re-parse the font<br />

file (for performance reasons).<br />

4 As of <strong>DLI</strong> v3.0.11, the dlpdfterm call now removes memory files used for the dlpdfttload call if<br />

the Files In Memory filesystem is used, <strong>and</strong> if these files are no longer in use.


<strong>DLI</strong> <strong>Reference</strong> <strong>Guide</strong> A.159<br />

GetGraphicFromList (DLPDFDOC *Doc, char *Name)<br />

Return Value: DLPDFIMAGE*<br />

Description<br />

Parameters<br />

Return Value<br />

Obtains a DLPDFIMAGE* by specifying the target document<br />

<strong>and</strong> the key for the graphic file.<br />

• DLPDFINSTANCE *Instance: Represents the document<br />

structure <strong>and</strong> the current status of the document at all times.<br />

• char *Name: Name string<br />

DLPDFIMAGE*: NULL is returned if the graphic is not found.<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

LoadGraphicList<br />

Available on OS/390 only


A.160 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

LoadGraphicList (char *ListFileName)<br />

Return Value: void<br />

Description<br />

Parameters<br />

Return Value<br />

Reads a cross-reference file which maps graphics keys to their<br />

physical location. The cross-reference table is accessed by the<br />

GetGraphicFromList method, <strong>and</strong>, once read, is stored in<br />

memory for the duration of the job.<br />

char *ListFileName: File name<br />

void<br />

Exceptions<br />

Header<br />

Related Methods<br />

Availability<br />

dli.h<br />

GetGraphicFromList<br />

Available on OS/390 only


Index<br />

A<br />

A key<br />

Use in Links 13.8<br />

AcroForm (Sample <strong>DLI</strong> Application) 17.15<br />

action (parameter)<br />

Use in Annotations <strong>and</strong> Links 13.2<br />

Action Dictionary<br />

Use in Links<br />

Creating Replacement 13.8<br />

Modifying 13.8<br />

Actions<br />

in Annotations <strong>and</strong> Links 13.2<br />

Adobe<br />

Acrobat 1.6, 1.7, 1.8, 2.2, 2.5, 14.1, 17.7, A.97<br />

Distiller 1.9, 2.5, 17.6<br />

Normalizer Server 11.2, 17.6<br />

Reader 1.6, 1.7, 1.9, 2.2, 2.5, 4.8, 13.4, 14.1,<br />

17.7, A.97<br />

Technical Notes<br />

#5189 (Adobe PDF Library Overview) 1.8<br />

#5190 (Acrobat Core API Overview) 1.8<br />

#5191 (Acrobat Core API <strong>Reference</strong>) 1.8<br />

#5414 (PDF Library Supplement to the<br />

Acrobat Core API) 1.8<br />

ADOBECMP<br />

OS/390 Location Search 4.11<br />

AdobeFnt.lst 2.2<br />

Efficient use of 2.3<br />

Naming variations 2.3<br />

Search path definition via PDFLDataRec 2.2<br />

Use in Default Search Path Suppression 1.16,<br />

1.17<br />

ADOBERES<br />

OS/390 Location Search 4.11<br />

allocProc<br />

Use in Setting Memory Allocation Routines 2.4<br />

Annotation Dictionary<br />

Modifying 13.8<br />

Annotations<br />

action (parameter) 13.2<br />

Border Specification 13.4<br />

Color Specification 13.4<br />

Components 13.2<br />

Content 13.4<br />

hot spot (parameter) 13.2<br />

Introduction 13.1<br />

Link<br />

Overview 13.2<br />

Modifying for Other Actions 13.2<br />

Open/Close Flag 13.4<br />

Opening the Document with Annotations<br />

Showing 14.4<br />

Text<br />

Overview 13.2<br />

Title 13.4<br />

Annotations (Sample <strong>DLI</strong> Application) 17.12<br />

Annotations <strong>and</strong> Links<br />

Borders<br />

Color 13.3<br />

Definition 13.3<br />

Calls 13.4, 13.5, 13.6, 13.7, 13.8<br />

Colors<br />

Links 13.3<br />

Text Annotations (when closed) 13.3<br />

ArcTo (PostScript operator) 8.6, A.4<br />

ASCII<br />

Use in Displaying Images 11.9<br />

ASCII85<br />

Use in Displaying Images 11.6<br />

ASFile 17.13<br />

ASFileSys<br />

Specifying an Alternate File System via<br />

dlpdfinit 2.8<br />

Use in Image Search using Files in Memory 1.16,<br />

2.9<br />

Use in Initializing <strong>and</strong> Terminating via <strong>DLI</strong> 2.8,<br />

2.9<br />

Use in Specifying an Alternate File System 2.8<br />

ASFixed<br />

Use in Basic Color Spaces<br />

Device Gray 12.6<br />

Use in Color Channels<br />

Definitions 12.5<br />

Inversion Correction 12.5<br />

Precision Correction 12.5<br />

Use in Color Description 12.2<br />

ASFixedMatrix<br />

Use in Line Drawing 10.12<br />

ASFixedRect<br />

Use in Displaying Images 11.8<br />

ASFixedRectangle<br />

Use in Annotations <strong>and</strong> Links 13.4, 13.5<br />

hot spot Definition 13.2<br />

ASGetErrorString<br />

Use in Error H<strong>and</strong>ling 16.2, 16.4<br />

ASGetExceptionErrorCode<br />

Use in Error H<strong>and</strong>ling 16.2<br />

ASPathName<br />

Use in Writing PDF Output to Memory 2.13<br />

ASSize_t<br />

Use in Writing PDF Output to Memory 2.14


I.ii<br />

<strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

B<br />

Background patterns, creating 17.14<br />

Backwards Compatibility, Ensuring 1.10, 2.6<br />

BBox (parameter)<br />

Use in Content Interface Calls 8.15<br />

Use in Displaying Images 11.8<br />

Use in Forms 9.2<br />

Bézier Curve<br />

Use in<br />

dlpdfpathaddcurve 8.13<br />

dlpdfpathaddcurver 8.13<br />

dlpdfpathaddcurvev 8.13<br />

dlpdfpathaddcurvey 8.14<br />

Use in Line Drawing<br />

Basic points 10.9, A.115<br />

Calls 10.9, 10.10<br />

Parameters 10.9, A.115<br />

Bitmaps<br />

Image Conversion from 11.2<br />

Use in Image Color Spaces 12.2<br />

blobs (Binary Large OBjects) 17.13<br />

Bookmarks<br />

Accessing DLPDFOUTLINE fields 14.4<br />

Building Multiple Trees 14.2<br />

Calls 14.2, 14.3, 14.4<br />

DLPDFOUTLINE 14.2, 14.3<br />

DLPDFOUTLINE->Count 14.4<br />

DLPDFOUTLINE->Obj 14.4<br />

DLPDFOUTLINE->Open 14.4<br />

Introduction 14.1<br />

Opening Document with Annotations<br />

Showing 14.4<br />

Outline Tree 14.2<br />

Overview 14.2<br />

PageMode 14.4<br />

PDViewDestNull 14.2<br />

Border<br />

Use in Annotations <strong>and</strong> Links 13.4<br />

Border (parameter)<br />

Use in Annotation Dictionary 13.8<br />

BoundingBox (PostScript statement) A.73<br />

Browser<br />

Specifying via Acrobat 13.7<br />

C<br />

CalGray<br />

Use in Color Spaces<br />

Basic 12.7<br />

Calibrated Gray Scale 12.4<br />

calloc<br />

Alternate Routines for 2.4<br />

PDFInit.h Interface to 2.4<br />

CalRGB<br />

Use in Color Spaces<br />

Basic 12.7<br />

Cautions<br />

Color Models must be Freed before Closing 12.3<br />

Do not Exit from within Error H<strong>and</strong>ler 16.2<br />

Initialize pre-v6.1 Library <strong>and</strong> <strong>DLI</strong> only once 2.8<br />

Invalid Font Creation 4.7<br />

Scale Before Rotating Image 10.13<br />

Transformation, Undesirable Side-Effects via<br />

dlpdfcontentrotate 7.2<br />

CGM (Computer Graphics Metafile)<br />

Use in Graphical Language Forms 11.4<br />

CIDToGID Conversion Map 4.3<br />

CIDType2 font<br />

Terminology usage 4.3<br />

Clipping Path A.6<br />

Use in Line Drawing 8.5<br />

CMYK Color<br />

Collapsing to Gray 12.12<br />

Converting to RGB 12.13<br />

Use in Color Description 12.2<br />

Use in ICC Based Color Profile 12.8<br />

Color<br />

Color Description Components 12.2<br />

Converting Values to Binary 12.5<br />

of Annotations <strong>and</strong> Links 13.3<br />

Use in Annotations <strong>and</strong> Links 13.4<br />

Use in Images 12.2<br />

Use with PDFGraphicState 12.2<br />

Color (parameter)<br />

Use in Annotation Dictionary 13.8<br />

Color Channels<br />

Inversion Correction 12.5<br />

Precision Correction 12.5<br />

Value Conversion <strong>and</strong> Inversion 12.5<br />

Values for 12.5<br />

Color Models<br />

/DeviceCMYK<br />

Order of Values Assumed 11.5<br />

Use in Displaying Images 11.5<br />

/DeviceGray<br />

Use in Displaying Images 11.5<br />

/DeviceRGB<br />

Order of Values Assumed 11.5<br />

Use in Displaying Images 11.5<br />

/Indexed<br />

Use in Displaying Images 11.5<br />

Order of Values 11.5<br />

Color Profile<br />

Use in Color Spaces<br />

Basic 12.8<br />

Color Spaces<br />

Advanced<br />

DeviceN 12.9<br />

Indexed 12.9<br />

Overview 12.8<br />

Patterned 12.9<br />

Separation 12.8


Index<br />

I.iii<br />

Basic<br />

Calibrated Gray 12.7<br />

Calibrated RGB 12.7<br />

CIE Calibrated Color 12.5<br />

CIE Lab 12.7<br />

Device CMYK 12.6<br />

Device Gray 12.6<br />

Device RGB 12.6<br />

ICC Based 12.8<br />

Conversion of Values between Models<br />

CMYK To Gray 12.12<br />

CMYK to RGB 12.13<br />

Overview 12.12<br />

RGB to CMYK 12.13<br />

RGB to Gray 12.12<br />

Creating <strong>and</strong> Destroying 12.3<br />

Patterned<br />

Building 12.10<br />

Repeating <strong>Reference</strong>s 12.11<br />

ColorSpace<br />

Use in Displaying Images 11.10<br />

Comments<br />

Use in Adding to Content Elements 8.17<br />

Compression<br />

Activating 3.2, A.33<br />

Calls 3.2<br />

Flate<br />

Use in Displaying Images 11.6<br />

Use in Documents, Beginning <strong>and</strong><br />

Ending 3.2, A.33<br />

Containers within Pages 7.1<br />

Inversion 7.4<br />

Overview 7.2<br />

Scaling 7.3<br />

Content Elements<br />

representation by DLPDFCONTENT 8.2<br />

Content Interface Calls 8.3<br />

Adding Comments to Content Elements 8.17<br />

Calls 8.17<br />

Associating Content to Page 8.17<br />

Calls 8.17<br />

Control Structures 8.2<br />

Creation <strong>and</strong> Positioning 8.3<br />

Calls 8.3<br />

Line Drawing 8.5<br />

Calls 8.5, 8.6, 8.7<br />

Fill Color 8.5<br />

kPDEEoFill 8.5<br />

kPDEFill 8.5<br />

kPDEStroke 8.5<br />

Paint Operator 8.5<br />

PDEGraphicState 8.5<br />

Overview 8.2<br />

Paths 8.7<br />

Appending Line Segments 8.8<br />

Calls 8.8, 8.9, 8.10, 8.11, 8.12, 8.13, 8.14,<br />

8.15<br />

Calls 8.7, 8.8<br />

Patterns 8.15<br />

Calls 8.15<br />

Referencing Predefined Structures 8.16<br />

Calls 8.16<br />

Text Placement 8.4<br />

Calls 8.4<br />

Text Width Evaluation 8.4<br />

Calls 8.4<br />

Conventions, Document 1.6<br />

CosDictRemove<br />

Use in Links<br />

Replacing 13.8<br />

CosDoc<br />

Use in Document Creation 3.2<br />

cosImage<br />

Use in Displaying Images 11.10<br />

CosNull<br />

Use in Links 13.8<br />

CosObj<br />

Use in Annotations <strong>and</strong> Links 13.2, 13.8<br />

Use in Image Color Spaces 12.2<br />

CosStructure<br />

Use in Image Color Spaces 12.2<br />

Cross-<strong>Reference</strong> File, OS/390<br />

Use in Displaying Images 11.9<br />

CTM Matrix<br />

Use in Line Drawing 10.6<br />

Current Point<br />

Use in Line Drawing 10.6<br />

D<br />

dash<br />

Use in Line Drawing 10.15<br />

Dashed <strong>and</strong> Dotted Lines 10.15<br />

Data Structure, Library 2.2<br />

DDName<br />

Use in Displaying Images 11.9<br />

Dest (parameter)<br />

Use in Annotation Dictionary 13.8<br />

Use in Bookmarks 14.4<br />

Use in Links<br />

Replacing 13.8<br />

Destination<br />

Adding to Name Tree 13.7<br />

Obtaining Name 13.8<br />

Use in Links 13.6, 13.7<br />

Use of, vs. Name 13.6<br />

Destination Dictionary<br />

Use in Bookmarks 14.3<br />

DeviceCMYK<br />

Creating Color Space for 12.3<br />

Use in Color Spaces<br />

Advanced 12.9<br />

Basic 12.6<br />

DeviceGray<br />

Creating Color Space for 12.3<br />

Use in Color Spaces<br />

Advanced 12.9


I.iv<br />

<strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Basic 12.6<br />

DeviceN<br />

Use in Color Spaces<br />

Advanced 12.9<br />

DeviceRGB<br />

Creating Color Space for 12.3<br />

Use in Color Spaces<br />

Advanced 12.9<br />

Basic 12.6<br />

Digital Signatures<br />

Appearance layers 15.3, 15.4<br />

Calls<br />

dlpdfdoccreatesignature 15.3<br />

dlpdfdocsetsignatureappearance 15.4<br />

dlpdfpageplacesignature 15.5<br />

dlpdfsignaturesetdatacallback 15.5<br />

dlpdfsignaturesetpkcs7cert 15.4<br />

dlpdfsignaturesetx509cert 15.4<br />

Components of 15.2<br />

imageBBox (signature bounding box) 15.5<br />

Introduction 15.1<br />

Overview 15.2<br />

Public <strong>and</strong> Private Keys 15.2<br />

sigType (plug-in compatibility) 15.3<br />

dirList<br />

Use in Setting Resource Directories 2.2<br />

DLExceptionCode<br />

Use in Error H<strong>and</strong>ling 16.4<br />

DLExceptionFlag<br />

Use in Error H<strong>and</strong>ling 16.3, 16.4<br />

DLExceptionMessage<br />

Use in Error H<strong>and</strong>ling 16.4<br />

<strong>DLI</strong><br />

<strong>DLI</strong>-selected PDF Level Declarations 2.6<br />

How to Create a PDF Document 1.2<br />

Initialization in <strong>DLI</strong> v3.0 1.11<br />

Introduction 1.2<br />

Overriding <strong>DLI</strong>-selected PDF Level<br />

Declarations 2.6<br />

Required Initialization 1.3<br />

DLPDFCONTENT 8.2<br />

Use by dlpdftexttocontent 1.14<br />

Use in Displaying Images 11.10<br />

Use in Line Drawing 10.11<br />

Use in Patterned Colors 12.2<br />

Use with CIDType2 fonts 4.3<br />

dlpdfcontent objects 1.2<br />

dlpdfcontentarc A.2<br />

Use in Content Interface Calls 8.6<br />

Use in Line Drawing 10.4<br />

dlpdfcontentarcn A.3<br />

Use in Content Interface Calls 8.6<br />

Use in Line Drawing 10.4<br />

dlpdfcontentarcto A.4<br />

Use in Content Interface Calls 8.6<br />

Use in Line Drawing 10.4<br />

dlpdfcontentcircle A.5<br />

Use in Content Interface Calls 8.7<br />

Use in Line Drawing 10.5<br />

dlpdfcontentclip A.6<br />

Use in Content Interface Calls 8.5<br />

dlpdfcontentclipend A.6, A.7<br />

Use in Content Interface Calls 8.5<br />

Use in Line Drawing 8.5<br />

dlpdfcontentcomment A.8<br />

Use in Content Interface Calls 8.17<br />

dlpdfcontentcreate A.9<br />

Use in Content Interface Calls 8.3<br />

dlpdfcontentdrawpath<br />

Use in Line Drawing 10.6, 10.11<br />

dlpdfcontentellipse A.10<br />

Use in Content Interface Calls 8.7<br />

Use in Line Drawing 10.5<br />

dlpdfcontentfontskew A.11<br />

dlpdfcontentgstate A.12<br />

Use in Displaying Images 11.10<br />

dlpdfcontentline A.13<br />

Use in Content Interface Calls 8.6<br />

Use in Line Drawing 10.3<br />

dlpdfcontentpath A.14<br />

Use in Content Interface Calls 8.5, 8.6<br />

Use in Line Drawing 8.5, 10.2, 10.5<br />

dlpdfcontentpieslice A.10, A.15<br />

Use in Content Interface Calls 8.7<br />

Use in Line Drawing 10.4<br />

dlpdfcontentpieslicen A.16<br />

Use in Content Interface Calls 8.7<br />

Use in Line Drawing 10.5<br />

dlpdfcontentrect A.17<br />

Use in Content Interface Calls 8.6<br />

Use in Line Drawing 10.3<br />

dlpdfcontentreferenceform A.18<br />

Use in Content Interface Calls 8.16<br />

Use in Forms 9.2<br />

dlpdfcontentreferenceimage A.19<br />

Usage example 8.16<br />

Use in Content Interface Calls 8.16<br />

Use in Displaying Images 11.2<br />

dlpdfcontentrotate A.21<br />

Use in Content Interface Calls 8.3<br />

dlpdfcontentscale A.22<br />

Use in Content Interface Calls 8.3<br />

dlpdfcontenttext A.23, A.29<br />

Use in Content Interface Calls 8.4<br />

dlpdfcontenttextwidth A.24, A.30<br />

Use in Content Interface Calls 8.4<br />

dlpdfcontenttopage A.25<br />

Use in Content Interface Calls 8.17<br />

dlpdfcontenttranslate A.26<br />

Use in Content Interface Calls 8.3<br />

dlpdfcontentusefillpattern A.27, A.28, A.135<br />

Use in Color Spaces<br />

Advanced 12.10<br />

Patterned 12.10


Index<br />

I.v<br />

Use in Content Interface Calls 8.15<br />

dlpdfcontentusestrokepattern A.28, A.135<br />

Use in Color Spaces<br />

Advanced 12.10<br />

Use in Content Interface Calls 8.15<br />

dlpdfcontentwidetext A.29<br />

Updates in <strong>DLI</strong> v3.0 1.14<br />

Use in Content Interface Calls 8.4<br />

dlpdfcontentwidetextwidth A.30<br />

Use in Content Interface Calls 8.4<br />

DLPDFDOC 2.6, A.37<br />

EmbedFonts<br />

Use in Documents, Beginning <strong>and</strong> Ending 3.3<br />

Use in Creation Calls in <strong>DLI</strong><br />

Font Searching Sequence 4.6<br />

Repetitive Calling 4.5<br />

Use in Displaying Images 11.9<br />

Use in Document Status 3.2<br />

Use in Documents, Beginning <strong>and</strong> Ending 3.2<br />

Encryption 3.4<br />

Use in Initializing <strong>and</strong> Terminating via <strong>DLI</strong> 2.8,<br />

2.10<br />

Use in Multiple Document Creation 3.2<br />

dlpdfdocasciips A.31<br />

dlpdfdoccomplete A.32<br />

dlpdfdoccompress A.33<br />

Use in Documents, Beginning <strong>and</strong> Ending 3.2<br />

dlpdfdoccosdoc A.34<br />

dlpdfdoccreate A.35<br />

Modifications in <strong>DLI</strong> v3.0 1.16<br />

Updates in <strong>DLI</strong> v3.0 1.11<br />

Use in Documents, Beginning <strong>and</strong> Ending 3.2<br />

dlpdfdoccreatesignature A.36<br />

Use in digital signatures 15.3<br />

dlpdfdoccreatewithinstance<br />

Removal from <strong>DLI</strong> v3.0 1.11<br />

dlpdfdocdestroy A.37<br />

dlpdfdocembedfonts A.38, A.63, A.64, A.65, A.66<br />

Use in Documents, Beginning <strong>and</strong> Ending 3.3<br />

Use of Document EmbedFonts Flag 4.4<br />

dlpdfdocencrypt A.39<br />

Use in Documents, Beginning <strong>and</strong> Ending 3.4<br />

dlpdfdocHexGraphics A.41<br />

dlpdfdoclinearize A.40<br />

Use in Documents, Beginning <strong>and</strong> Ending 3.3,<br />

3.4<br />

dlpdfdocmakethumbnails A.41<br />

Use in Documents, Beginning <strong>and</strong> Ending 3.3<br />

dlpdfdocnameadd A.42<br />

Use in Annotations <strong>and</strong> Links 13.6<br />

Use in Links 13.7<br />

dlpdfdocnamefind A.43<br />

Use in Links 13.8<br />

dlpdfdocoutline A.44<br />

Use in Bookmarks 14.3<br />

dlpdfdocoutlineadd A.45<br />

Use in Bookmarks 14.2<br />

dlpdfdocoutlineaddfromname A.47<br />

Use in Bookmarks 14.3<br />

dlpdfdocoutlinecosobj A.48<br />

dlpdfdocoutlinefirst A.49<br />

Use in Bookmarks 14.3<br />

dlpdfdocoutlinelast A.50<br />

Use in Bookmarks 14.3<br />

dlpdfdocoutlinenext A.51<br />

Use in Bookmarks 14.4<br />

dlpdfdocoutlineparent A.52<br />

Use in Bookmarks 14.4<br />

dlpdfdocoutlineprev A.53<br />

Use in Bookmarks 14.4<br />

dlpdfdocpddoc A.54, A.101<br />

Use in Page Interface 6.3<br />

dlpdfdocsetdocinfo A.55<br />

Use in Documents, Beginning <strong>and</strong> Ending 3.3<br />

dlpdfdocsetencoding A.56<br />

Use in Documents, Beginning <strong>and</strong> Ending 3.3<br />

dlpdfdocsetencryptkeylen A.57<br />

Use in Documents, Beginning <strong>and</strong> Ending 3.4,<br />

3.5<br />

dlpdfdocsetpdfname A.58<br />

Use in Documents, Beginning <strong>and</strong> Ending 3.3<br />

Use in Writing PDF Output to Memory 2.13<br />

dlpdfdocsetpsname A.59<br />

Use required for dlpdfdoccreate 1.15, 3.2, A.35<br />

dlpdfdocsetsignatureappearance A.60<br />

Use in digital signatures 15.4<br />

dlpdfdocwritepdf A.58, A.61<br />

Use in digital signatures 15.4, 15.5<br />

Use in Documents, Beginning <strong>and</strong> Ending 3.4<br />

with dlpdfdocencrypt 3.4<br />

Use in Writing PDF Output to Memory 2.13<br />

dlpdfdocwritePS A.59, A.62<br />

Use required for dlpdfdoccreate 1.15, 3.2, A.35<br />

DLPDFFONT 3.3, 4.3, 4.4, A.38<br />

Font Attributes 4.4<br />

Font Embedding Status 4.4<br />

Font Subsetting Status 4.4<br />

Use in Creation Calls in <strong>DLI</strong> 4.5<br />

Repetitive Calling 4.5<br />

WidthTable 4.6<br />

dlpdffontcreate A.63, A.64, A.65, A.66<br />

Use in Font Creation 4.5<br />

Use in Font Searching Sequence 4.5<br />

Use in Loading <strong>and</strong> Creating Fonts 5.3<br />

Use in Multibyte Text Work 5.3<br />

dlpdffontcreateembedded 4.5, A.63, A.64, A.65,<br />

A.66<br />

Use in Font Creation 4.5, 4.6<br />

Use in Loading <strong>and</strong> Creating Fonts 5.3<br />

dlpdffontcreatewithmetrics A.63, A.64, A.65, A.66<br />

Use in Font Creation 4.5, 4.7<br />

Use in Loading <strong>and</strong> Creating Fonts 5.4<br />

Use in Matching System Fonts 4.7<br />

dlpdffontcreatewithmetricsembedded A.63, A.64,<br />

A.65, A.66<br />

Use in Font Creation 4.5, 4.8<br />

DLPDFFORM 9.2<br />

Use in Digital Signatures 15.2, 15.4


I.vi<br />

<strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

dlpdfformcreate A.68<br />

Use in Forms 9.2<br />

dlpdfformdestroy A.69<br />

Use in Forms 9.3<br />

DLPDFIMAGE<br />

Use in Displaying Images 11.2, 11.5, 11.8, 11.9,<br />

11.10<br />

dlpdfimagecreatefrombmp A.70<br />

Use in Displaying Images 11.10<br />

Use in Image Color Spaces 12.2<br />

dlpdfimagecreatefromfile A.71<br />

Use in Displaying Images 11.8<br />

Use in Image Search using Files in Memory 1.17,<br />

2.10<br />

dlpdfimagecreatefrompdf A.72<br />

What’s New in <strong>DLI</strong> v3.0 1.12<br />

dlpdfimagecreatefromps A.73<br />

dlpdfimagegetsize A.74<br />

Use in Content Interface Calls 8.16<br />

dlpdfinit A.75<br />

Caution on Multiple Initializations of Library 2.8<br />

Error H<strong>and</strong>ler not required 3.2, A.75, A.143<br />

Invoking Files in Memory 17.2<br />

Note on Writing PDF Output to Memory 2.9<br />

Specifying an Alternate File System 2.8<br />

Updates in <strong>DLI</strong> v3.0 1.11<br />

Use in Default Search Path Suppression 1.17<br />

Use in Files in Memory 2.7<br />

Use in Initializing <strong>and</strong> Terminating the<br />

Library 2.10<br />

Failure to Initialize 2.8<br />

Use in Initializing <strong>and</strong> Terminating via <strong>DLI</strong> 2.8,<br />

2.9, 2.10<br />

Use in Multi-Thread Initializations 2.11<br />

Use in Specifying an Alternate File System 2.8<br />

Use in Terminating Library 2.10<br />

Using a Graphics Cache 2.9<br />

DLPDFINSTANCE<br />

Addition in <strong>DLI</strong> v3.0 1.11<br />

Unicode font translation via ICU 4.3<br />

Use by dlpdfttload 1.14<br />

Use in Creation Calls in <strong>DLI</strong><br />

Font Searching Sequence 4.6<br />

Use in dlpdfdoccreate 1.15, 1.16, 3.2<br />

Use in Initializing <strong>and</strong> Terminating the<br />

Library 2.10<br />

Use in Initializing <strong>and</strong> Terminating via <strong>DLI</strong> 2.8,<br />

2.10<br />

Use in Terminating Library 2.10<br />

dlpdfinstancesetcancelproc A.77<br />

dlpdfinstancesetgrcachelimits A.78<br />

dlpdfinstancesetprogressmonitor A.80<br />

dlpdfmatrixrotate A.81<br />

Use in Line Drawing 10.13<br />

dlpdfmemfileacquire A.81, A.82<br />

Use in Writing PDF Output to Memory 2.13, 2.14<br />

dlpdfmemfiledata A.83, A.84<br />

Use in Writing PDF Output to Memory 2.13, 2.14<br />

dlpdfmemfiledeleteonclose A.84<br />

Note on usage for file deletion 1.12<br />

dlpdfmemfilerelease A.85<br />

Use in Writing PDF Output to Memory 2.13, 2.14<br />

dlpdfmemfilesetbuffer A.86<br />

dlpdfmemfilesetdata A.87<br />

Differences from dlpdfmemfilesetbuffer A.86<br />

Use in Image Search using Files in Memory 1.17,<br />

2.9<br />

Use in Writing PDF Output to Memory 2.14<br />

dlpdfmemfilesize 2.14, A.88<br />

Use in Writing PDF Output to Memory 2.13, 2.14<br />

dlpdfmemfilesys A.89<br />

Use in Files in Memory 2.7<br />

Use in Image Search using Files in Memory 1.17,<br />

2.9<br />

Use in Initializing <strong>and</strong> Terminating the Library 2.8<br />

Use in Initializing <strong>and</strong> Terminating via <strong>DLI</strong> 2.9<br />

Use in Specifying an Alternate File System 2.8<br />

dlpdfmemfilesysgetmemusage A.90<br />

dlpdfmemfilesyssetmemlimit A.91<br />

dlpdfmemfiletransientprefix A.92<br />

Use in Writing PDF Output to Memory 2.13, 2.14<br />

DLPDFOUTLINE<br />

Use in Bookmarks 14.2, 14.3, 14.4<br />

DLPDFPAGE 6.2<br />

dlpdfpage objects 1.2<br />

dlpdfpageaddlinkannotation A.93<br />

Use in Annotations <strong>and</strong> Links 13.5<br />

dlpdfpageaddlinkannotationfromname A.95<br />

Use in Annotations <strong>and</strong> Links 13.6<br />

dlpdfpageaddtextannotation A.96<br />

Use in Annotations <strong>and</strong> Links 13.4<br />

dlpdfpageaddwebannotation A.97<br />

Use in Links 13.7<br />

dlpdfpagecosobj A.98<br />

Use in Page Interface 6.3<br />

dlpdfpagecreate A.99<br />

Use in Page Interface 6.2<br />

dlpdfpagefindfromnumber A.100<br />

Use in Page Interface 6.2<br />

dlpdfpagenumber A.101<br />

Use in Page Interface 6.3<br />

dlpdfpageplacesignature A.137<br />

Use in digital signatures 15.5<br />

dlpdfpagerotate A.102<br />

Use in Page Interface 6.3<br />

dlpdfpagesetart A.103<br />

dlpdfpagesetbleed A.104<br />

dlpdfpagesetcrop A.105<br />

dlpdfpagesetid A.106<br />

Use in Page Interface 6.3<br />

dlpdfpagesetmediabox A.107<br />

dlpdfpagesettrim A.108<br />

DLPDFPATH<br />

Effect of DLPDFPath.scaling on


Index<br />

I.vii<br />

PDEGraphicState.lineWidth 10.14<br />

Use in Line Drawing 10.6, 10.7, 10.11, 10.14<br />

Use in Paths 8.7<br />

dlpdfpathaddarc A.109<br />

Use in Content Interface Calls 8.10<br />

Use in Line Drawing 10.7<br />

dlpdfpathaddarcn A.110<br />

Use in Content Interface Calls 8.10<br />

Use in Line Drawing 10.8<br />

dlpdfpathaddarcto A.111<br />

Use in Content Interface Calls 8.11<br />

dlpdfpathaddclose<br />

Use in Content Interface Calls 8.14<br />

Use in Line Drawing 10.6, 10.11<br />

dlpdfpathaddcurve A.114<br />

Use in Content Interface Calls 8.13<br />

Use in Line Drawing 10.9<br />

dlpdfpathaddcurver A.116<br />

Use in Content Interface Calls 8.13<br />

Use in Line Drawing 10.9<br />

dlpdfpathaddcurvev A.117<br />

Use in Content Interface Calls 8.13<br />

Use in Line Drawing 10.10<br />

dlpdfpathaddcurvey A.118<br />

Use in Content Interface Calls 8.14<br />

Use in Line Drawing 10.10<br />

dlpdfpathaddelliparc<br />

Use in Content Interface Calls 8.11<br />

dlpdfpathaddelliparcn A.120<br />

Use in Content Interface Calls 8.12<br />

dlpdfpathaddelliparcto A.121<br />

Use in Content Interface Calls 8.12<br />

dlpdfpathaddline A.122<br />

Use in Content Interface Calls 8.8<br />

Use in Line Drawing 10.7<br />

dlpdfpathaddliner A.123<br />

Use in Content Interface Calls 8.9<br />

Use in Line Drawing 10.7<br />

dlpdfpathaddmove A.124<br />

Use in Content Interface Calls 8.9<br />

Use in Line Drawing 10.7<br />

dlpdfpathaddmover A.125<br />

Use in Content Interface Calls 8.9<br />

Use in Line Drawing 10.7<br />

dlpdfpathaddrect A.126<br />

Use in Content Interface Calls 8.14<br />

Use in Line Drawing 10.10<br />

dlpdfpathadelliparc A.119<br />

dlpdfpatharray A.127<br />

Use in Content Interface Calls 8.8<br />

dlpdfpathclear A.128<br />

Use in Content Interface Calls 8.7<br />

Use in Line Drawing 10.6<br />

dlpdfpathclosepath A.113<br />

dlpdfpathcreate A.129<br />

Use in Content Interface Calls 8.7<br />

Use in Line Drawing 10.6<br />

dlpdfpathcurrentx A.130<br />

Use in Content Interface Calls 8.8<br />

dlpdfpathcurrenty A.131<br />

Use in Content Interface Calls 8.8<br />

dlpdfpathdestroy A.132<br />

Use in Content Interface Calls 8.7<br />

Use in Line Drawing 10.6<br />

dlpdfpathsetmatrix A.133<br />

Use in Content Interface Calls 8.14<br />

Use in Line Drawing 10.12<br />

dlpdfpathsize A.134<br />

Use in Content Interface Calls 8.8<br />

DLPDFPATTERN 8.15<br />

Parameters<br />

BBox 8.15<br />

Colored 8.15<br />

TileType 8.15<br />

Xstep 8.15<br />

Ystep 8.15<br />

dlpdfpatterncreate A.27, A.135<br />

Use in Color Spaces<br />

Advanced 12.10<br />

Patterned 12.10<br />

Use in Content Interface Calls 8.15<br />

dlpdfpatternrotate A.136<br />

dlpdfseterrorfile A.138<br />

dlpdfsetwarningfile A.139<br />

DLPDFSIGNATURE<br />

Use in Digital Signatures 15.4<br />

dlpdfsignaturesetdatacallback A.140<br />

Use in digital signatures 15.5<br />

dlpdfsignaturesetpkcs7cert A.141<br />

Use in digital signatures 15.4<br />

dlpdfsignaturesetx509cert A.142<br />

Use in digital signatures 15.4<br />

dlpdfterm A.143<br />

Error H<strong>and</strong>ler not required 3.2, A.75, A.143<br />

Use in Initializing <strong>and</strong> Terminating the<br />

Library 2.10<br />

Use in Initializing <strong>and</strong> Terminating via <strong>DLI</strong> 2.10<br />

Use in Multi-Thread Initializations 2.11<br />

Use in Terminating Library 2.10<br />

DLPDFTEXT 17.18<br />

Use in Multibyte Text Work 5.6<br />

dlpdftext A.144<br />

Obtaining Encoding names via<br />

dlpdftextshowencodingnames 1.13,<br />

A.155<br />

Use in Multibyte Text Work 5.4<br />

Associated shortcut functions 5.5<br />

DLPDFTEXT (structure) 1.16, 5.2<br />

Addition in <strong>DLI</strong> v3.0 1.11<br />

Creating 5.4, 5.5<br />

Performance Considerations 5.9<br />

Shortcut Functions 5.5<br />

Unicode font translation via ICU 4.3<br />

Use by dlpdftextdestroy 1.14<br />

Use by dlpdftexttocontent 1.14<br />

Use in dlpdftext (method) A.144<br />

Use in dlpdftextadvance A.145<br />

Use in dlpdftextdestroy A.146


I.viii<br />

<strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Use in dlpdftextlength A.154<br />

Use in dlpdftextstring A.156<br />

Use in dlpdftexttocontent A.157<br />

What’s New in <strong>DLI</strong> v3.0 1.13, 1.14<br />

Working with 5.6, 5.7, 5.8<br />

dlpdftextadvance A.145<br />

Use in Multibyte Text Work 5.6<br />

dlpdftextdestroy A.146<br />

Use in Multibyte Text Work 5.8<br />

dlpdftextfromutf16be A.147<br />

Use in Multibyte Text Work 5.5<br />

dlpdftextfromutf16he A.148<br />

Use in Multibyte Text Work 5.5<br />

dlpdftextfromutf16le A.149<br />

Use in Multibyte Text Work 5.5<br />

dlpdftextfromutf32be A.150<br />

Use in Multibyte Text Work 5.5<br />

dlpdftextfromutf32he A.151<br />

Use in Multibyte Text Work 5.5<br />

dlpdftextfromutf32le A.152<br />

Use in Multibyte Text Work 5.5<br />

dlpdftextfromutf8 A.153<br />

Use in Multibyte Text Work 5.5<br />

dlpdftextlength A.154<br />

Use in Multibyte Text Work 5.6<br />

dlpdftextshowencodingnames A.155<br />

Use in Multibyte Text Work 5.5<br />

dlpdftextstring A.156<br />

Use in Multibyte Text Work 5.6<br />

dlpdftexttocontent A.157<br />

Use in Multibyte Text Work 5.7<br />

dlpdfttload A.158<br />

Clearance of memory files by dlpdfterm 1.15<br />

Note on no default font searching 2.2<br />

Use in Font Searching Sequence 4.6<br />

Use in Multibyte Text Work 5.3<br />

Document Conventions 1.6<br />

Document H<strong>and</strong>le<br />

Use in Links 13.8<br />

Document Information<br />

Calls 3.3<br />

Document Interface<br />

Use with Error H<strong>and</strong>ler 3.2<br />

Document Opening<br />

with Annotations Showing 14.4<br />

Documents, Beginning <strong>and</strong> Ending<br />

Calls 3.2, 3.3, 3.4<br />

Overview 3.2<br />

E<br />

E_RETURN(X)<br />

Use in Error H<strong>and</strong>ling 16.3<br />

E_RTRN_VOID<br />

Use in Error H<strong>and</strong>ling 16.3<br />

eMemFileSys<br />

Use in Files in Memory in <strong>DLI</strong> Samples 17.2<br />

Encoding<br />

Generation of Grid via FontVerification (Sample<br />

<strong>DLI</strong> Application) 17.10<br />

Encoding Vector 4.8<br />

Encrypt (Sample <strong>DLI</strong> Application) 17.7<br />

Changing Security Settings 17.7<br />

DocOwner Password 17.7<br />

ValidUser Password 17.7<br />

Encryption<br />

Calls 3.4<br />

Setting Encryption Key Length 3.4<br />

Use in Documents, Beginning <strong>and</strong> Ending 3.4<br />

EPS (Encapsulated PostScript)<br />

Image Conversion from 11.2<br />

Use in Graphics (Sample <strong>DLI</strong> Application) 17.5<br />

Error H<strong>and</strong>ling<br />

ASGetErrorString 16.2<br />

ASGetExceptionErrorCode 16.2<br />

DURING 16.2, 16.3<br />

E_RETURN(X) 16.3<br />

E_RTRN_VOID 16.3<br />

END_HANDLER 16.2, 16.3<br />

Exception Codes from Methods 16.3<br />

Exception Names 16.2<br />

HANDLER 16.2, 16.3<br />

H<strong>and</strong>ler Constructs<br />

Multiple 16.3<br />

Risks of Returning from within 16.3<br />

H<strong>and</strong>ler Mechanism 16.2<br />

OS/390 Platform Concerns 16.3<br />

Overview 16.2<br />

Errors<br />

Communication back to Application 16.2<br />

Link<br />

"Browser is Busy" 13.7<br />

OS/390<br />

Not Using SAS/C<br />

ASGetErrorString 16.4<br />

DLExceptionCode 16.4<br />

DLExceptionFlag 16.3, 16.4<br />

DLExceptionMessage 16.4<br />

Using SAS/C 16.3<br />

Outer Error Catcher 16.2<br />

Examples<br />

Adding Outline Entries 14.3<br />

with a Named Destination 14.3<br />

Bitmapped Graphic via<br />

dlpdfimagecreatefrombmp 11.4<br />

Collapsing<br />

CMYK to Gray 12.13<br />

RGB to Gray 12.12<br />

Converting<br />

CMYK to RGB 12.14<br />

RGB to CMYK 12.13<br />

Creating<br />

Calgray Color Space 12.4


Index<br />

I.ix<br />

Gray Color Space<br />

Assembler 12.3<br />

C coding 12.3<br />

Link Annotation 13.5<br />

Link To A Named Destination 13.6<br />

Named Destination 13.7<br />

Text Annotations 13.4<br />

Drawing a Rectangle <strong>and</strong> Ellipse in Path<br />

Operators 10.11<br />

Filling an Area with a Pattern 12.11<br />

Inserting<br />

EPSF Image with<br />

dlpdfimagecreatefromps 11.6<br />

PDF Image<br />

via dlpdfimagecreatefromfile 11.8<br />

via dlpdfimagecreatefrompdf 11.7<br />

Line Drawing Using Fixed Structure 10.5<br />

Modifying a Goto Link into a GotoR Link 13.9<br />

Multiple Containers per Page with Rotation 7.6<br />

Setting the Page Mode to Display Navigation<br />

Pane 14.4<br />

Transparent Graphics via Imagemasks 11.10<br />

Exception H<strong>and</strong>lers, Required Use 3.2<br />

Exceptions<br />

Use in Error H<strong>and</strong>ling 16.2<br />

F<br />

Filename, Setting Output PDF<br />

Calls 3.3<br />

Files in Memory<br />

Activating within MultiDoc sample 2.7, 17.2<br />

Activation 2.7<br />

MEMORY Comm<strong>and</strong> Line Argument, Use<br />

of 17.2<br />

Use of dlpdfinit 17.2<br />

Use of eMemFileSys in <strong>DLI</strong> Samples 17.2<br />

Use of FileSystemType in <strong>DLI</strong> Samples 17.2<br />

Files, Transient 2.13<br />

FileSystemType<br />

Use in Files in Memory in <strong>DLI</strong> Samples 17.2<br />

fill (parameter)<br />

Use in Displaying Images 11.4<br />

Fill Color<br />

Use in PDEGraphicState 10.2<br />

fillColorSpec<br />

Use in Color Description 12.2<br />

Use in Line Drawing 10.14<br />

Fit Type<br />

Use in Bookmarks 14.2<br />

FitDescription<br />

Use in Annotations <strong>and</strong> Links 13.5<br />

FitType<br />

Use in Annotations <strong>and</strong> Links 13.5<br />

Use in Links 13.5<br />

Values<br />

Fit 13.5<br />

FitB 13.5<br />

FitBH 13.5<br />

FitBV 13.5<br />

FitH 13.5<br />

FitR 13.5<br />

FitV 13.5<br />

XYZ 13.5<br />

Fixed Rectangle<br />

Use in Bookmarks 14.2<br />

Flate Compression<br />

Use in Displaying Images 11.6<br />

flatness<br />

Use in Line Drawing 10.15<br />

FOLIO 6.3, A.106<br />

Font Dump<br />

Via FontVerification (Sample <strong>DLI</strong><br />

Application) 17.10<br />

Font Searching Sequence 4.5<br />

FontFaux (Sample <strong>DLI</strong> Application) 17.9<br />

Fonts<br />

Accessing 4.11<br />

OS/390-specific 4.11<br />

Calls 3.3<br />

Code Page Support 4.10<br />

Composite Fonts<br />

CIDType0 4.3<br />

CIDType2 4.3<br />

Overview 4.2<br />

Creation Calls in <strong>DLI</strong><br />

Calls 4.5, 4.6, 4.7, 4.8<br />

dlpdffontcreatewithmetrics<br />

Width Table 4.8<br />

Font Searching Sequence 4.5<br />

Matching Calls to System Fonts 4.7<br />

Overview 4.5<br />

Performance Considerations 4.11<br />

Repetitive Calling 4.5<br />

Default Encoding Selection 3.3<br />

differences between characters <strong>and</strong> glyphs 4.2<br />

Embedding<br />

Document EmbedFonts flag 4.4<br />

Subsetting Limitations 4.4<br />

Font Dump via FontVerification (Sample <strong>DLI</strong><br />

Application) 17.10<br />

Font Searching Sequence 4.5<br />

Overview 4.2<br />

PDFLDataRec<br />

Use in Setting Resource Directories 2.2<br />

Predefined Font Encodings 4.9<br />

Encoding Font Types Table 4.9<br />

Resources, Identifying Non-St<strong>and</strong>ard Locations<br />

of 2.2<br />

Search Paths 2.2<br />

Simple Fonts 4.2<br />

St<strong>and</strong>ard Encoding<br />

Default Setting 3.3<br />

Structure of a <strong>DLI</strong> Font 4.3<br />

Terminology usage<br />

CIDType2 font 4.3<br />

TrueType font 4.3


I.x<br />

<strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Unicode 4.10<br />

Use in Multibyte Text Work 5.3<br />

WinAnsiEncoding<br />

Default Setting 3.3<br />

FontVerification (Sample <strong>DLI</strong> Application) 17.10<br />

Encoding Grid 17.10<br />

Slow Feedback from 17.11<br />

Table of Contents 17.10<br />

Form XObjects<br />

Use in Displaying Images 11.8<br />

Forms 9.2<br />

Calls 9.2, 9.3<br />

dlpdfformcreate<br />

Use of Bounding Box 9.2<br />

Content Complexity 9.2<br />

Destruction 9.2<br />

Overview 9.2<br />

Structure 9.2<br />

Use in Referencing Predefined Structures 8.16<br />

Forms XObjects<br />

Association with Content Structures 8.2<br />

Use in Content Interface 8.2<br />

free<br />

Alternate Routines for 2.4<br />

PDFInit.h Interface to 2.4<br />

Free Software Foundation 1.4<br />

freeProc<br />

Use in Setting Memory Allocation Routines 2.4<br />

G<br />

gcc Compilation Version 1.3<br />

genErrBadParm 4.6, 6.2<br />

Use in Annotations <strong>and</strong> Links 13.4<br />

GetGraphicFromList A.159<br />

Use in Displaying Images 11.9<br />

GetGraphicFromList, OS/390<br />

Use in Displaying Images 11.9<br />

GIF (Graphics Interchange Format)<br />

Encoding <strong>and</strong> Compression <strong>Reference</strong>s 11.3<br />

Image Conversion from 11.2<br />

Use in Displaying Images 11.8<br />

Use in Graphics (Sample <strong>DLI</strong> Application) 17.5<br />

Glyph IDs 4.3<br />

GoTo<br />

Use in Annotation Dictionary 13.8<br />

Graphics (Sample <strong>DLI</strong> Application) 17.5<br />

Graphics cache<br />

What’s New in <strong>DLI</strong> v3.0 1.13<br />

Graphics, One-Bit<br />

Use in Displaying Images 11.10<br />

grayScale<br />

Use in Color Description 12.2<br />

Use in ICC Based Color Profile 12.8<br />

H<br />

Hello<strong>DLI</strong> (Sample <strong>DLI</strong> Application) 17.3<br />

Comparison with helowrld.c 2.15<br />

HeloWrld (Sample Adobe PDF Library<br />

Application) 17.3<br />

Comparison with hellodli.c 2.15<br />

hot spot (parameter)<br />

Definition of 13.2<br />

Use in Annotations <strong>and</strong> Links 13.2, 13.5<br />

Hyperlinks<br />

Use in Links 13.7<br />

I<br />

ICC (International Color Consortium) 12.8<br />

ICCBased<br />

Use in Color Spaces<br />

Advanced 12.9<br />

Use in ICC Based Color Profile 12.8<br />

ICU (International Components for Unicode)<br />

Obtaining Encoding names via<br />

dlpdftextshowencodingnames 1.13,<br />

A.155<br />

Unicode font translation via ICU 4.3<br />

Use in Multibyte Text Work 5.2<br />

What’s New 1.11<br />

Image Import Improvements in <strong>DLI</strong> v3.0 1.12<br />

Imagemask<br />

ImageMask key 11.10<br />

Note on Use of Bitmaps 11.5<br />

Use in Displaying Images 11.10<br />

ImageName<br />

Use in Displaying Images 11.3<br />

Images, Displaying<br />

EPS Pass-Through Objects 11.6<br />

Example 11.6<br />

Graphic Image Forms<br />

Bitmaps 11.3<br />

Example 11.4<br />

Graphical Language 11.4<br />

Graphic Image Structures<br />

Destroying 11.3<br />

Formats Supported 11.2<br />

ImageName Use 11.3<br />

Multiple Document Use 11.2<br />

Image Creation Methods<br />

Assorted Formats<br />

dlpdfimagecreatefromfile 11.8<br />

Example 11.8<br />

Supported Formats 11.8<br />

Bitmaps<br />

Compression <strong>and</strong> Filtering 11.6<br />

dlpdfimagecreatefrombmp 11.5<br />

Values within Color Models 11.5<br />

EPS


Index<br />

I.xi<br />

dlpdfimagecreatefromps 11.6<br />

Example 11.6<br />

Form XObject<br />

dlpdfimageplaceascontent 11.8<br />

GetGraphicFromList 11.9<br />

LoadGraphicList 11.9<br />

PDF<br />

dlpdfimagecreatefrompdf 11.7<br />

Example 11.7<br />

Transparent Graphics<br />

dlpdfcontentgstate 11.10<br />

Imagemasks 11.10<br />

Sample 11.10<br />

Included EPS Images Not Appearing in PDF<br />

Pages 11.2, 11.6<br />

Overview 11.2<br />

Indexed (atom)<br />

Use in Color Spaces<br />

Advanced 12.9<br />

Initializing <strong>and</strong> Terminating the Library<br />

Comparison of Applications with <strong>and</strong> without<br />

<strong>DLI</strong> 2.15<br />

Files In Memory<br />

Activation 2.7<br />

Image Search using Files in Memory 2.9<br />

Output to Memory, Writing PDF 2.13<br />

Calls 2.14<br />

Transient Files 2.13<br />

Overview 2.2<br />

PDFLDataRec Initialization 2.2<br />

Memory Allocation Routines, Setting 2.3<br />

Resource Allocation Routines, Setting 2.4<br />

Resource Directories, Setting 2.2<br />

Terminating 2.10<br />

Thread-Safe Issues<br />

Initialization of non-thread-safe Library<br />

releases 2.12<br />

Multi-Thread Initializations 2.11<br />

mutex (Mutual Exclusion algorithm) 2.12<br />

Version Number, Obtaining 2.5<br />

With <strong>DLI</strong><br />

Calls 2.8, 2.9, 2.10<br />

Overview 2.7<br />

Specifying an Alternate File System 2.8<br />

Typical Order of Calls 2.11<br />

Using a Graphics Cache 2.9<br />

Intended Audience 1.3<br />

J<br />

JPEG/JPG (Joint Photographic Experts Group)<br />

Encoding <strong>and</strong> Compression <strong>Reference</strong>s 11.3<br />

Use in Displaying Images 11.8<br />

Use in Graphics (Sample <strong>DLI</strong> Application) 17.5<br />

K<br />

Keys, Public <strong>and</strong> Private 15.2<br />

kPDEEoFill<br />

Use in Content Interface Calls 8.5<br />

Use in Line Drawing 10.2, 10.3, 10.11, 10.14<br />

Use in PDEGraphicState 10.2<br />

kPDEFill<br />

Use in Content Interface Calls 8.5<br />

Use in Line Drawing 10.2, 10.3, 10.11, 10.14<br />

Use in PDEGraphicState 10.2<br />

kPDEStroke<br />

Use in Content Interface Calls 8.5<br />

Use in Line Drawing 10.2, 10.3, 10.11, 10.14<br />

Use in PDEGraphicState 10.2<br />

kPDEStroke | kPDEEoFill<br />

Use in Line Drawing 10.11<br />

kPDEStroke | kPDEFill<br />

Use in Line Drawing 10.11<br />

kPDFLInitIgnoreDefaultDirectories<br />

Use in Default Search Path Suppression 1.17, 2.3<br />

kPDFLVersion<br />

Use in Obtaining Version Number 2.5<br />

L<br />

Lab<br />

Use in Color Spaces<br />

Basic 12.7<br />

Use in ICC Based Color Profile 12.8<br />

Library Data Structure 2.2<br />

Line Drawing 10.1<br />

Directly-Drawn Methods 10.3<br />

Calls 10.3, 10.4, 10.5<br />

Common Parameters 10.3<br />

dlpdfcontentpath<br />

Example 10.5<br />

Graphic State 10.14<br />

Overview 10.2<br />

Path Drawing Methods 10.6<br />

Calls 10.6, 10.7, 10.8, 10.9, 10.10, 10.11,<br />

10.12<br />

Common Parameters 10.6<br />

Example 10.11<br />

Transformation Matrix 10.12<br />

Arguments 10.12<br />

dlpdfmatrixrotate 10.13<br />

Inversion Matrix 10.12<br />

Mirror-image matrix 10.12<br />

Rotation Matrix 10.12<br />

Scale/Rotation Caution 10.13<br />

Scaling 10.13<br />

Shearing 10.13<br />

Translations 10.12<br />

Unity Matrix 10.12<br />

Linearization<br />

Calls 3.3<br />

Use in Documents, Beginning <strong>and</strong> Ending 3.3,


I.xii<br />

<strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

3.4<br />

lineCap<br />

Use in Line Drawing 10.15<br />

lineJoin<br />

Use in Line Drawing 10.14<br />

lineWidth<br />

Use in Line Drawing 10.14<br />

Link Annotation<br />

Modifying 13.8<br />

Link Cos Object<br />

Modifying 13.8<br />

Links<br />

action (parameter) 13.2<br />

Calls 13.4, 13.5, 13.6, 13.7, 13.8<br />

Components 13.2<br />

Cross-document 13.6<br />

Destination Page Number 13.5<br />

FitType 13.5<br />

hot spot (parameter)<br />

Definition of 13.2, 13.5<br />

Introduction 13.1<br />

List of Possible Actions 13.8<br />

Modifying 13.8<br />

Overview 13.2<br />

URI 13.7<br />

URL 13.7<br />

Zoom 13.5<br />

listLen<br />

Use in Setting Resource Directories 2.2<br />

LoadGraphicList A.160<br />

M<br />

Major Version Number 2.5<br />

malloc<br />

Alternate Routines for 2.4<br />

PDFInit.h Interface to 2.4<br />

Matrix operations<br />

Rotations 17.4<br />

Translation of Paths 17.4<br />

MDFile<br />

Use in Writing PDF Output to Memory 2.13, 2.14<br />

memAvailProc<br />

Use in Setting Memory Allocation Routines 2.4<br />

memFiles (Sample <strong>DLI</strong> Application) 17.13<br />

MEMORY<br />

Use in Files in Memory Activation 17.2<br />

Memory Allocation Routines, Setting 2.3<br />

allocProc 2.4<br />

freeProc 2.4<br />

memAvailProc 2.4<br />

reallocProc 2.4<br />

Minor Version Number 2.5<br />

Miter<br />

Use in Line Drawing 10.15<br />

miterLimit<br />

Use in Line Drawing 10.15<br />

Multibyte Text<br />

Comm<strong>and</strong>s 5.3, 5.4, 5.5, 5.6, 5.7, 5.8<br />

Creating DLPDFTEXT Areas 5.4<br />

Introduction 5.2<br />

Loading <strong>and</strong> Creating Fonts 5.3<br />

Performance Considerations 5.9<br />

Working With DLPDFTEXT Areas 5.6<br />

MultiDoc (Sample <strong>DLI</strong> Application) 17.13<br />

Required Arguments 17.13<br />

mutex (Mutual Exclusion algorithm) 2.12<br />

N<br />

name<br />

Use in Links<br />

instead of Destination 13.6<br />

name (parameter)<br />

Use in Links 13.7, 13.8<br />

Name Tree A.42<br />

Adding Destination 13.7<br />

Use in Annotations <strong>and</strong> Links 13.6<br />

hot spot Definition 13.2<br />

Use in Links 13.6<br />

Named Destination<br />

Use in Annotations <strong>and</strong> Links 13.6<br />

Names<br />

Use in Annotations <strong>and</strong> Links 13.6<br />

vs. Destinations 13.6<br />

NestedPDF (Sample <strong>DLI</strong> Application) 17.14<br />

NotEmbedded (flag) 3.3, 4.4, A.38<br />

Notes<br />

"Browser is Busy" Error during Link 13.7<br />

Adobe CFF OpenType font files may not properly<br />

subset 5.3<br />

ASN membership may be required for Adobe<br />

website access 1.8<br />

Base 14 Fonts<br />

Creation Allowed by dlpdffontcreate 4.5<br />

Bitmapped Images under 500 Bytes Always<br />

Merged Inline 11.5<br />

BMP images with LZW skip markers may not embed<br />

properly 17.6<br />

Cache size limit is checked every time a document<br />

is destroyed 2.9, A.76, A.79<br />

CFF-format OpenType font files not fully<br />

supported 1.14<br />

Colorizing via Stroke <strong>and</strong> Fill 8.5, 10.2<br />

Default-filesystem settings may need updating<br />

for images in memory 1.17, 2.10<br />

Digital Signature signed hash values must be exactly<br />

256 hex digits 15.4<br />

Disk resources used by default if Output to Memory<br />

is not set 2.9<br />

<strong>DLI</strong> v2.2 Unicode support now superceded by<br />

new Multibyte text methods 5.2


Index<br />

I.xiii<br />

dlpdfcontentarcto Discrepancies with PostScript<br />

Output 10.4<br />

DLPDFINSTANCE required for Unicode font<br />

creation 1.11<br />

dlpdfmemfiledeleteonclose required for memory<br />

file deletion 1.12<br />

dlpdfpathaddarcto Line Drawing Details 10.8<br />

dlpdfpathaddclose, Adding Disjoint Path Segments<br />

After 10.11<br />

dlpdfttload does not re-parse previously-loaded<br />

font file 5.3<br />

Document Sharing of COS Objects <strong>and</strong><br />

PDEColorSpaces 12.4<br />

Encryption Key Length, Setting in Multiple<br />

Documents 3.5<br />

Error H<strong>and</strong>ling should conform to Adobe<br />

guidelines 16.2<br />

File Sizes, Effect on, by<br />

Repeated Graphical Object <strong>Reference</strong>s 11.9<br />

Files in /Codesamples folder not buildable source<br />

as-is 1.5, 11.10<br />

Fill Operator Not Valid via dlpdfcontentline 10.3<br />

Fill Patterns are Never Destroyed 12.11<br />

Font Encoding, Limitations on Predefined 4.7<br />

Font not licensed for embedding will be created<br />

as <strong>Reference</strong>d instead 3.3, 4.4<br />

Function Return Value is Undefined if Error<br />

Occurs 16.3<br />

Graphic Conversions,Some Unavailable on OS/<br />

390 <strong>and</strong> OS/400 11.3, 11.8<br />

Graphic Key on OS/390 Must be ASCII<br />

String 11.9<br />

Images cached by filename 17.6<br />

Included EPS Images Not Appearing in PDF<br />

Pages 11.2, 17.5<br />

Library is not thread-safe 1.3<br />

No default font searching for dlpdfttload 2.2<br />

Only fonts using st<strong>and</strong>ard encodings may be<br />

fauxed 17.10<br />

Pass accurate length values for PKCS #7 certificate<br />

output space reservation 15.5,<br />

A.141<br />

Pattern Interaction with Color when Drawing<br />

Figures 10.14<br />

PDColorValue Permits Only 4 Channels 12.9<br />

PDEPathGetData Requirement for Path Data<br />

Retrieval 10.5<br />

PDEPathGetData Return Value 8.6<br />

PDF <strong>Reference</strong> Manual errata file available for<br />

download 1.8<br />

Popup warning may occur for new PDF in old<br />

viewers 1.10, 2.6<br />

RSA encryption algorithm within SignDoc sample<br />

not recommended for Production<br />

code 17.16<br />

Sample applications are subject to change 17.2<br />

Slow Feedback from FontVerification (Sample <strong>DLI</strong><br />

Application) 17.11<br />

Structure Variations may exist between PDF 1.6<br />

O<br />

<strong>and</strong> earlier 1.3<br />

Type is Filled, Not Stroked 12.2<br />

Type0 Fonts must be Subset if Embedded 4.6<br />

Unicode NULL string terminators not required or<br />

included in calculations A.29, A.30<br />

Upgrade applications to thread-safe capability as<br />

soon as possible 2.12<br />

WideText sample application uses fonts not distributed<br />

with <strong>DLI</strong> 17.18<br />

Outline Tree<br />

Adding New Entry 14.2<br />

Use in Bookmarks<br />

Building Multiple Trees 14.2<br />

Output File, Writing<br />

Calls 3.3, 3.4<br />

Document Information 3.3<br />

Encryption 3.4<br />

Linearization 3.4<br />

Security Permissions 3.4<br />

P<br />

Page<br />

Use in Content Interface 8.2<br />

Page Interface Calls 6.2, 6.3<br />

Page Structure 6.2<br />

PageMode<br />

Use in Bookmarks 14.4<br />

Paint Operator<br />

Use in Content Interface Calls 8.5<br />

Use in Line Drawing 10.2<br />

Pass-Through Objects<br />

Use in Displaying EPS Images 11.6<br />

Passwords<br />

Setting in Encrypt (Sample <strong>DLI</strong> Application) 17.7<br />

Paths (Sample <strong>DLI</strong> Application) 17.4<br />

Patterned Colors 12.2<br />

Patterns, creating background 17.14<br />

PCKS #7-format certificates 17.16<br />

PD_STD_ENCODING (flag) 17.10<br />

PDColorValue<br />

Use in Color Spaces<br />

Advanced 12.9<br />

PDDoc 3.2<br />

PDDocSetNewSecurityData<br />

Use in Documents, Beginning <strong>and</strong> Ending 3.5<br />

PDEColorSpace<br />

Creating <strong>and</strong> Destroying 12.3<br />

Document Sharing 12.4<br />

Use in Color Description 12.2<br />

PDEColorSpaceCreate<br />

Creating <strong>and</strong> Destroying 12.4<br />

Use in Color Spaces<br />

Advanced 12.8, 12.9


I.xiv<br />

<strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Basic 12.7<br />

Use in ICC Based Color Profile 12.8<br />

PDEColorSpaceCreateFromName<br />

Use in Color Spaces<br />

Advanced 12.8, 12.9<br />

Basic 12.7, 12.8<br />

PDEColorSpaceGetCosObj<br />

Use in Image Color Spaces 12.2<br />

PDEDash<br />

Use in Line Drawing 10.15<br />

PDEDeviceNColorData<br />

Use in Color Spaces<br />

Advanced 12.9<br />

PDEFontAttrs 4.4, 4.7, 17.9, 17.10<br />

charset field 4.8<br />

encoding field 4.7<br />

type field 4.7<br />

Use in Creation Calls in <strong>DLI</strong> 4.5<br />

wMode field 4.8<br />

PDEGraphicState 8.4, 8.5<br />

Color Definitions 10.2<br />

Use in Color Description 12.2<br />

Use in Content Interface 8.2<br />

Use in Displaying Images 11.10<br />

Use in Line Drawing 10.2, 10.11, 10.14<br />

dash 10.15<br />

fillColorSpec 10.14<br />

flatness 10.15<br />

lineCap 10.15<br />

lineJoin 10.14<br />

lineWidth 10.14<br />

miterLimit 10.15<br />

effect on lineJoin 10.14<br />

strokeColorSpec 10.14<br />

PDEGrayCalFlt<br />

Use in Color Spaces<br />

Basic 12.7<br />

PDEICCBasedColorData<br />

Use in ICC Based Color Profile 12.8<br />

PDEIndexedColorData<br />

Use in Color Spaces<br />

Advanced 12.9<br />

PDELabCalFlt<br />

Use in Color Spaces<br />

Basic 12.7<br />

PDEPath<br />

Use in Line Drawing 10.5<br />

PDEPathAddSegment<br />

Cited in PDF Rules for Path Construction 10.5<br />

PDEPathGetData A.14<br />

Use in Content Interface Calls 8.6<br />

Use in Line Drawing 8.6, 10.5<br />

PDERGBCalFlt<br />

Use in Color Spaces<br />

Basic 12.7<br />

PDESeparationColorData<br />

Color Spaces<br />

Advanced 12.8<br />

PDETextState 8.4<br />

Use in Content Interface 8.2<br />

PDF<br />

Image Conversion from 11.2<br />

Level Declarations in Output 1.9, 2.5<br />

Declarations via <strong>DLI</strong> 1.10<br />

<strong>DLI</strong>-selected Declarations 2.6<br />

Overriding <strong>DLI</strong>-selected Declarations 2.6<br />

Use in Displaying Images 11.7, 11.8, 11.9<br />

Use in Graphical Language Forms 11.4<br />

Use in Graphics (Sample <strong>DLI</strong> Application) 17.5<br />

PDF Library<br />

Use in Multithreaded Applications 1.9<br />

Version Control 1.9, 2.5<br />

PDF Page Tree Structures 6.2<br />

PDFInit.h<br />

Use in Setting Memory Allocation Routines 2.4<br />

Use in Setting Resource Allocation Routines 2.4<br />

PDFLDataRec 2.11<br />

Use in Default Search Path Suppression 1.17<br />

Use in Initializing <strong>and</strong> Terminating the Library 2.2<br />

Use in Setting Memory Allocation Routines 2.3<br />

Use in Terminating Library 2.10<br />

PDFLGetVersion<br />

Use in Obtaining Version Number 2.5<br />

PDFLInit<br />

Caution on Multiple Initializations of pre-v6.1<br />

Library 2.8, A.75<br />

Prohibition on calling from <strong>DLI</strong> v3.0 1.11, A.75<br />

Use in Default Search Path Suppression 1.17<br />

Use in Initializing <strong>and</strong> Terminating via <strong>DLI</strong> 2.8<br />

Use in Multi-Thread Initializations 2.11<br />

PDFLTerm<br />

Prohibition on calling from <strong>DLI</strong> v3.0 1.11, A.75<br />

Use in Multi-Thread Initializations 2.11<br />

pdfMajorVer 2.6<br />

pdfMinorVer 2.6<br />

PDFNeeded (flag)<br />

Removal from dlpdfdoccreate 1.15, A.35<br />

PDPerms<br />

Use in Documents, Beginning <strong>and</strong> Ending<br />

Encryption 3.4<br />

PDViewDestNull<br />

Use in Bookmarks 14.2<br />

Use in Links<br />

with Zoom 13.5<br />

Performance Considerations<br />

Font Creation Calls in <strong>DLI</strong> 4.11<br />

Plugins<br />

Self-Sign 17.16<br />

VeriSign Signature 17.16<br />

PNG (Portable Network Graphics)<br />

Encoding <strong>and</strong> Compression <strong>Reference</strong>s 11.3<br />

Image Conversion from 11.2<br />

Use in Displaying Images 11.8<br />

Use in Graphics (Sample <strong>DLI</strong> Application) 17.5


Index<br />

I.xv<br />

Private keys 15.2<br />

psOutput (Sample <strong>DLI</strong> Application) 17.17<br />

Public keys 15.2<br />

Q<br />

QuickDraw<br />

Use in Graphical Language Forms 11.4<br />

R<br />

RAW (Unformatted Unannotated Bitmap)<br />

Use in Graphics (Sample <strong>DLI</strong> Application) 17.5<br />

readme.txt 1.8, 1.9<br />

realloc<br />

PDFInit.h Interface to 2.4<br />

reallocProc<br />

Use in Setting Memory Allocation Routines 2.4<br />

Rect (parameter)<br />

Use in Annotation Dictionary 13.8<br />

Rectangles<br />

Use in Links 13.5<br />

Release Notes 1.8<br />

Resource Allocation Routines, Setting 2.4<br />

Resource Directories, Setting<br />

Use in Initializing <strong>and</strong> Terminating the Library 2.2<br />

Resources<br />

Adobe<br />

Adobe Acrobat Core API Overview 1.8<br />

Adobe Acrobat Core API <strong>Reference</strong> 1.8<br />

Adobe PDF Library Overview 1.8<br />

Adobe PDF Library Supplement to the Acrobat<br />

Core API 1.8<br />

Portable Document Format <strong>Reference</strong><br />

Manual 1.8<br />

Errata file 1.8<br />

<strong>Datalogics</strong><br />

Adobe PDF Library <strong>and</strong> <strong>DLI</strong> Installation<br />

<strong>Guide</strong> 1.7<br />

Adobe PDF Library Developer Overview 1.7<br />

<strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong> 1.7<br />

Java Interface User <strong>Guide</strong> 1.7<br />

RGB Color<br />

Collapsing to Gray 12.12<br />

Converting to CMYK 12.13<br />

Use in Annotations <strong>and</strong> Links 13.3<br />

Use in Color Description 12.2<br />

Use in ICC Based Color Profile 12.8<br />

Rotate (flag), in imported image files 1.12<br />

RSA encryption algorithm 17.16<br />

S<br />

Sample <strong>DLI</strong> Applications<br />

AcroForm 17.15<br />

Activating Files in Memory 17.2<br />

Annotations 17.12<br />

Encrypt 17.7<br />

FontFaux 17.9<br />

FontVerification 17.10<br />

Graphics 17.5<br />

Hello<strong>DLI</strong> 17.3<br />

memFiles 17.13<br />

MultiDoc 17.13<br />

NestedPDF 17.14<br />

Overview 17.2<br />

Paths 17.4<br />

psOutput 17.17<br />

SignDoc 17.16<br />

WideText 17.18<br />

Security Permissions<br />

Use in Documents, Beginning <strong>and</strong> Ending<br />

Encryption 3.4<br />

Use in Encrypt (Sample <strong>DLI</strong> Application) 17.7<br />

Self-Sign Plugin 17.16<br />

Separation<br />

Color Spaces<br />

Advanced 12.8<br />

Seven-Bit Safe<br />

Use in Displaying Images 11.6<br />

Signatures<br />

as images in Digital Signatures 15.3<br />

SignDoc (Sample <strong>DLI</strong> Application) 17.16<br />

St<strong>and</strong>ard Encoding<br />

Use in Documents, Beginning <strong>and</strong> Ending 3.3<br />

StdSecurityDataRec<br />

Use in Documents, Beginning <strong>and</strong> Ending 3.5<br />

sticky note<br />

Use in Annotations <strong>and</strong> Links 13.4<br />

Streaming PostScript<br />

Removal from <strong>DLI</strong> v3.0 1.11<br />

stroke (parameter)<br />

Use in Displaying Images 11.4<br />

Stroke Color 8.5<br />

Use in PDEGraphicState 10.2<br />

strokeColorSpec<br />

Use in Color Description 12.2<br />

Use in Line Drawing 10.14<br />

Sub-minor Version Number 2.5<br />

SubType (parameter)<br />

Use in Annotation Dictionary 13.8<br />

Use in Links 13.8<br />

T<br />

Table of Contents<br />

Generation via FontVerification (Sample <strong>DLI</strong><br />

Application) 17.10<br />

Text Container<br />

Creation <strong>and</strong> Positioning 8.3<br />

Text Placement Calls 8.4<br />

Text Layering 8.2<br />

Text Width 8.4<br />

Thread Safety


I.xvi<br />

<strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Caution on Multiple Initializations of pre-v6.1<br />

Library 2.8<br />

Initialization of non-thread-safe Library<br />

releases 2.12<br />

Multi-Thread Initializations 2.11<br />

Thumbnails<br />

Calls 3.3<br />

Use in Documents, Beginning <strong>and</strong> Ending 3.3<br />

TIFF (Tagged Image File Format)<br />

Encoding <strong>and</strong> Compression <strong>Reference</strong>s 11.3<br />

Image Conversion from 11.2<br />

Use in Displaying Images 11.8<br />

Use in Graphics (Sample <strong>DLI</strong> Application) 17.5<br />

TKAllocatorProcs<br />

Use in Setting Memory Allocation Routines 2.4<br />

TKResourceProcs<br />

Use in Setting Resource Allocation Routines 2.4<br />

Transformation Matrix<br />

Arguments 10.12<br />

Overview 10.12<br />

Translations<br />

Inversion 10.12<br />

Mirror-image 10.12<br />

Rotation 10.12, 10.13<br />

Scale/Rotation Caution 10.13<br />

Scaling 10.13<br />

Shearing 10.13<br />

Translation 10.12<br />

Transforms<br />

Association with Content Elements 8.2<br />

Tree Name<br />

Use in Links 13.7<br />

TrueType font<br />

Terminology usage 4.3<br />

Type<br />

Filled vs. Stroked 12.2<br />

Type (parameter)<br />

Use in Annotation Dictionary 13.8<br />

Use in Links 13.8<br />

U<br />

Unicode<br />

as CIDType2 Fonts 4.3<br />

Text Support<br />

Font Type Recommendations 4.10<br />

NULL string terminators A.29, A.30<br />

Unix Compiler Run-Time Libraries 1.4<br />

URI<br />

Use in Links 13.7<br />

URL<br />

Use in Links 13.7<br />

UseOutlines<br />

Use in Bookmarks 14.4<br />

V<br />

VeriSign signature plugin 17.16<br />

Version Number, Obtaining 2.5<br />

W<br />

What’s New in Previous Releases<br />

<strong>DLI</strong> v2.2.12<br />

Default Search Path Suppression 1.17<br />

<strong>DLI</strong> v2.2.13<br />

Default Search Path Suppression Exp<strong>and</strong>ed to<br />

All Platforms 1.16<br />

Image Search using Files in Memory 1.16<br />

<strong>DLI</strong> v3.0<br />

Addition of DLPDFTEXT Structure 1.11<br />

Adobe PDF Library now Thread-Safe 1.9<br />

Deleted Functions<br />

dlpdfdoccreatewithinstance 1.16<br />

dlpdfdocHexGraphics 1.15<br />

dlpdfdocsetembedappwidth 1.15<br />

dlpdfdocseterrorfile 1.16<br />

dlpdfdocsetformsascontent 1.15<br />

dlpdfdocsetwarningfile 1.16<br />

dlpdfdocsevenbitsafe 1.15<br />

dlpdffontverifytext 1.16<br />

dlpdfimageplaceascontent 1.15<br />

dlpdfsetlevel 1.16<br />

Digital Signature Support 1.10<br />

<strong>DLI</strong> Initialization now Required 1.11<br />

Enhanced Unicode Support 1.11<br />

New Functions<br />

dlpdfdocasciips 1.13<br />

dlpdfdoccreatesignature 1.13<br />

dlpdfdocsetsignatureappearance 1.13<br />

dlpdfinstancesetgrcachelimits 1.13<br />

dlpdfmemfiledeleteonclose 1.12<br />

dlpdfmemfilesetbuffer 1.12<br />

dlpdfmemfilesysgetmemusage 1.12<br />

dlpdfmemfilesyssetmemlimit 1.12<br />

dlpdfpageplacesignature 1.13<br />

dlpdfsignaturesetdatacallback 1.13<br />

dlpdfsignaturesetpkcs7cert 1.13<br />

dlpdfsignaturesetx509cert 1.13<br />

dlpdftext 1.13<br />

dlpdftextadvance 1.14<br />

dlpdftextdestroy 1.14<br />

dlpdftextfromutf16be 1.13<br />

dlpdftextfromutf16he 1.13<br />

dlpdftextfromutf16le 1.13<br />

dlpdftextfromutf32be 1.13<br />

dlpdftextfromutf32he 1.13<br />

dlpdftextfromutf32le 1.13<br />

dlpdftextfromutf8 1.13<br />

dlpdftextlength 1.14<br />

dlpdftextshowencodingnames 1.13


Index<br />

I.xvii<br />

dlpdftextstring 1.14<br />

dlpdftexttocontent 1.14<br />

dlpdfttload 1.14<br />

PDF Image Import Improvements 1.12<br />

Streaming PostScript Removed 1.11<br />

Updated Functions<br />

dlpdfdoccreate 1.15<br />

dlpdfinit 1.14, 1.15<br />

dlpdfterm 1.15<br />

What’s New in This Release<br />

Overview 1.8<br />

Revised <strong>DLI</strong> Version Numbering 1.9<br />

WideText (Sample <strong>DLI</strong> Application) 1.11, 17.18<br />

WinAnsiEncoding<br />

Use in Documents, Beginning <strong>and</strong> Ending 3.3<br />

WMF (Windows Metafile Format)<br />

Use in Graphical Language Forms 11.4<br />

Writing Pages<br />

Procedure for 1.2<br />

X<br />

x.509 certificate 17.16<br />

XYZ<br />

Use in Links<br />

with Zoom 13.5<br />

Z<br />

zoom<br />

Use in Bookmarks 14.2<br />

Use in Links 13.5


I.xviii<br />

<strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong>


Index<br />

I.xix


I.xx<br />

<strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong>


Index<br />

I.xxi

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!